Example documents: configuration
Everything the example module reads, what each does, and what to set it to. The point of the list is that it is short: behaviour that varies by customer is a setting or a rule, never a code change, and this is the whole of it.
The module flag
| Key | Effect when off |
|---|---|
example | The screen, the routes and the service all refuse. Existing rows stay in the database untouched. |
Turning a module off hides a feature; it does not delete anything. Turning it back on restores the screen with the data as it was.
Settings
| Key | Type | Default | What it does |
|---|---|---|---|
approval.order_total_threshold | money | 1000.00 | At or above this amount, submitting a document sends it for approval instead of completing it. Set it to 0 to have everything approved, or very high to have nothing approved. |
workflow.allow_self_approval | boolean | false | Whether the person who raised a document may approve it. Leave it off unless your business is small enough that the alternative is nothing ever being approved. |
numbering.example_document.format | text | EX-{fy}-{sequence:5} | The document number format. {sequence} is required. {fy} is the fiscal year, {yyyy} the calendar year, {mm} the month. |
numbering.example_document.reset | choice | fiscal_year | When the counter goes back to one: never, fiscal_year, calendar_year or month. |
locale.currency | text | USD | The currency a document gets when none is given. |
Changing a numbering format does not renumber existing documents, and does not reset the counter. Changing the reset policy takes effect at the next boundary.
A document dated where no fiscal period exists is refused once your company has set up any fiscal year; before that it is allowed, with a warning. There is no setting for this.
Rules
The example module evaluates one rule set:
| Rule set | Decides | Typical condition |
|---|---|---|
example_document_approval | Whether a document needs approval beyond the threshold | {"field": "customer_tier", "op": "eq", "value": "new"} |
A rule is data. Adding one does not need a release.
Permissions
| Permission | Default roles |
|---|---|
example_document:read | Manager, Accounting, Sales, Warehouse, ReadOnly |
example_document:create | Manager, Accounting, Sales |
example_document:update | Manager, Accounting, Sales |
example_document:approve | Manager, Accounting |
Roles are per entity. Somebody who is a Manager in one entity and ReadOnly in another gets exactly that.
Trading terms
The module reads three pieces of reference data and stores only the code for each. Nothing about what they mean is copied onto a document, so correcting a payment term or a country name fixes every document that names it.
| Field | Comes from | Notes |
|---|---|---|
| Payment terms | The payment_terms table for this entity | Only terms that are still active can be chosen. Retiring a term leaves existing documents readable and stops it appearing on new ones. |
| Incoterm | The Incoterms 2020 registry | Always requires a named place. DAT is not accepted: it was replaced by DPU in the 2020 edition. |
| Delivery country | The ISO 3166-1 registry | Two-letter code. |
The due date is not stored. It is computed from the term and the document date whenever anybody asks, which is what stops a document's due date and its terms disagreeing.
How it interacts with the rest
- Fiscal calendar. Every document date is checked against it. Closing a period stops documents being dated into it, including by import.
- Numbering. Numbers are allocated gap-free, under a lock. Two people saving at the same moment get consecutive numbers, not the same one.
- Workflow. Approval is a state machine; the transitions are declared, and the audit log records who moved a document and why.
- Events. Approval publishes
example.document_approvedthrough the outbox. Anything that needs to react to it subscribes rather than being called directly. - Custom fields. Fields you define appear on the form, in exports, and as filters on saved views. They are validated by the same code the form uses.
- Payment terms. Maintained under
/payment-terms; the ones you offer are what a document may be put on. - Addresses. A document's ship-to hangs off the record, so it is governed by the same permissions as the document itself and is formatted for its own country when printed.
- Knowledge base. Your own articles can be attached to a document the same way — an SOP for a particular customer's deliveries, say.
Recommended starting point
Threshold at whatever amount your finance lead would want to see; self-approval off; numbering left alone until you have a reason; and the current and next fiscal year set up during onboarding.