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
Plan: Raw Materials / Finished Goods Inventory Account Split
Spec: .ai/specs/2026-07-13-raw-materials-finished-goods-accounts.md
Progress
- Spec approved (classification rule + migration strategy resolved with Brad)
- Migration
20260713190909_raw-materials-finished-goods-accounts.sql(columns → 1220 per company group → backfill → NOT NULL → forkedbackflush_job_materials+complete_job_to_inventory→ dropinventoryAccountlast). Fork fidelity proven by diff against source definitions; idempotent re-run and legacy-state simulation both pass in rolled-back txns. - Seed files:
seed.data.ts(1210 → Raw Materials, added 1220 Finished Goods, remappedaccountDefaults),seed-company/index.tsfallbacks (RM→WIP, FG→RM),seed-dev.tsverified zero-change (derives fromaccountDefaults) - Migration applied locally (via crbn up) +
pnpm run generate:types(diff also picks up periodCloseTask/periodCloseTaskDefinition drift from merged #1134 — legitimate fix) -
resolveInventoryAccountinfunctions/shared/get-posting-group.ts+ all 5 edge functions updated (incl. post-receipt Inbound Transfer branch and thecreateMaterialWipEntrieshelper + 4 call sites inissue) - ERP:
accounting.models.tsvalidator +AccountDefaultsForm.tsx(two fields, new glossary termIds) - EE: Xero
inventory-adjustment.tsresolves per item;core/models.tscomment updated - Glossary:
account-default-inventoryreplaced withaccount-default-raw-materials+account-default-finished-goods; i18n catalogs extracted + 96 translations filled (linguito check clean); docs site had no stale references - Verification: zero live
inventoryAccounthits; typecheck green (erp, @carbon/ee, @carbon/database, @carbon/glossary); biome zero errors; deno check at 252-error baseline parity; SQL fixture test (rolled back) proves backflush credits RM 1210 / completion debits FG 1220; browser e2e proves Account Defaults form renders+saves and a posted PO receipt debits 1210 Raw Materials (JE-2026-07-000001)
Follow-up fix (same branch, 2026-07-13)
- "Inventory Shipped Not Invoiced" default rendered blank on the Account Defaults page: it was seeded as a liability (2130) while the field filters options to class Asset — and no posting code has ever written to it (post-shipment posts COGS/inventory directly). Removed entirely per Brad:
20260713214441_remove-inventory-shipped-not-invoiced-account.sqldrops theaccountDefault."inventoryShippedNotInvoicedAccount"column and deletes the seeded account wherever it has no journal history (per-row FK-violation guard leaves custom-referenced rows in the chart). Also removed: the seed chart entry +accountDefaultsmapping, the validator field, the form field, and the glossary term; types/swagger regenerated; i18n catalogs pruned. An earlier reclass-to-asset migration (20260713204033) was superseded and deleted before ever being committed. If a shipped-not-invoiced accrual flow is ever built, the account + column come back with the feature.
Follow-up fix 2 (same branch, 2026-07-13): overhead absorption in the job-completion catch-up
- Jobs completed with unposted production events got labor absorption but no overhead absorption (user-reported on JE-2026-07-000003). PR #1127 added overhead (DR WIP / CR Overhead Absorption at workCenter.overheadRate × duration) only to the
post-production-eventedge function;complete_job_to_inventory's catch-up loop forpostedToGL = falseevents never learned it, silently understating WIP and Finished Goods. Fixed forward in20260713222236_fix-job-completion-overhead-absorption.sql(new migration — applied migrations are never edited): the loop readsoverheadRate, posts the mirrored overhead pair gated on cost > 0 + account configured, and switches event lines to per-eventproduction-event:<id>references so post-production-event can attribute/reverse them. Proven in a rolled-back fixture test: 0.6h at labor 50/overhead 100 → WIP +30/+60, absorption −30/−60, FG debit 140 includes overhead. Pre-existing events posted under the old scheme (e.g. J000001's 0.31 of overhead) are not retro-posted.
Not e2e-exercised (verified by typecheck + identity to the proven pattern)
post-shipment/post-sales-invoicecredit side andissueedge-fn runtime — same shared resolver + item-select pattern proven live inpost-receipt; deno-check parity confirms no new type errors at those call sites.
Notes
- Never edit historical migrations; fork latest function definitions (
20260710044431backflush,20260706182830complete_job_to_inventory) withDROP FUNCTION IF EXISTS, preserving signatures. - Migration filename: randomized HHMMSS (never 000000).
- No commits unless Brad asks.