Document
Updated
A document is an operation with a header, table parts, and states. The subtype is the current state. After Save, the subtype select on the card is frozen. There is no statuses field and no user-facing subtype change after Save except a command: it checks, sets the target subtype, and posts. SetSubtypeAsync is for services, events, and tests — not a substitute for the button.
Note
The engine replaces movements (Mix). It drops every movement the document already has and runs the posting scripts of the target subtype only. Early-state postings do not travel forward unless those scripts are also bound on the later subtype.
Do not add statuses. Posted-ness is postOnSave: true. A saved document is posted in its current subtype.
displayOrder of subtypes is the workflow order. The first subtype is the initial state, usually a draft with no scripts. A null subtype is not neutral — pick a real first subtype.
Nested kinds#
- Table part — the lines. Optional scalars on a line are nullable; on the header they are not.
- Command — the button. Scripts on a subtype without a command never post from the UI.
- Posting script — as many as the subtype needs, one per accounting goal.
- Event handler — fill fields, refuse values, spawn related documents. Does not write movements. Write an event handler.
- Print form — a sheet bound to a subtype or the type. Print a form.
The header is metadata plus identity (ID / Number from a number sequence). The journal lists Number, date, subtype, then every header field; hide extras per user in the column picker. Lookup properties on the type are the columns of a document picker (designer tab of the same name), same CSV as a dictionary. Another model overlays extras and hides on its document extension (lookupPropertiesAdd / lookupPropertiesHide).
Objects of this kind#
- SalesOrder
- SalesRealization
- CustomerPayment
- SalesReturn
- SalesCreditNote
- SalesDebitNote
- SalesQuotation
- SalesLead
- PurchaseOrder
- VendorPayment
- PurchaseReturn
- PurchaseCreditNote
- PickTask
- PutAwayTask
- GoodsIssue
- StockTransfer
- StockAdjustment
- StockCount
- ProductionOrder
- JournalEntry