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.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix: respect checkbox selections in Get Method modal for makeMethodToMakeMethod (#847)
Brad Barbin4ab64bf50744
diff --git a/apps/erp/app/modules/items/items.service.ts b/apps/erp/app/modules/items/items.service.tsindex fed4bbef75..fb6dddeab3 100644--- a/apps/erp/app/modules/items/items.service.ts+++ b/apps/erp/app/modules/items/items.service.ts@@ -111,7 +111,15 @@ export async function copyMakeMethod(sourceId: args.sourceId,targetId: args.targetId,companyId: args.companyId,- userId: args.userId+ userId: args.userId,+ parts: {+ billOfMaterial: args.billOfMaterial,+ billOfProcess: args.billOfProcess,+ parameters: args.parameters,+ tools: args.tools,+ steps: args.steps,+ workInstructions: args.workInstructions+ }}});}diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.jsonindex ac1fe4ea50..98aa8cc5aa 100644--- a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json@@ -1,5 +1,5 @@{- "generated": "2026-05-31T04:59:48.395Z",+ "generated": "2026-06-01T11:59:01.950Z","totalTools": 1083,"modules": 15,"tools": [diff --git a/packages/database/supabase/functions/get-method/index.ts b/packages/database/supabase/functions/get-method/index.tsindex 295e7396d0..5f5cb4b047 100644--- a/packages/database/supabase/functions/get-method/index.ts+++ b/packages/database/supabase/functions/get-method/index.ts@@ -3212,18 +3212,22 @@ serve(async (req: Request) => {}const [sourceMaterials, sourceOperations] = await Promise.all([- client- .from("methodMaterial")- .select("*")- .eq("makeMethodId", sourceMakeMethod.data.id)- .eq("companyId", companyId),- client- .from("methodOperation")- .select(- "*, methodOperationTool(*), methodOperationParameter(*), methodOperationStep(*)"- )- .eq("makeMethodId", sourceMakeMethod.data.id)- .eq("companyId", companyId),+ parts.billOfMaterial+ ? client+ .from("methodMaterial")+ .select("*")+ .eq("makeMethodId", sourceMakeMethod.data.id)+ .eq("companyId", companyId)+ : Promise.resolve({ data: [], error: null }),+ parts.billOfProcess+ ? client+ .from("methodOperation")+ .select(+ "*, methodOperationTool(*), methodOperationParameter(*), methodOperationStep(*)"+ )+ .eq("makeMethodId", sourceMakeMethod.data.id)+ .eq("companyId", companyId)+ : Promise.resolve({ data: [], error: null }),]);if (sourceMaterials.error || sourceOperations.error) {@@ -3233,18 +3237,22 @@ serve(async (req: Request) => {await db.transaction().execute(async (trx) => {// Delete existing materials and operations from target methodawait Promise.all([- trx- .deleteFrom("methodMaterial")- .where("makeMethodId", "=", targetMakeMethod.data.id)- .execute(),- trx- .deleteFrom("methodOperation")- .where("makeMethodId", "=", targetMakeMethod.data.id)- .execute(),+ parts.billOfMaterial+ ? trx+ .deleteFrom("methodMaterial")+ .where("makeMethodId", "=", targetMakeMethod.data.id)+ .execute()+ : Promise.resolve(),+ parts.billOfProcess+ ? trx+ .deleteFrom("methodOperation")+ .where("makeMethodId", "=", targetMakeMethod.data.id)+ .execute()+ : Promise.resolve(),]);// Copy materials from source to target- if (sourceMaterials.data && sourceMaterials.data.length > 0) {+ if (parts.billOfMaterial && sourceMaterials.data && sourceMaterials.data.length > 0) {await trx.insertInto("methodMaterial").values(@@ -3260,7 +3268,7 @@ serve(async (req: Request) => {}// Copy operations from source to target- if (sourceOperations.data && sourceOperations.data.length > 0) {+ if (parts.billOfProcess && sourceOperations.data && sourceOperations.data.length > 0) {const operationIds = await trx.insertInto("methodOperation").values(@@ -3270,12 +3278,18 @@ serve(async (req: Request) => {methodOperationParameter: _parameters,methodOperationStep: _attributes,...operation- }) => ({- ...operation,- id: undefined, // Let the database generate a new ID- makeMethodId: targetMakeMethod.data.id,- createdBy: userId,- })+ }) => {+ const insert = {+ ...operation,+ id: undefined, // Let the database generate a new ID+ makeMethodId: targetMakeMethod.data.id,+ createdBy: userId,+ };+ if (!parts.workInstructions) {+ insert.workInstruction = {};+ }+ return insert;+ })).returning(["id"])@@ -3294,6 +3308,7 @@ serve(async (req: Request) => {const operationId = operationIds[index].id;if (+ parts.tools &&operationId &&Array.isArray(methodOperationTool) &&methodOperationTool.length > 0@@ -3314,6 +3329,7 @@ serve(async (req: Request) => {if (!procedureId) {if (+ parts.parameters &&Array.isArray(methodOperationParameter) &&methodOperationParameter.length > 0) {@@ -3332,6 +3348,7 @@ serve(async (req: Request) => {}if (+ parts.steps &&Array.isArray(methodOperationStep) &&methodOperationStep.length > 0) {