Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: prepopulate item in save method

Brad Barbin70ddae5a19a2
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobMakeMethodTools.tsx b/apps/erp/app/modules/production/ui/Jobs/JobMakeMethodTools.tsx
index 8dd2047ae7..c82730f8a9 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobMakeMethodTools.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobMakeMethodTools.tsx
@@ -228,6 +228,12 @@ const JobMakeMethodTools = ({ makeMethod }: { makeMethod?: JobMakeMethod }) => {
}
};
+ useMount(() => {
+ if (isJobMethod && routeData?.job.itemId) {
+ getMakeMethods(routeData.job.itemId);
+ }
+ });
+
return (
<>
{permissions.can("update", "production") &&
@@ -429,7 +435,8 @@ const JobMakeMethodTools = ({ makeMethod }: { makeMethod?: JobMakeMethod }) => {
action={path.to.jobMethodSave}
validator={getJobMethodValidator}
defaultValues={{
- targetId: isJobMethod
+ // @ts-expect-error
+ itemId: isJobMethod
? routeData?.job?.itemId ?? undefined
: undefined,
}}
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteMakeMethodTools.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteMakeMethodTools.tsx
index 5ea6d52a17..f7ffd7e567 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteMakeMethodTools.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteMakeMethodTools.tsx
@@ -200,6 +200,12 @@ const QuoteMakeMethodTools = () => {
}
};
+ useMount(() => {
+ if (isQuoteLineMethod && line?.itemId) {
+ getMakeMethods(line.itemId);
+ }
+ });
+
return (
<>
{line &&
@@ -397,7 +403,8 @@ const QuoteMakeMethodTools = () => {
sourceId: isQuoteLineMethod
? line?.itemId ?? undefined
: undefined,
- targetId: isQuoteLineMethod
+ // @ts-expect-error
+ itemId: isQuoteLineMethod
? line?.itemId ?? undefined
: undefined,
}}