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(items): bulk material property edits report every refusal instead of stopping at the first

Raul90ab8154dd2c
diff --git a/apps/erp/app/routes/x+/items+/update.tsx b/apps/erp/app/routes/x+/items+/update.tsx
index 4c70113c4d..c096b8a180 100644
--- a/apps/erp/app/routes/x+/items+/update.tsx
+++ b/apps/erp/app/routes/x+/items+/update.tsx
@@ -126,9 +126,9 @@ export async function action({ request }: ActionFunctionArgs) {
return { error: { message: "No materials found" }, data: null };
}
- // One material row per readable id, shared by its revisions. The
- // service applies the dependent resets and, with generated material
- // IDs on, regenerates each material's readable id and name.
+ // Each material commits on its own, so try them all and name every
+ // refusal rather than stopping partway through the selection.
+ const failures: string[] = [];
for (const materialId of materialIds) {
const update = await updateMaterialProperties(
client,
@@ -141,9 +141,12 @@ export async function action({ request }: ActionFunctionArgs) {
}
);
if (update.error) {
- return { error: { message: update.error.message }, data: null };
+ failures.push(`${materialId}: ${update.error.message}`);
}
}
+ if (failures.length > 0) {
+ return { error: { message: failures.join("; ") }, data: null };
+ }
return { data: null, error: null };
}