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(production): treat emptied drawer orders as authoritative in bulk Create Jobs

naveenkashb5c9e7872f8f
diff --git a/apps/erp/app/modules/production/ui/Planning/ProductionPlanningTable.tsx b/apps/erp/app/modules/production/ui/Planning/ProductionPlanningTable.tsx
index 31dc1ed304..322c448cc0 100644
--- a/apps/erp/app/modules/production/ui/Planning/ProductionPlanningTable.tsx
+++ b/apps/erp/app/modules/production/ui/Planning/ProductionPlanningTable.tsx
@@ -133,9 +133,10 @@ const ProductionPlanningTable = ({
items: selectedRows
.filter((row) => row.id)
.map((row) => {
- // Drawer edits win; fall back to auto-computed orders for unopened items
+ // Drawer edits win (even an emptied list); fall back to
+ // auto-computed orders only for items never opened in the drawer
const sourceOrders =
- ordersMap[row.id!] && ordersMap[row.id!]!.length > 0
+ row.id! in ordersMap
? ordersMap[row.id!]!
: (ordersByItemId.get(row.id!) ?? []);
const ordersWithPeriods = sourceOrders.map((order) => {