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: SO line marked "Shipped" with no shipment (Non-Inventory Parts)
Problem
Sales order line PRT-103771.A (S000328) shows a green SHIPPED badge, but no
shipment exists and job.quantityShipped = 0/3. The badge is data-driven:
getSalesOrderJobStatus (packages/utils/src/status.ts:145) shows "Shipped" when
isCompleted && line.sentComplete. So salesOrderLine.sentComplete = true with no shipment.
Root cause
Two code paths disagree on what "never ships" means:
- Shipment creation (
createedge fn,functions/create/index.ts:2027) skips onlysalesOrderLineType === "Service"— a Non-Inventory Part DOES get a shipment line and ships normally. - Job completion (
complete_job_to_inventory, newest def20260727031247_inspection-production-links.sql:262) fulfills the SO line (sentComplete/quantitySent/sentDate) for everyitemTrackingType = 'Non-Inventory'item.
itemTrackingType = 'Non-Inventory' ⊋ type = 'Service'. A Non-Inventory Part is
Non-Inventory-tracked but has salesOrderLineType = 'Part', so it ships — yet completion
auto-marks it fulfilled. Same flaw in recompute_service_line_fulfillment
(20260723132843).
Fix (one migration, fix-forward — prior migrations are on main)
complete_job_to_inventory— narrow the SO-line fulfillment guard fromitemTrackingType = 'Non-Inventory'to also requiresalesOrderLineType = 'Service'. (Only the fulfillment block; the other Non-Inventory guards — inventory/COGS skips — are correct and untouched.)recompute_service_line_fulfillment— same narrowing (keeps reopen recompute consistent).- Data repair: reset
quantitySent=0, sentComplete=false, sentDate=NULLon lines that were erroneously auto-fulfilled — Non-Inventory, non-Service,sentComplete=true, have a Completed/Closed job, and have NO shipmentLine withshippedQuantity > 0. Idempotent.
Verification
pnpm exec turbo run typecheck --filter=@carbon/database(no type surface change; sanity).- Confirm the affected production row via the diagnostic query once DB reachable.
- Genuine Service Make-to-Order lines still fulfill on completion (guard still matches them).