The delivery lifecycle
A sales order stores only open or done. The UI derives delivery state from shipped quantity versus ordered quantity.
01. Delivery states
Section titled “01. Delivery states”Select a state to see what it allows and where the order can move next.
| State | How it is derived | What it means |
|---|---|---|
| Not shipped | No ordered quantity has shipped. | The order is open and editable. |
| Partially shipped | Some, but not all, quantity has shipped. | Stock has been consumed and shipped rows are protected. |
| Shipped | Status is done or all ordered quantity has shipped. | The order is closed and read-only. |
Partially shipped is not stored as a database status. It is recalculated from line quantities.
02. What delivery does
Section titled “02. What delivery does”Delivery runs through the inventory kernel and updates the order:
| Step | Result |
|---|---|
| Consume stock | Delivered quantities pull lot-backed stock from the selected ship-from location. |
| Record shipped quantities | Each delivered line increments shippedQuantity. |
| Protect shipped history | Quantity cannot be reduced below shipped plus cancelled quantity, and shipped lines cannot be removed. |
| Advance delivery state | Partial delivery shows Partially shipped; final delivery sets the order to done. |
| Preserve the record | Once shipped, the card becomes read-only for shipped history. |
If delivery would oversell, the app blocks first and requires explicit confirmation before allowing negative stock.
03. Valid transitions
Section titled “03. Valid transitions”| Action | From | To | Notes |
|---|---|---|---|
| Deliver some | Not shipped | Partially shipped | Consumes stock and records shipped quantity. |
| Deliver all | Not shipped | Shipped | Closes the order and sets shippedAt. |
| Deliver rest | Partially shipped | Shipped | Completes remaining quantity. |
| Reduce shipped quantity | Any shipped state | Blocked | Quantity cannot drop below shipped plus cancelled. |
| Reopen shipped order | Shipped | Blocked | Shipped is terminal in the order UI. |
| Delete after shipping | Any shipped state | Blocked | Inventory and invoice history must be preserved. |
04. Why deletion can be blocked
Section titled “04. Why deletion can be blocked”An order can be deleted only while it has no shipped, inventory-consumed, or accounting-pushed history. The list deletion guard says shipped, inventory-consumed, or accounting-pushed orders cannot be deleted.
Deleting an eligible order also updates demand coverage and the manufacturing orders created for it — not-yet-started ones are removed, while any that have already begun are kept and unlinked from the order.