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
Lessee leases — self-review findings (2026-10-11)
Four read-only review agents over aa5a8a032e..HEAD. Every item is checked before a fix.
Jobs and notifications
- M1
expireLeasesexpires a lease with a net ROU asset above 0 (ownership transfers / purchase option reasonably certain) — then Purchase is refused. Expire only when the last schedule line'sclosingRouAssetis 0. - M2
stampLeaseReminderswrites the lease's current date, not the reminded date. Writer.datewhere the column still equals it. - R digest misses drafts when
lease-billingthrows after partial commits; reminders go toinvoiceNotificationGroup(AR) — owner may lack purchasing view. - S tests for
expireLeases/stampLeaseReminders; one shared billable-status constant;formatDetailDateuses JS Date.
Server functions
- M3 Purchase at end of term counts the option price twice (Pending option row deleted while the carrying liability already excludes it); the test asserts the wrong cost.
- M4 Terminate on the end date strands a reasonably certain option row in the liability.
- M5 Purchase after the option row is Invoiced breaks
leasePayment_unique(raw 500). - M6 Modify / Terminate accept a date inside a quarterly or annual payment period.
- M7 Cancel voids only
commencementJournalId; a Modify journal stays. - M8 Opening-balance path leaves Pending rows due before the as-of date; the invoice job bills them again.
- R posting does not compare the Lease line amount with the payment row; posting does not check lease status (Cancelled); lifecycle vs run proposal race (no advisory lock); Short-Term override not re-tested; amortization months after Modify; Cancel loads all accounts; Modify end<effective gives 500.
- S VOID test; void label for opening journal;
currencyDecimalsimport from rental module.
Database / utils / run engine
- M15
lease-mathmonth counting:addMonthsclamps day 29–31 butmonthsBefore/monthsThroughusewholeMonthsInTerm(original day) → wrong payment points for a lease starting on the 31st;leaseMonthStartingrejects valid month starts. - M16 Short-Term test uses rounded-down whole months — 12 months + 15 days classifies Short-Term.
- M17
leasesviewcurrentLiabilityignores status (Terminated/Purchased/Cancelled must be 0) and readsrevenueRecognitionSchedule(accounting RLS) — purchasing users always seeinitialLiability. Read posted state fromleaseScheduleLine. - R schedule / event tables writable through the API;
purchaseInvoiceLineIdno FK (consider a delete trigger); short arrears last period lands early; old posted rev-rec runs holding rental rows; migration section 9 untested; missing lease insources.leasesposts without dimensions. - S lease-math tests (31st start, escalating operating, short arrears period); one shared run-type filter; dead
RUN_TYPES/RUN_LABEL; staleLeaseposting-policy comment; linear scans; FKs onfixedAssetId/voidedPurchaseInvoiceId;discountRate >= 0check.
ERP UI
- M9
$id.statuscancel deletes a Draft with onlyupdate: purchasing(bypassesdelete). - M10
upsertLeasePaymentmatches the row on id + companyId only — a row from another lease can be moved (MCP tool). Add.eq("leaseId", …). - M11 Invoice-line validator accepts
leasePaymentIdfrom the client; a hand-made Lease line can claim a payment row (row stays Pending → billed twice). Strip on create, keep stored value on update. - M12 Failed Activate redirects to details → setup/payments; use
requestReferrerlike the rental sibling. - M13 Classification override redirects to details → setup/payments; use referrer / setup accounting.
- M14
update.tsxregenerates rows at amount 0 (frequency/timing chosen first) → zero rows enable Next and Activate. - R moving commencement earlier marks first payments Skipped; grid edits ignore
invoiceFromDate; Details/Accounting changes silently replace edited rows; foreign-currency gap links to Details; disabled unit price may post null; Lease Liabilities empty without purchasing_view;$id.schedule/$id.eventsshow editable page for a Draft. - S remove the unreachable Draft branch of
LeasePaymentsand the edit route; currency decimals fallback 2; log before error redirects; staleupdate.tsxcomment; revenue-recognition messages became generic.
Status (2026-10-11, after the several-assets change)
Every M item is fixed in 6692835a20, with a test where one fits (lease-math, post-lease, lifecycle, the report). These R and S items are fixed too:
- Posting compares a capitalized Lease line with its payment row, and refuses a Draft or Cancelled lease.
- Modify refuses an end date before the effective date in its validator, not with a 500.
- ROU amortization after a Modify runs over what is left of the economic life.
- Grid edits of a payment row set Pending or Skipped from
invoiceFromDate. $id.scheduleand$id.eventssend an editor's Draft to its setup.- The Draft branch of
LeasePaymentsand the$id.payments.$paymentIdedit route are gone. regenerateLeasePaymentsrefuses an unknown currency instead of falling back to 2 decimals.- The cancel void names the voided journal (
VOID <description>).
Still open:
- R: a lifecycle action and a run proposal can interleave (no advisory lock); the run's out-of-date check catches the result at post time.
- R:
post-leaseimportscurrencyDecimalsfrom the rental module. - S: one shared billable-status constant (create-lease-invoices and the daily job).