Purchase Order lifecycle
A PO moves from the shop's draft to a vendor confirmation to physical receipt. The lifecycle tracks both the procurement side (when did we order, did we get it) and the finance side (did we pay, what's the balance).
Slice 6 (Purchase Orders) is schema-complete; UI not built.
States and transitions
State definitions
| State | What it means |
|---|---|
draft | PO being assembled by staff; not yet sent to vendor |
sent | PO transmitted to vendor; awaiting confirmation |
confirmed | Vendor has acknowledged and committed to fulfill |
partial | Some items have been received; PO is open until full |
received | All items received; awaiting invoice reconciliation |
reconciled | Vendor invoice matched against PO; payment due/scheduled |
cancelled | PO cancelled at any point before fulfillment |
Behaviors
Creation paths
From low-stock alert: the daily-cron low-stock report has a "Create PO" button per vendor that pre-fills a draft.
Manual: Settings → Purchase Orders → New, pick vendor, add SKUs from inventory.
From vendor API (when wired for QBP, Shimano, etc.): wholesale stock checks become PO drafts directly.
Transmission
POST /api/pos/{id}/send:
- Generates a PO email (or API call for integrated vendors)
- Records the timestamp + recipient
- Transitions state to
sent - Audit-logged
Receiving
POST /api/pos/{id}/receive:
- Body:
{ lines: [{ po_line_id, qty_received }] } - Updates
purchase_order_lines.qty_received - Updates
inventory_variants.qty_on_order(-) andqty_on_hand(+) - If all lines fully received, transitions to
received; elsepartial
Reconciliation
POST /api/pos/{id}/reconcile:
- Body:
{ invoice_number, invoice_total_cents, lines: [{ po_line_id, unit_cost_cents }] } - Compares invoice to PO; flags mismatches for the operator to resolve
- On match, transitions to
reconciled - Generates an A/P entry (for the shop's accountant export)
Audit
Every transition writes audit rows. The PO is one of the longest-living entities (can span weeks); the audit trail is the only complete record of who placed what when, who confirmed, what arrived in which shipment.
See also
- SKU and variant entity
- Slice 6 — Purchase Orders
- Daily ops — the low-stock alert flow