Finance policies and budgets
Spending rules checked when a document is submitted, each warning or blocking, versioned, for the organisation or one entity; budgets per entity, dimension value, account or category and month, with what is committed, spent and still available; CSV import and the tools.
A spending policy is a list of rules that a document (an expense report, a bill) is checked against when it is submitted. A budget is an amount an entity may spend on an account or a category in a month. Both are part of the Finance core: the modules that submit documents (Expenses, Payables) use them, and each module decides what a warning or a block means for its own documents.
Policies
Open Finance > Settings > Policies (/finance/settings/policies). Pick Organisation or one entity at the top. Each rule shows as one sentence,
with its severity:
- Warn: the document goes on, with the result kept beside it.
- Block: the document does not go on until it is fixed.
The rules:
| Rule | What it checks |
|---|---|
| Category limit | Each line in the categories is at most an amount. It can apply only to some grades, entities or countries. |
| Receipt required | A line above an amount (strictly above) has a receipt. It can apply to some categories only. |
| Per diem | The lines in the categories, added up per calendar day, are at most an amount. |
| Meal cap | Each line in the categories (the meals) is at most an amount. |
| Per-head cap | Each line in the categories is at most an amount per attendee. The attendees must be named. |
| Mileage rate | A line in the categories claims at most the distance times the rate. The distance must be given. |
| Allowed merchants | A line is at one of the merchants (in some categories only, if you say so). |
| Allowed categories | Every line's category is one of the list. |
| Purchase order required | A document whose total is above an amount (strictly above) has a purchase order. |
| Budget check | The document stays within the budgets it touches (see Budgets). |
Amounts are in the rule's currency. A line in another currency is converted at the exchange rate on or before its date
(exchange rates); when there is no rate, the result says so and the rule counts as failed: a rate
is never guessed. Categories are compared in lower case with spaces as _ (Air travel is air_travel), merchants in
lower case.
Grade. Finance has no grades of its own yet. A document may carry the requester's grade as plain text (Expenses will supply it); a category limit with grades applies only to those grades.
Mileage. The distance is in kilometres or miles with up to three decimal places, and the rate is in the currency's major units per kilometre or mile, with up to 8 decimal places. A distance in the other unit is converted at exactly 1 mile = 1.609344 km. The allowance is distance times rate in minor units, rounded half to even (12.5 cents rounds to 12, 13.5 cents to 14). The maths uses whole numbers only.
Which policy applies. An entity's own active policy replaces the organisation-wide one: its rules are not mixed with the organisation's, so an entity that wants an organisation rule too lists it again. An entity without a policy, or whose policy is not active, uses the organisation-wide one. With no active policy, nothing is checked.
Versions. Saving never changes a stored version: it writes the next one, and the list of versions below the editor opens any older one read only. Each time a module checks a document, it stores the result with the policy version that was in force, so you can always see which rules a document was checked against.
Test a sample document. Below the rules, fill in a few lines (category, amount, date, merchant, attendees, distance, receipt) and press Test. It checks the rules as they are in the editor, saved or not, and the budgets, and lists what would warn or block. Nothing is stored.
Changing policies needs the controller role on the entity (on every entity for the organisation-wide policy). An agent can never change a policy, whatever roles it holds.
Budgets
Open Finance > Settings > Budgets (/finance/settings/budgets). A budget is one amount for an entity, an optional dimension value (a cost centre,
a project), an account or a category, and a month. It is in the entity's functional currency.
Three kinds of movement change what is left:
- Committed: an approved request or a purchase order reserves an amount.
- Released: a reservation is let go, in part or in full.
- Actual: a bill or an expense is spent.
Available = budget − committed + released − actual. When a bill arrives for a purchase order, the module releases the order's reservation by the bill's amount and books the bill as actual, in one step, so the amount counts once. A release never lets go more than its reservation has left. Movements are never changed or deleted; a mistake is corrected with a release. A module that books the same movement twice (a retry) gets the first one back, so nothing counts twice.
The page shows one entity's year, month by month: the budget, what is still committed, the actual and what is available (in red when below zero). Pick a dimension value to see its budgets only.
A document touches every budget of its entity and month on its account or category whose dimension value is none or the
document line's. What an item leaves in each of those budgets shows on the approval request, for the approver, when
the document's module reports it (Finance approvals). Over budget raises nothing by itself: the budget
check in the policy says warn or block, and the module may raise an over_budget exception on the
exceptions queue.
Import from CSV
The file has these columns:
| Column | What |
|---|---|
entity |
The entity's name or id |
dimension, value |
The dimension's key and the value's code, or both empty |
account |
The account's code (in the entity's chart or the shared one), or empty |
category |
The category, or empty (exactly one of account and category) |
period |
The month, 2026-12 |
amount |
The amount in major units, 12500.00 |
currency |
The entity's functional currency |
Press Check first: every row is checked, and every problem is listed with its line. Nothing is saved unless every row is good. A budget already there (same entity, dimension value, account or category and month) gets the new amount.
Setting budgets needs the controller role on each entity, like the rest of the reference data.
For agents
| Tool | Scope | What it does |
|---|---|---|
finance_policy_get |
finance:read |
A policy (entity_id, or none for the organisation) with its rules in words, its versions and the policy in force; with sample, what a document would pass, warn or block (rules tests a draft) |
finance_policy_update |
finance:admin |
Save the next version: entity_id, name, rules, active. Never an agent |
finance_budget_list |
finance:read |
Budgets with committed, released, actual and available; filters entity_id, dimension_value_id (none for none), account_id, category, from, to; with document, what it would leave and the budget check |
finance_budget_set |
finance:admin |
Set one or many budgets (rows) or a CSV file's (csv); dry_run checks only |
The REST twins are GET and PUT /api/v1/finance/policies, POST /api/v1/finance/policies/test, GET and
PUT /api/v1/finance/budgets and POST /api/v1/finance/budgets/check. Every change, every budget movement and every
stored check is on the Finance event chain.
For module authors
evaluateAndRecord(client, writer, {doc_kind, doc_id}, document)inlib/finance/core/policies.tschecks a document under the version in force, inside your transaction, and stores the result with its event.commit,actual,releaseandconvertinlib/finance/core/budget.tsbook movements inside your transaction, once per budget, kind and source ({kind, id}, such as{kind: "bill", id}). They lock the budget first, so concurrent calls stay consistent.impactandchecksay what a document would leave and whether the budget rule warns or blocks;raiseOverBudgetraises oneover_budgetexception per document, however often it is called.- A document type registered with the approvals engine can add
budgetImpactso approvers see what it leaves.