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
Inventory Adjustment — decimal quantities on a batch-tracked item
Last tested: 2026-09-30
Route: /x/inventory/quantities/<itemId>/details → "Update Inventory" drawer
Prerequisites
- A batch-tracked item with a fractional UoM (e.g.
MAT-AL7075-PLT, UoM POUND, in Carbon Development — look the id up byreadableIdWithRevision; it changes on re-seed). - A storage unit to hold stock (e.g.
A2-L1). - ERP dev server running (
post-inventory-adjustmentis a server function in the ERP process). - With
itemCost.unitCost = 0the cost layer is $0 and NO journal is posted (cost === 0guard) — expected.
Steps
1. Open the drawer
- Item detail page → Update Inventory button. A drawer form opens.
- Fields (by input
name):storageUnitId(combobox),adjustmentType(combobox: Set Quantity | Positive Adjustment | Negative Adjustment | Scrap),readableId(Batch Number, free text),quantity(react-aria number),scrapReasonId(only when type=Scrap).
2. Positive decimal adjustment (creates a lot)
- Adjustment Type → Positive Adjustment.
- Storage Unit →
A2-L1(open combobox, filter, click the option). - Batch Number → type a NEW value, e.g.
DEC-TEST-A(free text mints a freshtrackedEntityId→ a new entity is created). - Quantity →
2.5, then blur (click another field) — the react-aria hidden input commits on blur; verifyinput[name=quantity].value === "2.5". - Submit by calling
requestSubmiton the drawer's FORM, passing the Save button as the submitter —form.requestSubmit(saveButton)(or bareform.requestSubmit()).requestSubmitis a form method, not a button method, and a plain click on Save does nothing. - Verify: Quantity on Hand rises by 2.5 (e.g. 60 → 62.5); storage-unit table
shows
A2-L1 | 2.5 | <batch>.
3. Negative decimal drain to zero (drain path → Consumed)
- Adjustment Type → Negative Adjustment, Storage Unit →
A2-L1. - Batch Number → the existing lot's readableId (e.g.
DEC-TEST-A). The negative path resolves the entity BYreadableId, so free text is fine here. - Quantity → the full remaining (e.g.
2.5). Submit. - Verify: on-hand returns to the pre-test value; the lot disappears from the
on-hand table; in
/x/inventory/tracked-entities?search=<batch>the entity shows quantity 0, status CONSUMED (NOT a 0-qty Available husk).
Selector Notes
- Comboboxes are custom: click to expand,
fillthe inner search combobox, then click the option. Refs shift after each selection (a "Clear" button appears) — re-snapshotbefore the next field. - Read committed state via
input[name=...].valueinside[role=dialog], never the visible text. - Right after the drawer opens, the first combobox click can time out (open
animation) —
sleep 2and retry once.
Common Failures
- Scrap of an EXISTING batch does not post. The batch field is free text and
mints a NEW
trackedEntityId; the Scrap path resolves the entity by that id, so it 400s "Tracked entity not found" against the new id and the real lot is untouched. Scrapping an existing lot must be driven from a surface that passes the real entity id (not this drawer's free-text batch field). This is a form/harness limitation, not an edge-function bug. - A submit that does nothing → you clicked Save instead of
requestSubmit, or a react-aria number field never blurred (hiddenquantitystill stale).