Sales Module
Overview
The Sales module is responsible for managing all sales-related data, including orders, order lines, and order types.
It defines how sales are created, processed, and tracked within the system.
Sales is a foundational module and is required for:
- recording customer orders
- processing individual order lines
- managing order statuses and types
- tracking payments, dispatch, and fulfillment
- auditing all sales activity
All operations are tenant-aware and scoped to the current tenant.
Services
The Sales module consists of the following services:
- Sales Orders - customer orders with full details
- Sales Order Lines - individual items within an order
- Sales Order Types - categorization of orders (e.g., credit or standard)
Models
This module exposes and consumes the following models:
Sales Order Model
Represents a customer sales order.
Fields:
Id (type: long)- internal identifierOrderNumber (type: string?)- order reference numberEntityId (type: long?)- customer entity identifierStatusId (type: int?)- order statusOrderDate (type: DateTime?)- order creation dateCurrency (type: string?)- order currencyBillingAddressId (type: long?)- billing address referenceShippingAddressId (type: long?)- shipping address referencePriceListId (type: long?)- price list appliedSubtotal (type: decimal?)- subtotal amountTaxTotal (type: decimal?)- tax totalShippingTotal (type: decimal?)- shipping totalGrandTotal (type: decimal?)- final order totalNotes (type: string?)- additional notesCreatedAt (type: DateTime?)- creation timestampPromotionId (type: int?)- applied promotionPaidDate (type: DateTime?)- payment dateCompletedDate (type: DateTime?)- order completion dateDispatchDate (type: DateTime?)- dispatch/shipping dateCourier (type: string?)- courier nameCourierRef (type: string?)- courier reference numberSalesOrderTypeId (type: int?)- order type
Validation:
IsReadyToAdd()- requires
EntityId,OrderNumber,OrderDate,Currency,SalesOrderTypeId,GrandTotal >= 0
- requires
IsReadyToUpdate()- requires
Id > 0,EntityId > 0,SalesOrderTypeId > 0
- requires
Sales Order Line Model
Represents an individual line item within a sales order.
Fields:
Id (type: long)- internal identifierSalesOrderId (type: long?)- parent sales orderLineNumber (type: int?)- line sequence numberProductId (type: long?)- ordered product identifierDescription (type: string?)- line descriptionQuantity (type: decimal?)- quantity orderedUnitPrice (type: decimal?)- price per unitDiscountAmount (type: decimal?)- discount appliedTaxAmount (type: decimal?)- tax appliedLineTotal (type: decimal?)- line total after discounts and taxWarehouseId (type: long?)- warehouse referenceEntityUserId (type: long?)- user who created the lineNotes (type: string?)- additional notesQuantityFulfilled (type: decimal?)- fulfilled quantityQuantityReturned (type: decimal?)- returned quantityReturnedDate (type: DateTime?)- date of return
Validation:
IsReadyToAdd()- requires
SalesOrderId,LineNumber,ProductId,Quantity > 0,UnitPrice >= 0,LineTotal >= 0
- requires
IsReadyToUpdate()- requires
Id > 0,SalesOrderId > 0,ProductId > 0,Quantity >= 0,UnitPrice >= 0
- requires
Sales Order Type Model
Represents a category/type of sales order.
Fields:
Id (type: int)- internal identifierTitle (type: string?)- order type nameIsCredit (type: bool?)- indicates if order is credit type
Validation:
IsReadyToAdd()- requires
Title
- requires
IsReadyToUpdate()- requires
Id > 0,Title
- requires
Notes:
- Only one Sales Order Type can exist per title