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.
Mirror purchase-returns + shipments work into sales-returns (RMAs) + receipts
Branch: returns-module. Mirrors the b82c278b66 purchase-return/shipment UI+data
work onto the sales-return (RMA) and receipt sides. Decisions locked: A = RPC
(faithful mirror), B = reopen-to-Draft in scope, picker = receipt-side only (no RMA-line
tracked-entity picker — domain-asymmetric, left untouched).
Do NOT mirror (domain asymmetry — verified)
Tracked-entity pre-selection on the RMA line: TrackedEntityPicker,
returnableEntities/selectedEntityIds/pickedEntityLabels, trackedEntityIds submit,
a set* write path, the $id.new auto-select block. The RMA's entity provenance is
captured at the receipt (ReturnEntityForm); salesReturnOrderLineTrackedEntity is
read-only legacy. Preserve sales-only Disposition select + salesResolvePrice pricing.
Tasks
Receipts (inventory)
- R1.
ReceiptForm.tsxSourceDocumentLink: addSales Return Ordercase →path.to.salesReturnOrderDetails,LuUndo2icon, gateview,sales. + importLuUndo2.
Sales Returns (RMA) — data layer
- S1.
get_returnable_shipment_linesRPC (mirror ofget_returnable_receipt_lines, but sales semantics: unit price fromsalesOrderLine.unitPrice(no conversion factor), UoM COALESCE(sol, sl)). Folded INLINE into the existing branch migration20260909195813_returnable-receipt-lines-rpc.sql(NOT a new migration) — user runscrbn resetto rebuild + regenerate types. - S2.
sales.service.tsgetReturnableLinesForCustomer: replace JS fan-out with the RPC (search/limit/offset/totalCount) — mirrorgetReturnableLinesForSupplier. - S3.
sales.service.tsreopenSalesReturnOrder: mirrorreopenPurchaseReturnOrder(Confirmed/Cancelled → Draft, row-locked). Export from module barrel. - S4.
routes/x+/sales-return-order+/returnable-lines.tsx: add search/limit/offset + returntotalCount. - S5.
routes/x+/sales-return-order+/$id.status.tsx: accept"Draft", call reopen. - S6.
routes/x+/sales-return-order+/$id.$lineId.details.tsxloader: also resolve internal source-doc ids (shipment(id,…),salesOrder(id,…),salesInvoice(id,…)), add tolinkage.
Sales Returns (RMA) — UI
- S7.
ReturnableLinesModal.tsx: rewrite to mirrorReturnableReceiptLinesModal(debounced search + pagination "Show more" + selected-line snapshot + counts). - S8.
SalesReturnOrderLineForm.tsx:SourceReferencenavigable links (replace Badges);areLineFieldsLocked = isEditing && status !== "Draft"→isReadOnlyon Item/qty/unitPrice/restockFee. Keep Disposition + salesResolvePrice. - S9.
SalesReturnOrderHeader.tsx: add Reopen dropdown item + statusFetcher (mirrorPurchaseReturnOrderHeader).
Verify
pnpm exec turbo run typecheck --filter=erp(after user applies migration + regen types).- No commit unless asked.