Skip to main content

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​

KeyEffect when off
exampleThe 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​

KeyTypeDefaultWhat it does
approval.order_total_thresholdmoney1000.00At 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_approvalbooleanfalseWhether 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.formattextEX-{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.resetchoicefiscal_yearWhen the counter goes back to one: never, fiscal_year, calendar_year or month.
locale.currencytextUSDThe 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 setDecidesTypical condition
example_document_approvalWhether 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​

PermissionDefault roles
example_document:readManager, Accounting, Sales, Warehouse, ReadOnly
example_document:createManager, Accounting, Sales
example_document:updateManager, Accounting, Sales
example_document:approveManager, 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.

FieldComes fromNotes
Payment termsThe payment_terms table for this entityOnly terms that are still active can be chosen. Retiring a term leaves existing documents readable and stops it appearing on new ones.
IncotermThe Incoterms 2020 registryAlways requires a named place. DAT is not accepted: it was replaced by DPU in the 2020 edition.
Delivery countryThe ISO 3166-1 registryTwo-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_approved through 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.

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.