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:
| Status | Set by |
|---|---|
purchased | Default on creation. Also where cancel → restore returns. |
shipped | Mapping the car to a container (bulkMapToContainer) or assigning to a RORO trip. |
arrived | Container or RORO marked arrived (propagates to its linked cars). |
sold_locally | Invoice issued while car was in purchased status. |
sold_import | Invoice issued while car was in shipped or arrived status. |
cancelled | Operator-triggered cancel action with one of three reasons. |
Cancel + restore
Section titled “Cancel + restore”Open a car (or select multiple), click Cancel. Pick a reason:
| Reason | GL behavior |
|---|---|
| Cancelled | Reverse the original purchase posts. Inventory and AP unwind. No P&L hit. |
| Lost or stolen | IAS 2 write-down to NRV=0. Dr 5100 / Cr 1100 at home cost. P&L hit. |
| Returned to supplier | Same 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.
Arrival propagation
Section titled “Arrival propagation”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.
Invoice void resets sold cars
Section titled “Invoice void resets sold cars”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.
Why no dropdown?
Section titled “Why no dropdown?”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.