48 lines
1.7 KiB
Markdown
48 lines
1.7 KiB
Markdown
|
|
# Order Workflow Rules
|
||
|
|
|
||
|
|
## Quote to Order
|
||
|
|
- A quote remains in `quotes`.
|
||
|
|
- Quote items remain in `quote_items`.
|
||
|
|
- Creating an order from a quote creates one new `orders` record.
|
||
|
|
- The new order links back to the quote through `orders.quote`.
|
||
|
|
- Each quote item is copied into `order_items`.
|
||
|
|
- Each copied order item links back to its source quote item through `order_items.quote_item`.
|
||
|
|
- Creating an order from the same quote twice returns the existing order instead of duplicating it.
|
||
|
|
- Quote status is not changed by order creation.
|
||
|
|
|
||
|
|
## Order Items as Source of Truth
|
||
|
|
`order_items` is the operational source of truth after an order is created.
|
||
|
|
|
||
|
|
Order items move through:
|
||
|
|
- supplier ordering / purchase order
|
||
|
|
- driver list / collection pool
|
||
|
|
- collected
|
||
|
|
- office received
|
||
|
|
- invoicing
|
||
|
|
- picked
|
||
|
|
- loaded
|
||
|
|
- delivered
|
||
|
|
|
||
|
|
Driver/collection fields use `drv_*` naming where possible, for example `drv_status` and `drv_id`.
|
||
|
|
|
||
|
|
## Driver List and Collection Pool
|
||
|
|
The old Django `driver_list` workflow is represented by the new `collection_pool` concept.
|
||
|
|
|
||
|
|
`collection_pool` tracks assignment and collection work, while `order_items` keeps the item lifecycle state.
|
||
|
|
|
||
|
|
## Future Stock Collection
|
||
|
|
Later we will add a dedicated `stock` collection.
|
||
|
|
|
||
|
|
Stock is used when:
|
||
|
|
- more items are collected than the order requires
|
||
|
|
- stock is ordered and arrives at the office
|
||
|
|
- collected items should be booked into stock instead of moving to invoicing
|
||
|
|
|
||
|
|
Until that collection exists, stock-related operational movement stays on `order_items`.
|
||
|
|
|
||
|
|
## Delivery Notes
|
||
|
|
Delivery notes should be generated from order items that are ready, loaded, or delivered.
|
||
|
|
|
||
|
|
## Repairs
|
||
|
|
Repairs will be rebuilt only where they connect to the practical order/quote/repair flow.
|