ERP Core / Sales OMS

Sales OMS - Domain Invariants & Business Rules

Invariants governing order financial balance, pricing immutability, stock allocation, and split/cancellation governance.

Domain Invariants & Business Rules (“The Law”)

Domain invariants represent absolute truths that the Sales / OMS domain enforces. Any transaction violating these invariants is aborted.


1. Order Financial Balance Rule

Every sales order must satisfy a strict financial balance between its commercial components:

$$ \text{Total Order Value} = \sum(\text{Line Prices} - \text{Discounts}) + \text{Taxes} + \text{Shipping Fees} $$

  • The Law: The order total must exactly equal the sum of line-level amounts after discounts, plus taxes and shipping fees.
  • Line Precision: Each line amount is calculated using enterprise decimal precision. Rounding is deterministic and reconciled to the order total.
  • Tax Rule: Tax amounts are computed per line or per order based on jurisdiction rules and added to the total.
  • Shipping Rule: Shipping fees may be allocated per line or applied at order level, but they must be explicitly represented in the total.

Structural Consequence of Violation

If totals do not reconcile, downstream invoicing will mismatch the customer’s commitment, leading to disputes, accounting errors, and regulatory inconsistencies.


2. Commitment & Pricing Immutability

Once a Sales Order transitions to Confirmed, its commercial terms are permanently locked.

  • The Law: A confirmed order cannot be edited in place for unit prices, discounts, taxes, shipping fees, or customer-specific terms.
  • Prohibited Operations: Changing line prices, adding promotional discounts, modifying customer tier, or altering currency after confirmation.
  • Corrective Path: Commercial corrections require supplementary orders, credit notes, or formal return workflows.

Commercial Rationale

Immutability protects both the enterprise and the customer from post-hoc price manipulation and ensures that fulfillment and accounting operate from a single, trusted commercial baseline.


3. Stock Allocation Rule

Hard allocation cannot occur without verified Available-to-Promise (ATP) stock in the target fulfillment node.

  • The Law: A fulfillment batch can only be released to a node if every line has sufficient ATP at that node.
  • Soft Reservation: During order capture, inventory may be soft-reserved to prevent overselling without firm node assignment.
  • Hard Allocation: At release, soft reservations are converted to firm allocations tied to specific stock at a specific node.
  • ATP Recalculation: ATP is recalculated after every reservation, allocation, cancellation, or inventory movement.

Fulfillment Consequence

Releasing a batch without verified ATP would cause pick failures, customer disappointment, and downstream compensations. The allocation rule ensures WMS only receives achievable instructions.


4. Split & Cancellation Governance

Orders cannot be cancelled without governance once they have entered active warehouse fulfillment.

  • The Law: A confirmed order that has been released for picking/packing cannot be cancelled in place. It must follow a formal return or compensation workflow.
  • Pre-Release Cancellation: Allowed if no hard allocation has occurred and no fulfillment batch has been released.
  • Post-Release Cancellation: Requires interception of the fulfillment batch, recall of goods, and issuance of credit note or RMA.
  • Partial Cancellation: Individual lines may be cancelled before release; after release, line cancellation follows the same return workflow as full order cancellation.

Operational Rationale

This invariant prevents ad-hoc cancellations from corrupting warehouse operations, carrier manifests, and financial accruals. It enforces disciplined exception handling through formal compensating processes.

Our Premium Sponsors

Obelaw is proudly open-source. Continued development, bug fixes, and community support are made possible by the generosity of our sponsors.

Sponsor Obelaw