Sales order fields
Sales orders combine a header, one or more item lines, computed money fields, fulfillment state, and provider sync state. Snapshot fields keep old orders readable when related records are renamed.
01. Order header
Section titled “01. Order header”| Field | Type | Default | Meaning |
|---|---|---|---|
orderNumber | varchar(32) | auto | Human-readable order number, unique per organization. |
customerId | uuid | required | Customer the order is for. |
customerName | varchar(255) | snapshot | Customer name copied onto the order. |
customerProjectId | uuid | null | Optional project link. |
status | constrained varchar | open | Stored status: open or done. |
priorityRank | integer | null | Queue rank for open-order allocation. |
orderDate | date | today | Date the order was taken. |
shipDate | date | null | Delivery deadline used by planning and allocation. |
requestedDate | date | null | Date the customer asked for — stored/API only (used as the Xero invoice due date); not shown on the order detail grid. |
shippedAt | timestamptz | null | Set when delivery ships the final remaining quantity. Closing a partial by cancelling the remaining items does not change it. |
ship* fields | varchar | customer default | Ship-to address lines, city, region, postcode, country. |
billing* fields | varchar | customer default | Bill-to address lines, city, region, postcode, country. |
shippingFeeDescription | varchar(255) | null | Label for the shipping charge. |
shippingFeeAmount | numeric(12,2) | 0 | Shipping charge. |
shippingFeeTaxAmount | numeric(12,2) | 0 | Tax on the shipping charge. |
subtotalAmount | numeric(12,2) | computed | Subtotal before tax: item line subtotals plus shipping fee. |
taxAmount | numeric(12,2) | computed | Order tax total. |
totalAmount | numeric(12,2) | computed | Order total. |
notes | text | null | Free-text notes. |
version | integer | 1 | Optimistic concurrency version. |
02. Order lines
Section titled “02. Order lines”| Field | Type | Default | Meaning |
|---|---|---|---|
itemId | uuid | required | Product or material sold. |
itemName | varchar | snapshot | Item name copied onto the line. |
itemSku | varchar | snapshot | SKU copied onto the line. |
unitName | varchar | snapshot | Sales unit copied onto the line. Falls back to the stocking unit when the item has no different sales unit. |
quantity | numeric(12,4) | required | Ordered sales quantity. Must use no more than four meaningful decimal places and be between 0.0001 and 99,999,999.9999; trailing zeroes are allowed. |
shippedQuantity | numeric(12,4) | 0 | Sales quantity delivered so far. |
cancelledQuantity | numeric(12,4) | 0 | Sales quantity cancelled from a partially shipped order. Shipped plus cancelled cannot exceed ordered quantity. |
stockingUnitName | varchar | snapshot | Stocking unit copied onto the line for fulfillment and inventory. |
salesToStockFactor | numeric(12,4) | snapshot | Stocking units in one sales unit. Must be between 0.0001 and 99,999,999.9999. |
stockQuantity | numeric(12,4) | derived snapshot | Ordered quantity converted to stocking units. Must remain between 0.0001 and 99,999,999.9999. |
stockShippedQuantity | numeric(12,4) | 0 | Delivered quantity in stocking units. |
stockCancelledQuantity | numeric(12,4) | 0 | Cancelled quantity in stocking units. |
listUnitPrice | numeric(10,2) | base price | List price used for discount comparison. |
unitPrice | numeric(10,2) | required | Price charged per sales unit. |
discountPercent | numeric(5,2) | 0 | Discount from list price to unit price. |
suggestedUnitPrice | numeric(10,2) | resolved | Pricing engine suggestion. |
pricingSourceType | constrained varchar | base_price | base_price or schedule_break. |
pricingScheduleName | varchar | null | Winning schedule snapshot. |
pricingBreakLabel | varchar | null | Winning quantity break snapshot. |
isPriceOverridden | boolean | false | True when the suggested price was changed. |
taxRateId | uuid | null | Tax rate id. |
taxRateName | varchar | snapshot | Tax rate name copied onto the line. |
taxRatePercent | numeric | 0 | Tax percent copied onto the line. |
lineSubtotal | numeric(12,2) | computed | Sales quantity times price per sales unit. |
lineTaxAmount | numeric(12,2) | computed | Tax on the line subtotal. |
lineTotal | numeric(12,2) | computed | Line subtotal plus tax. |
sortOrder | integer | 0 | Display order. |
Each saved order line is unique by item within the order.
The line snapshots both quantity bases. Customer-facing order, delivery, BOL, pricing, and invoice values use the sales fields. Availability, allocation, manufacturing, lots, and stock consumption use the stock fields. Changing the item’s sales unit later does not reinterpret an existing line. See Sales vs. stock units.
03. Status and fulfillment values
Section titled “03. Status and fulfillment values”| Area | Values |
|---|---|
| Stored order status | open, done |
| Derived delivery state | Not shipped, Partially shipped, Shipped |
| Sales item fulfillment | available, expected, not_available, complete |
| Ingredient fulfillment | not_needed, not_applicable, in_stock, expected, not_available, picked |
| Production fulfillment | not_applicable, make, not_started, in_progress, done, blocked |
| Allocation status | ready, waiting_production, partial, short |
| Pricing source | base_price, schedule_break |
04. Accounting sync fields
Section titled “04. Accounting sync fields”The sales order read model exposes provider invoice sync fields with legacy xero* names, including invoice id, invoice number, push status, push error, pushed time, retry count, email status, and emailed time.
Use the UI wording connected accounting provider when describing the action. The active provider can be Xero or QuickBooks depending on setup.
Orders with cancelled remaining quantities cannot be pushed to accounting until shipped-only invoicing is supported.