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.
Returns Module — Step-by-Step Manual Test Script
A click-by-click script for verifying the Returns module (customer RMAs +
supplier returns) on the local dev stack. Every test says exactly what to
click, what to type, and what you must see. Tests marked ✅ were already
executed end-to-end during implementation (on the Northspoke Cycles demo
company, which now contains RMA000001 Completed, RMA000002 Confirmed, and
RTS000001 Shipped from that run — your numbers will continue from there).
Conventions used below
- Bold = something you click or a screen region.
Monospace= something you type or a value you must see. - "Left rail" = the icon/button column on the far left (Accounting, Inventory, Sales, …). "Sidebar" = the second column that appears inside a module (Manage / Configure groups).
- Where a test needs data from an earlier test, it says so at the top.
T0 — Setup and login
- Make sure the stack is running (
crbn updone; app on theERP_URLfrom.env.local, normallyhttp://localhost:3000). - Open the app. On the login page, type
[email protected]into Email Address and click Sign in with Email. - On Choose a company, click Northspoke Cycles.
- Expected: the dashboard loads with the left rail visible.
Known local-DB quirk (pre-existing, not from this branch): money values may render without trailing zeros (
$1899instead of$1,899.00) because the local DB is missingcompanySettings.showCurrencyTrailingZeros. The Appendix explains the fix (rebuild from migrations).
T1 — Navigation and empty states
- Click Sales in the left rail.
- Expected: the sidebar's MANAGE group contains RMAs (between Orders and Portals) and the CONFIGURE group contains Return Reasons.
- Click RMAs. Expected: a table titled RMAs with columns RMA number, Customer, Status, Order Date, Received, Credited, Assignee, Created — plus an Add RMA button. (On a fresh company the table is empty with an Add RMA empty-state.)
- Click Purchasing in the left rail. Expected: Supplier Returns appears in the MANAGE group. Click it — a mirror table with a Shipped column and a Supplier RMA # column.
T2 — Return Reasons configuration screen
- Sales → Return Reasons (CONFIGURE group).
- Expected: six seeded rows:
Defective,Wrong Item Shipped,Damaged in Transit,No Longer Needed,Warranty,Other. Each row has a Zero Inventory Value column showingNo. - Click Add Reason (top right). In the drawer, type
Customer Remorseinto Name, leave the Zero inventory value toggle off, click Save. Expected: the row appears; a success toast shows. - Click the
Damaged in Transitrow (or its Edit menu item). Turn ON Zero inventory value ("Returned goods re-enter inventory at zero value"). Save. Expected: its column now showsYes. (T8 uses this.) - Open the row menu on
Customer Remorse→ Delete → confirm. Expected: row gone. (Deleting a reason that is used by an RMA line is refused with an "in use" error instead.)
T3 — Create an RMA from a shipped order (the linked path) ✅
Uses: a customer with a POSTED shipment. In the demo data, Cascade Bike Shop received 4 × BIKE-GX (a serialized bicycle) on shipment SHP000010.
- Sales → RMAs → Add RMA.
- Expected form defaults: RMA ID shows "Next Sequence" (leave it),
Order Date is pre-filled with today's date on the company calendar,
Return Location defaults to your location, Currency to
US Dollar. - In Customer, select
Cascade Bike Shop. Expected: currency/ contact/location follow the customer where configured. - Optionally type the customer's claim number into Customer Reference
(e.g.
CLAIM-123). - Click Save.
- Expected: you land on the RMA detail page. The header shows a new
readable id (
RMA0000NN), a gray Draft badge, a disabled Confirm button (no lines yet), and Cancel. The left explorer shows "Looks empty here" with Add Line Item and Add lines from document. The right rail shows Properties (customer, dates, currency). - Click Add lines from document.
- Expected: a list of that customer's returnable shipment lines — for
Cascade:
BIKE-GX — Gravel GX Complete Bicycle, shipmentSHP000010, orderSO000001, Returnable: 4, unit price1899. This list is your legitimacy check: it contains ONLY items actually shipped to this customer, minus anything already authorized on other RMAs. If an item is not in this list, the system has no record of shipping it to them. - Tick the BIKE-GX row, change its quantity to
2(try typing9first — the input clamps to the returnable 4; the hard stop is at Confirm), and click the modal's confirm/add button. - Expected: the explorer now shows the line (
0 / 2received, dispositionPending). Click the line. - Expected line form: Item, Quantity
2, Unit Price1899(copied from the sales order line — the credit basis), Restocking Fee0, Return Reason select, linkage chips showingSO000001/SHP000010, a Disposition select (disabled — nothing received yet), and an Expected serials section listing the serials shipped to this customer. Pick 2 of them. - Set Return Reason to
Defective. Save the line.
T4 — Create a blind RMA (no document links)
- Sales → RMAs → Add RMA, pick any customer, Save.
- Click Add Line Item (not "from document").
- Expected: the Item selector offers the full item catalog — this is the deliberate blind return path for goods that arrive without matchable paperwork. Note what distinguishes a blind line everywhere downstream: no linkage chips on the line form, no quantity cap at Confirm, and receipt posting values it at current cost (not original cost). If you want to verify the claim first, close this and use Add lines from document — absence from that list means "never shipped to this customer".
- Pick any item, Quantity
1, Unit Price as agreed, Save. - This RMA can run the whole T6–T10 lifecycle identically; for tracked items the receipt will create a new serial/batch (On Hold) instead of reactivating one — visible in Traceability as an entity with no shipment lineage (another blind-return tell).
- Clean up: delete this RMA (header ⋯ → Delete) or keep it for T5.
T5 — Over-authorization is rejected at Confirm ✅
Uses: T3's shipment line (4 shipped, 2 already authorized on your T3 RMA).
- Create a second RMA for
Cascade Bike Shop(as T3 steps 1–5). - Add lines from document → the same BIKE-GX line now shows
Returnable: 2. Add it, then open the line and change Quantity to
3, Save. (The form warns/clamps; if it clamps, set 3 via the modal's quantity before adding.) - Click Confirm in the header.
- Expected: an error toast naming the line: cannot authorize
3— only2of4remains returnable for the linked document line. The RMA stays Draft. ✅ - Fix the quantity to
2, Confirm again — now it succeeds. Keep this RMA Confirmed for T10 (void test) or Cancel it (header Cancel; allowed because nothing is received).
T6 — Confirm: sequence id + PDF ✅
Uses: the T3 RMA (Draft, one linked line with 2 expected serials).
- On the T3 RMA, click Confirm.
- Expected: status badge flips to Confirmed; a success toast shows.
- Expected: a PDF button/link appears in the header — click it. A PDF opens titled Return Merchandise Authorization with the RMA number, customer block, return-to address, and the line (item, qty 2, price, reason). ✅
- On Details, the documents area lists the attached
RMA0000NN - <timestamp>.pdf. ✅ - Negative checks: Confirm is no longer offered; header edits are still allowed until Completed/Cancelled.
T7 — Receive the return (same-serial re-entry) ✅
Uses: the T6 Confirmed RMA.
- Click Receive on the RMA header (shortcut — drafts the receipt and opens it; skip to step 3), or Inventory (left rail) → Receipts → Add Receipt.
- In the receipt form, set Source Document =
Sales Return Order. - Expected: the Source Document ID combobox lists open RMAs (Confirmed / Partially Received only). Pick your RMA.
- Expected: the receipt is created (
RE0000NN) with one line, quantity2= the outstanding amount, unit price0(cost is resolved at posting, never the credit price). - On the receipt line, Expected: instead of the usual free-text serial
inputs, you get Returned serial numbers — two dropdown slots offering
ONLY the serials you picked on the RMA line (and only ones currently
Consumed, i.e. actually out with the customer). Assign both slots. ✅
- Negative check: there is no way to type an arbitrary serial here — a serial you never shipped cannot be booked back.
- Partial receipt: you can lower the received quantity to
1first; post; the RMA goes Partially Received; a second receipt takes the rest.
- Click Post on the receipt header.
- Expected: receipt goes Posted; navigate back to the RMA
(breadcrumb or Sales → RMAs) — status is now Received (or Partially
Received if you split), and the line shows
2 / 2received. ✅
T8 — Verify the money and the genealogy ✅
Uses: the T7 posted receipt. Needs accounting enabled (it is on the demo company).
- Accounting → Journal Entries. Open the newest entry.
- Expected: source
Sales Return Receipt, two balanced lines — Dr Inventory / Cr Cost of Goods Sold — at the original outbound cost, not the sale price and not necessarily current cost. For the demo BIKE-GX: the original shipment consumed 4 units for3129.67, so 2 units re-enter at1564.84(2 × 782.4183), while the sale price was 1899. ✅ - Items → Traceability (or the item's tracking view): find one of the
returned serials. Expected: the SAME entity id, status On Hold,
with a
Return Receiptactivity linking back through its original shipment history. ✅ - Zero-value path: repeat T3→T7 with a line whose Return Reason is
Damaged in Transit(flagged in T2). Expected: receipt posts, stock quantity appears, but NO journal entry is created and the inventory layer is worth0. - Blind path: a blind line (T4) posts at the item's current cost instead.
T9 — Dispositions ✅ (Use As Is) / Return to Customer / Scrap→Issue
Uses: the T7 Received RMA.
A. Use As Is ✅
- Open the RMA line. Disposition is now enabled. Select
Use As Is. - Expected: success toast. In tracked entities / on-hand views, both returned serials are now Available (sellable stock). ✅
B. Return to Customer (claim rejected)
- On a received line, set Disposition =
Return to Customer. - Click Ship on the order header (shortcut), or Inventory →
Shipments → Add Shipment, Source Document =
Sales Return Order, pick the RMA (listed once Partially Received/Received). - Expected: a shipment is created with the received-not-yet-shipped-back quantity. For serials, the line tracking accepts the On Hold returned entities (normally only Available stock can ship — this source is the exception).
- Post the shipment. Expected: stock leaves again at carried cost
(journal Dr COGS / Cr Inventory), the serials go back to Consumed
with a
Return Shipmentactivity.
C. Scrap / Rework → quality Issue
- On a received line, choose
Scrap(orRework) in the disposition select. - Expected: you are redirected to a NEW quality Issue, pre-filled:
the item at the received quantity with disposition Scrap, the returned
serials attached, and an RMA Lines association pointing back at your
RMA line. The RMA line shows disposition
Scrap. - The Issue owns it from here: work it and Complete it — the write-off
posts through the Issue's close (check Journal Entries for the
Non-Conformanceentry). The RMA itself posts no GL for scrap.
T10 — Void the receipt ✅
Uses: the T5 second RMA (Confirmed), or any RMA you can receive fresh.
- Receive it fully (T7 steps; serial assignment optional for this test) and post.
- Expected: RMA Received, quantities counted.
- On the receipt, open the header menu → Void → confirm in the modal.
- Expected: receipt Voided; the RMA drops back to Confirmed
with
0received ✅; assigned serials return to Consumed; on-hand for the item is back where it started (the ledger entries net to zero); and the voided return's stock cannot be consumed by later shipments (its cost layers are zeroed). ✅
T11 — Issue credit with a restocking fee ✅
Uses: the T7 Received RMA (2 received, Use As Is).
- Open the RMA line, set Restocking Fee to
0.1(10%, entered as a 0–1 fraction like discounts), Save. - On the RMA header, click Issue Credit (requires invoicing permission).
- Expected modal: one row per creditable line — Received
2, Credited0, an editable Quantity defaulting to2, a fee preview, and a total:2 × 1899 × (1 − 10%) = 3,418.20with379.80fee. ✅ - Submit. Expected: you land on a Draft credit memo
(
CR-YYYY-MM-0000NN) for3,418.20, linked to the RMA (the RMA's Credits panel lists it). ✅ - Click Post on the memo. Expected: memo Posted; its reason
account is 4900 — Sales Returns (the seeded contra-revenue account);
back on the RMA, Credited now shows
2. ✅ - Partial + void behavior: credit 1 of 2 instead — a second credit later offers the remaining 1; Void a posted memo — the RMA's Credited drops back (the pool re-opens). Two drafts cannot double-credit the same quantity (the cap counts drafts).
T12 — Replacement order ✅ (link)
- On the RMA header, click Create Replacement.
- Expected: a new Draft sales order opens, pre-filled with the RMA's
customer and lines, priced by the normal price resolution (edit to
0for a warranty replacement). Its Customer Reference carries the RMA number. - Back on the RMA, the header now shows a link chip to that SO instead of the button (one replacement per RMA; clicking the action again just returns the existing one).
T13 — Short-close and the Complete guard ✅
- Take an RMA that is partially received (e.g. authorize 2, receive 1).
- Click Complete on the header. Expected: blocked, with messages naming each problem: "Line 1 is short of authorized quantity (1 of 2)…" and/or "…has received quantity pending disposition". ✅
- On the line, click Stop Receiving (short-close). Set the received quantity's Disposition.
- Complete again. Expected: status Completed; the document locks (line edits disabled). ✅
- Also check Cancel rules: allowed only while nothing is received and no receipt document exists (delete the draft receipt first if you made one).
T14 — Supplier return end-to-end ✅
Uses: a supplier with POSTED PO receipts. Demo: the steel-tube supplier has
20 × 4130-STEEL-DB-ROUNDTUBE-Ø28.6 received.
- Purchasing → Supplier Returns → New.
- Pick the Supplier. Type the supplier's own authorization number into
Supplier RMA # (e.g.
SUP-RMA-77) — most suppliers require theirs on the paperwork. Save. Expected:RTS0000NN, Draft. - Click Add from document. Expected: ONLY receipt lines from this supplier with returnable remainders (received − already returned), each showing its receipt + PO numbers. Rows that can't be traced to a posted receipt are labeled Blind — same scrutiny rule as customer RMAs: use this list to verify you actually bought the part from them. Quantities and prices here are in the stocking (inventory) unit, converted once from the PO's purchase unit.
- Add a line (e.g. qty
5). For serial/batch items, the line's entity picker offers only Available stock received from that supplier. - Confirm. Expected: cap check (received − already returned),
status Confirmed, PDF titled Return to Supplier showing
Supplier RMA #: SUP-RMA-77. ✅ - Click Ship on the RMA header (shown once a line is dispositioned
Return to Customer), or Inventory → Shipments → Add Shipment, Source =
Purchase Return Order, pick the RTS. Expected: lines pre-fill with the open quantities. Post it. - Expected: RTS status Shipped (or Partially Shipped), line shows
5shipped ✅; Accounting → Journal Entries has aPurchase Return Shipmententry: Cr Inventory (Raw Materials) / Dr GR/IR Clearing at carried cost (demo: 5 × 24 =120) ✅; shipped tracked entities go Consumed with aReturn Shipmentactivity. Voiding the shipment reverses all of it and reopens the quantities. - Issue Credit on the RTS header → quantities default to shipped −
credited → submit → Draft AP credit memo (demo: 5 × 12 =
60). Post it. Expected: reason account GR/IR Clearing (netting the shipment's GRNI debit), and the RTS Credited column shows5. ✅ - Create Replacement → a draft PO priced from the linked PO line / supplier part, cross-linked.
- Complete works once every non-short-closed line is fully shipped (no disposition step exists on this side — goods just leave).
T15 — Quality bridge: Issue → supplier return
Uses: a quality Issue whose disposition rows are Return to Supplier —
create one via Quality → Issues → New with a purchased item, set the
item row's disposition to Return to Supplier, and associate the supplier
(or a receipt line) under Associations.
- On the Issue's Details page, below the disposition list, Expected: a Supplier Return card with a supplier picker (optional) and a Create Supplier Return button (needs purchasing permission).
- Click Create Supplier Return (leave the picker empty when the issue has exactly one associated supplier — it auto-resolves; with several, you must pick one).
- Expected: you land on a new Draft RTS pre-filled with the item, the uncovered quantity, the issue's tracked entities, and — where the issue has receipt-line associations from that supplier — the receipt/PO links and price. The Issue's Associations tree now shows Supplier Return Lines.
- Click Create Supplier Return again (from the Issue). Expected: no duplicate — you are redirected to the existing open draft (quantities are owned per association; only uncovered amounts would create anything).
- Try to Complete the Issue. Expected: blocked with "Supplier return RTS0000NN is open — ship, short-close, or cancel it first".
- Confirm + ship the RTS fully (T14 steps 5–7). Now Complete the Issue. Expected: it closes; the write-off journal covers ONLY any quantity NOT shipped via the return (fully shipped ⇒ no scrap write-off at all — the shipment already relieved inventory against GRNI); the shipped entities stay Consumed (they are at the supplier, not Rejected in your stock).
- Cancel variant: cancel the RTS instead — its coverage returns to the write-off pool and the Issue closes with the full scrap posting.
T16 — Permission checks
Uses: a second user or an employee type with reduced permissions (Users → Employee Types).
- Without Sales view: the RMAs nav item and
/x/sales/rmasare inaccessible (403/redirect). - With Sales but without Invoicing create: the Issue Credit button is hidden/disabled and a direct POST to the credit route is rejected.
- Without Purchasing: Supplier Returns screens are inaccessible; the Issue's Supplier Return card is hidden.
- Without Quality create: the Scrap/Rework escalation is rejected.
- Receiving/shipping stays governed by Inventory permissions, unchanged.
T17 — How to verify a return is legitimate (summary)
When someone claims a return and you're not sure the goods were ever traded with them:
- Always try "Add lines from document" first. It is the system's evidence: only posted shipments to that customer (RMA) / posted receipts from that supplier (RTS) appear, net of previous returns. Not listed ⇒ no trading record ⇒ any line you add is a blind return by definition.
- Read the linkage chips on each line. Chips (SO/shipment/invoice or PO/receipt) = verified lineage with a hard quantity cap. No chips = blind = your judgment call; the system will value it at current cost and, for tracked items, mint a brand-new entity with no history.
- Serialized goods verify themselves. The pickers only offer serials with the right provenance, and the return receipt refuses any serial that wasn't expected on the RMA — a serial you never sold cannot come back.
- Cross-check history when in doubt: the customer's Sales → Orders / supplier's Purchasing → Orders, the item's ledger, and Traceability for any serial the party quotes at you.
Appendix — local dev DB drift (optional)
If your local DB predates this branch and carries another branch's schema
(e.g. cutList tables, a missing showCurrencyTrailingZeros column), don't
patch the catalog by hand — rebuild the disposable local database from
migrations (crbn up / pnpm db:migrate on a fresh volume) and re-run
pnpm db:types. On this branch the generated-types diff should then be
empty.