Skip to content

Status workflow

cars.status has six values: purchased, shipped, arrived, sold_locally, sold_import, cancelled. You cannot pick the status from a dropdown. The platform derives it from the action you took:

StatusSet by
purchasedDefault on creation. Also where cancel → restore returns.
shippedMapping the car to a container (bulkMapToContainer) or assigning to a RORO trip.
arrivedContainer or RORO marked arrived (propagates to its linked cars).
sold_locallyInvoice issued while car was in purchased status.
sold_importInvoice issued while car was in shipped or arrived status.
cancelledOperator-triggered cancel action with one of three reasons.

Open a car (or select multiple), click Cancel. Pick a reason:

ReasonGL behavior
CancelledReverse the original purchase posts. Inventory and AP unwind. No P&L hit.
Lost or stolenIAS 2 write-down to NRV=0. Dr 5100 / Cr 1100 at home cost. P&L hit.
Returned to supplierSame as Cancelled. Rejected for consignment cars (the supplier IS the consignor).

Cancelled cars keep their containerId for audit but do not count toward container capacity. They remain visible (you can filter them in/out via the status chip).

To undo: open the cancelled car, click Restore. The platform looks up every GL row tagged sourceType = 'car_cancellation' and reverses each. Status flips cancelled → purchased. Idempotent.

When a container or RORO trip is marked arrived, the platform finds every linked car currently in shipped status and bulk-advances them to arrived. Cars already in purchased, arrived, sold_*, or cancelled are skipped.

Voiding an invoice doesn’t just reverse the GL — it also flips each linked car’s status from sold_* back to purchased, in the same database transaction. The car keeps its containerId / roroShipId so you can re-issue without losing shipping context.

A free-text status dropdown is how invariants get broken. The platform’s single source of truth for status is “what action happened, recorded in the ledger.” Every status flip is auditable to a named mutation in the ledger. Adding a cars.updateStatus mutation would let an operator cancel without unwinding GL, sell without an invoice, or arrive without propagation. The dropdown was removed deliberately.