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.
Supersession trial fixes
Source: customer trial board (.context/attachments/DqBNfz/Supersession Trial (1).pdf),
supersession section. Old part = predecessor, new part = successor.
Tasks
- Picking honours a job-creation swap. Look up the supersession on
COALESCE(substitutedFromItemId, itemId); Consume First pulls the predecessor while it has warehouse stock (qty / substitutionFactor); Prefer New falls back to the predecessor only while the successor has none. TS (resolvePickTarget,generatePickingList) and SQL (get_picking_schedule, new migration) mirror each other.
- Picking honours a job-creation swap. Look up the supersession on
1b. MRP nets a Consume First BUY component's on-hand before moving the shortfall to the successor (post-explosion pass in
mrp.ts); made components keep the full swap.- Planning tab shows incoming supersessions ("Supersedes") and offers "Add predecessor", which writes the row on the old item with this item as successor.
- Discontinuation Date keeps its label, gets a clearer description, optional for Consume First.
- Prefer New description matches the pick-time fallback.
- Stock Only joins
REDIRECTING_MODESso production demand moves to the successor at job creation and in MRP.
- Stock Only joins
- Cycle guard in
upsertItemSupersession(service) surfaced as a field error.
- Cycle guard in
- Update
.claude/rules/supersession-system.md; run tests, typecheck, lint,pnpm generate:mcp.
- Update
- Job creation keeps a Consume First material on the predecessor while it has
on-hand at the job's location (
withoutStockedConsumeFirst); swaps only once it is out.
- Job creation keeps a Consume First material on the predecessor while it has
on-hand at the job's location (
- Partial stock: job lines are never split at creation (one line on the predecessor,
with a live "remaining M will be picked as NEW" note);
pullConsumeFirstPredecessorspulls a successor line onto a stocked predecessor;generatePickingListsplits pick lines; pick-side rule lookup falls back to the row's own item.
- Partial stock: job lines are never split at creation (one line on the predecessor,
with a live "remaining M will be picked as NEW" note);
- "Picked as X in place of this item" note on the job materials page; clearer substitution note on ERP and MES picking lines.
- Cancelling a job returns picked-but-unconsumed material from lineside to the
warehouse (
$jobId.status.tsx→returnJobRemainders, guard accepts Cancelled).
- Cancelling a job returns picked-but-unconsumed material from lineside to the
warehouse (
- Planning sees the redirect: MRP moves the actual-demand share to the successor
(
demandActual); the job materials Order Status nets a Consume First shortfall against the successor and names it in the badge.
- Planning sees the redirect: MRP moves the actual-demand share to the successor
(
- Item planning tab list: open job material lines follow the rule (predecessor keeps what its stock covers, successor shows the rest "via OLD"), matching the chart bars.
- Consumption follows what was picked (
lib/picked-consumption.ts): completion backflush, manual/step issue and the return sweep read the pick lines per item, old part first; the material row is untouched.
- Consumption follows what was picked (
Verification
deno test packages/database/supabase/functions/lib/picked-consumption.test.tsdeno test packages/database/supabase/functions/lib/supersession-pick.test.tspnpm --filter ./apps/erp exec vitest run app/modules/inventory/supersession-pick.test.tspnpm exec turbo run typecheck --filter=erp --filter=@carbon/eepnpm run lintpnpm check:manifest