Reference for the units and settings sub-modules of sales_orders, with unit fields and uniqueness, unit generation, and the per-tenant order chain settings.
This page describes two sub-modules of src/cluster_erp/modules/sales_orders/. units/ keeps the individual pieces (units, also called assets) ordered on an order line, with the customer's asset number and the company's serial number. settings/ keeps one row of settings per tenant for the order, shipment, and document chain. Shipments that carry units are described on shipments.
A customer never gets the same asset number twice, and a serial number exists once, both among live rows (src/cluster_erp/modules/sales_orders/units/models.py:24-39, src/cluster_erp/modules/sales_orders/units/services.py:169-197).
A line cannot have more live units than its quantity; generate-units creates the remaining units, numbering asset numbers from a start value when given (src/cluster_erp/modules/sales_orders/units/services.py:198-272).
The identifiers of a shipped or delivered unit are frozen because they are printed on issued documents (src/cluster_erp/modules/sales_orders/units/services.py:35, src/cluster_erp/modules/sales_orders/units/services.py:274-290).
The settings row is created on first read; an update must address that row, checks the record version, and validates number templates (src/cluster_erp/modules/sales_orders/settings/services.py:56-96).
The setting internal_order_no_enabled is offered to the platform as a display switch through DescribeDisplaySwitches (src/cluster_erp/modules/sales_orders/settings/services.py:97-100, src/cluster_erp/modules/sales_orders/module.py:108-110).