Sales #sales #orders #fulfillment #pricing #reservations #credit-limit #email #analysis-codes #customer-hold #rules Raw .md

Sales Orders

Manage customer sales orders, stock reservations, order confirmations, picking triggers, document emailing, and analysis codes.

Routes: /sales-orders /sales-orders/new /sales-orders/:id

Sales Orders

The Sales Orders module orchestrates customer order fulfillment, from initial draft creation to automated inventory reservation, warehouse picking triggers, document emailing, and final invoice generation.


Sales Order Lifecycle & Automated Rules

stateDiagram-v2
    [*] --> Draft : Create Order
    Draft --> Quoted : Send as Quote
    Draft --> Confirmed : Confirm Order (Stock Allocated)
    Draft --> Cancelled : Cancel

    Quoted --> Confirmed : Customer Accepts
    Quoted --> Cancelled : Quote Expired / Declined

    Confirmed --> Picking : Warehouse Starts Picking (Auto)
    Confirmed --> Cancelled : Cancel (Release Allocation)

    Picking --> Shipped : Carrier Dispatches All Goods (Auto)
    Picking --> Confirmed : Pick Cancelled

    Shipped --> Invoiced : Generate & Post Invoice (Auto)

    Invoiced --> Archived : Archive
    Cancelled --> Archived : Archive

Automated State Transition Rules Engine

The order engine continuously monitors warehouse events to advance order states without manual intervention:

Rule NameEvent TriggerEvaluation ConditionTarget State
auto-advance-to-picking-on-first-pickFirst Pick RecordedOrder is in Confirmed state and at least one item is pickedPicking
auto-ship-when-all-lines-dispatchedOutbound Shipment DispatchedAll order lines have Quantity Shipped >= Ordered QuantityShipped
auto-invoice-when-fully-invoicedSales Invoice PostedAll order lines are fully invoiced against posted AR invoicesInvoiced

Business Logic & Sourcing Controls

1. Stock Allocation vs. Backorders

  • When an order is Confirmed, available stock in the designated fulfillment warehouse is immediately allocated, preventing other orders from claiming those units.
  • If available stock is insufficient to fulfill the entire order, the system prompts the operator to Generate Backorders, routing the shortage quantity directly to the Purchase Demands queue.

2. Credit Limits & Customer Holds

  • If the customer’s total exposure exceeds their credit limit, or if the customer account is marked On Credit Hold, the system warns operators during order entry and blocks confirmation until approved by a credit manager.

3. Multi-Currency Order Pricing

  • Orders lock in the customer’s trading currency and the active exchange rate to the system base currency upon creation.
  • Invoices, line totals, and taxes are calculated in the customer’s currency, with base currency equivalents tracked for financial reporting.

4. CRM Opportunity Linkage & Deal Conversion

  • Sales orders can be linked directly to a CRM Opportunity (opportunityId).
  • When converting a winning deal directly from the CRM Opportunity pipeline, the link is established automatically.
  • The order details card features a direct navigation link to the associated opportunity, and the order’s booked value feeds the live deal revenue metric in the CRM module.

Step-by-Step Workflows

1. Creating and Confirming an Order

  1. Go to Sales → Orders (/sales-orders).
  2. Click New Sales Order (/sales-orders/new).
  3. Select the Customer. Price scale, currency, and tax positions load automatically.
  4. Set the Required Delivery Date and Fulfillment Warehouse.
  5. (Optional) Select or link an active CRM Opportunity to attribute booked revenue to a sales deal.
  6. Add items, quantities, and line discounts.
  7. Click Confirm Order. The system allocates inventory and queues the order for picking.
  8. Click Email Order Confirmation to send the branded Typst PDF confirmation.

Field Reference

FieldDescription
CustomerDebtor account purchasing goods.
Order NumberUnique order reference (ORD-...).
Required DatePromised delivery date.
Fulfillment LocationDispatch warehouse facility.
OpportunityCRM sales deal associated with the order.
Order StatusStage (Draft, Quoted, Confirmed, Picking, Shipped, Invoiced, Cancelled, Archived).
Gross Margin %Calculated margin based on current WAC.
Credit HoldIndicator showing if customer has an active credit block.

Notes & Tracking Reference Guide

The system clearly distinguishes between internal notes (private operational memos) and external instructions (printed on customer or carrier documents):

Field NameOrigin / ScopeClassificationTarget AudienceWhere to Enter / EditPrinted on Documents / PDFs
Delivery Instructions (shippingNotes)Sales Order / Transfer OrderExternalCarrier drivers, dispatchersSales Order → Delivery card; Shipping workbenchPrinted on Shipping Labels (DELIVERY INSTRUCTIONS: box). Included in Shipping Docket data payload.
Shipment Notes (notes)Outbound ShipmentInternalWarehouse team, logistics historyCreate Shipment dialog, Pick & Ship panel, Shipment detailsKept off customer documents; saved in shipment audit record and inventory dispatch memo (DSP-DIR-...).
Order Notes (notes)Sales OrderInternalSales team, customer service, operationsSales Order → Notes card; Counter Sales checkoutNot printed on any customer PDFs (Quotes, Confirmations, Invoices, Dockets) to prevent private sales remarks leaking.
Tracking Number (trackingNumber)Outbound ShipmentExternalCustomer, carrier, warehouseCreate Shipment dialog, Pick & Ship panel, Shipping WorkbenchPrinted on Shipping Dockets and encoded as barcode/QR code on Shipping Labels.
Line Item Comments (productDescription)Order Line (lineType = 'Comment')ExternalCustomer, pickers, receiving dockSales Order lines tablePrinted directly in line item tables on Quotes, Confirmations, Invoices, and Shipping Dockets.
Document Cover / Intro Text (customPdfText / quoteIntroText)Dynamic PDF generationExternalCustomerEmail / Print document modal dialogPrinted in header banner on Quotes, Order Confirmations, Invoices, and Shipping Dockets.

Field Reference & Data Dictionary

Key database fields, input parameters, and definitions associated with this workflow screen:

Field / Parameter Display Name Description & Rules
customer_id Customer Account Debtor account. Automatically populates currency, credit limits, price scale, and default tax position.
order_number Order Number Unique sales order identifier (e.g. ORD-2026-00124).
required_date Required Delivery Date Target customer receipt date used for fulfillment priority.
fulfillment_location_id Fulfillment Warehouse Warehouse facility from which items will be allocated, picked, and dispatched.
opportunity_id Sales Opportunity Associated CRM sales deal tracking commercial revenue rollups.
state_code Order Status Order state (Draft, Quoted, Confirmed, Picking, Shipped, Invoiced, Cancelled, Archived).