Modules / Invoicing
Invoicing
Send invoices for what you sold (from an order, a repeating schedule, delivered work, or by hand), correct them with credit notes, and keep the books in step, without re-typing anything the sales side already captured.
People ask for it as: “send invoices”, “invoice the customer”, “monthly invoices that raise themselves”, “stop re-typing orders into the accounts”, “credit note”, “50% up front”, “pro forma”, “early payment discount”, “late payment interest”, “intercompany recharge”, “e-invoicing”, “Peppol”, “bad debt provision”, “deferred revenue”
Who uses it
| Role | Does | Sees |
|---|---|---|
| Whoever sends the invoices (office, bookkeeper) | reviews drafts, issues, sends, raises credit notes, exports to the accountant | every invoice |
| Whoever chases money and records it | chases overdue invoices by hand, records what was received (in payments) | every open invoice and its history |
| Owner / finance manager | approves credit notes, voids and write-offs, sets terms, customers' billing profiles, the account map and the document layout | everything |
| The owner (or whoever the owner names) | holds the controls on the people who invoice and approve (time zone, numbering, ledger mode, auto-issue, void policy, write-off threshold, second approver) and signs the migration reconciliation | everything |
| Sales (read-only) | checks whether a customer is overdue before quoting them again | invoice status and balance for a customer; never lines or margin |
| The customer | receives the invoice and pays it | their own invoices, by email or the portal |
| The system | raises drafts from schedules and sources, checks a draft before issue, posts to the ledger, plans, stops and finishes schedules, numbers issued documents, derives what is due, loads and reconciles a migration | everything, through its own service account |
What it has to do
Reference user stories. Each has a test written into it — the given / when / then — which becomes an automated check once it is built. Expect to keep some, change some and drop some.
Things people do
AR-01As the person who invoices, I want an invoice drafted from what was sold (an order, an accepted item, a schedule) in one step, so that nothing is re-typed and the customer is billed what they agreed.
Given a confirmed sales order with invoiceable lines · when the order asks for its invoice (SO-21) · then a draft exists with those lines, keyed invoice_id = "so:<sales_order_id>:<request_no>", each line carrying the order line it bills (sales_order_id, so_line_no -> so_line) and that line's unit_code; tax computed by the tax module at this invoice's tax point; asking again returns the same invoice
Whoever sends the invoices (office, bookkeeper) · screen: Invoice · reference: partial: ar-core raises from an accepted quote (keyed quote:<quote_id>); the generic source is not built
AR-02As the biller, I want to raise an invoice by hand for something with no order, so that ad-hoc work can still be billed.
Given a customer, and a line with a description, quantity, price and tax category · when I save it · then line totals, the per-rate tax summary and the total are computed by the system, never typed, and the invoice is a draft
Whoever sends the invoices (office, bookkeeper) · screen: Invoice · reference: implemented (ar-core)
AR-03As the biller, I want issuing an invoice to fix its number, its dates and its contents, so that what the customer received cannot silently change.
Given a draft with at least one line, usage filled in, and a customer with a bill-to address and terms · when I issue it · then stamped with the next number from the series, an issue date of today (business_timezone, never typed), a tax point (the supply date its source records, else the issue date) and a due date from the terms; the tax is frozen (tax TAX-11); the bill-to details in force today are copied onto it; every later edit is refused with "credit it instead"; when a gate fails, issue is refused and the screen shows each gate as {gate, met, reason, fix} (the tax content check TAX-12 among them)
Whoever sends the invoices (office, bookkeeper) · screen: Invoice · reference: implemented (ar-core), without the content check or the readiness answer
Usually different per customer: the number format, whether it restarts each year
AR-04As the biller, I want to correct an issued invoice with a credit note rather than an edit, so that the audit trail and the tax records survive.
Given an issued invoice, whether paid or not · when I credit it in full or in part and the approver approves · then the credit note has its own number, a credit date of today, lines and per-rate tax (from the tax module, at the original invoice's rates for a correction), is allocated against the invoice through payments, reduces its balance, and the original stays readable and unchanged
Whoever sends the invoices (office, bookkeeper) · screen: Credit note · reference: implemented (ar-core)
AR-09As the owner, I want to write off a remainder that will never be paid, so that it stops appearing on the chase list and the books show the loss.
Given an invoice with 12.40 outstanding, below the write-off threshold of 25.00 · when a write-off is proposed with a reason and I approve it · then the write-off is allocated against the invoice through payments like a receipt, the balance clears, and the loss posts as bad debt where the ledger is installed
Owner / finance manager · screen: Invoice · reference: implemented (ar-core)
AR-12As a sales rep, I want to see whether a customer is overdue before I quote them again, so that I am not discounting for someone who has not paid.
Given a customer with an invoice 40 days past due · when I open them in the sales system · then I see the overdue amount, the oldest age, and whether they are on credit hold, read-only, through invoicing's narrow status route, never lines
Sales (read-only) · screen: Customer billing · reference: implemented (ar-core)
AR-13As the biller, I want to send the invoice and know it went, so that "did you get it?" has an answer.
Given an issued invoice · when I press Send · then the document is produced from the frozen invoice and handed to the mail capability; the send is recorded with the date and address; re-sending records a second send, never a second invoice
Whoever sends the invoices (office, bookkeeper) · screen: Invoice · reference: implemented (ar-core)
Usually different per customer: the delivery route (an email attachment, a portal, Peppol later) and the document layout
AR-14As the biller, I want to cancel a draft that should never have existed, and void an issued invoice only where it is allowed, so that the numbering stays explainable.
Given a draft, and an issued invoice with no allocations · when I cancel the draft, and the approver voids the issued one with a reason · then the draft leaves no number behind; the void keeps its number, reverses its posting on today's date and drops out of every balance; void is allowed only as the owner's void_policy says (default never_sent: never sent, no allocations, tax point not in a filed VAT return, answered by tax's GET /vat-returns/tax-point-status, v4); otherwise a full credit note is the only path and the readiness answer says so
Whoever sends the invoices (office, bookkeeper) · screen: Invoice · reference: implemented (ar-core), without the reversing journal
AR-15As the biller, I want a deposit invoiced before the work and deducted from the final invoice, so that "50% up front" is a real invoice.
Given an order asking for a 50% deposit of 5,000.00 net (SO-09) · when the deposit is issued and later the final invoice raised · then the deposit is a normal invoice with its own tax; the final invoice shows the deposit deducted, so only the balance is due. v6: a part invoice may deduct too, not only the final one. v4 (one rule with sales-order, L2C leftover): a deduction may be the whole deposit or a PART of it (sales-order names the amount per deposit); what remains of each deposit = its net less the deductions on issued invoices and less credits against it, re-derived, never stored; a deduction above what remains is refused (gate deposit_remaining); each deduction line is pinned to the deposit's frozen tax code and rate (tax TAX-47), so it carries the deposit's category and tax accepts it; two finals issued at once cannot both take the same remainder (a claim row per deduction, keyed [deposit_invoice_id, final invoice_id])
Whoever sends the invoices (office, bookkeeper) · screen: Invoice · reference: not built
AR-17As the biller, I want the list of invoices with their state and what is outstanding, so that I can find one without searching for it.
Given invoices in every state · when I open the list · then I can filter by state, customer, currency, source and date, page through it, and each row shows the number, the customer, the total and the outstanding (from payments)
Whoever sends the invoices (office, bookkeeper) · screen: Invoices · reference: partial: ar-core's list has no pagination or source filter (known_gaps)
AR-19As the biller, I want a usage-billed period to arrive as a draft with the usage line left for me, so that metered billing is never estimated.
Given a metered schedule and its period due · when the draft is raised · then it has the usage line with quantity empty; issue is refused until it is filled; a zero month may be cancelled and leaves no number
Whoever sends the invoices (office, bookkeeper) · screen: Invoice · reference: not built
AR-23As the biller, I want drafts raised by the system to wait for my review, so that nothing reaches a customer unchecked.
Given drafts raised from schedules and orders overnight · when I open the drafts · then each shows its source and the AI pre-issue check (when on); none is issued automatically unless the setting says so for that source
Whoever sends the invoices (office, bookkeeper) · screen: Invoices · reference: not built
AR-24As the biller, I want issued invoices exported for our accountant each month, so that the books stay where they are until we move them.
Given the ledger mode export, and 40 invoices and 2 credit notes issued in October · when I run the October export · then one file (CSV, and the accountant's import format where configured) with every document once, a batch record, and each document marked with the batch; running October again exports nothing new
Whoever sends the invoices (office, bookkeeper) · screen: Invoices · reference: not built
AR-25As the finance manager, I want each customer's bill-to details and terms kept with invoicing, so that the party master holds identity and invoicing holds how to bill.
Given a customer whose party has no address or invoice email · when I set their bill-to name, address, invoice email, terms and currency, from tomorrow · then a new dated profile row (valid_from after today; a first profile may start today); drafts issued on or after valid_from use it; at issue it is copied onto the invoice, so a later change never alters an issued invoice; a valid_from of today (for a customer who already has one) or earlier is refused
Owner / finance manager · screen: Customer billing · reference: not built
AR-31As the owner, I want the controls on how my people invoice kept to me and dated, so that nobody loosens a rule for themselves and no change rewrites yesterday.
Given auto_issue_sources empty and void_policy never_sent · when I set auto_issue_sources to schedule from tomorrow, and the approver tries to change void_policy · then a new dated control row, valid_from tomorrow; drafts raised today still wait; the approver's change is refused (ar:settings:controls); a control dated today or earlier is refused
The owner (or whoever the owner names) · screen: Settings · reference: not built
AR-32As the biller, I want to accept or dismiss each AI finding on a draft, so that the check helps me and never decides for me.
Given a draft with the AI pre-issue check on, and a finding "total 2.1x the last 6 months median" · when I dismiss it with a reason, or accept it and edit the line · then the finding is recorded (ar_ai_finding: step, model, the evidence, decided_by, decided_at, decision, reason); nothing in the draft changed without my action; issue never waits on a finding
Whoever sends the invoices (office, bookkeeper) · screen: Invoice · reference: not built
AR-33As the owner moving off Odoo, I want a reconciliation of every count, total and open balance against Odoo that I sign, so that I know nothing was lost before I switch.
Given a migration run loaded from Odoo and reconciled · when I open it, read the differences and their explanations, and sign · then every check is equal or explained; sign is refused while any check is neither (readiness {gate, met, reason, fix}); the signature records who, when and the run's checksums; a later re-run needs a new signature
The owner (or whoever the owner names) · screen: Migration · reference: not built
AR-35As the biller, I want to ask a customer for a down payment (or send a pro forma) without issuing a VAT invoice, so that VAT falls due only when they pay.
Given deposit_mode request; a confirmed order of 10,000.00 net asking for 50% (SO-09), customer bp_id 7311 · when sales-order raises the deposit, or I raise a pro forma for an order or a quote by hand, and issue it · then a payment request keyed "dpr:<sales_order_id>:<request_no>" (or a uuid by hand) with its own number from the DPR- series, the amount 6,000.00 (5,000.00 net and the VAT it will carry, computed by tax for display), titled "Payment request - this is not a VAT invoice" (a pro forma is the same document, titled "Pro forma invoice - this is not a VAT invoice"); it posts nothing to the ledger, is not in the receivable and not in any VAT return; it shows on the customer's open items as requested, never as owed; cancelling it is allowed while nothing is received
Whoever sends the invoices (office, bookkeeper) · screen: Invoice · reference: not built
AR-37As the finance manager, I want payment terms with an early-settlement discount printed on the invoice the way HMRC requires, so that a customer paying early pays less and the VAT is right.
Given terms "2/10 net 30": 2% if paid within 10 days, else net 30 days · when an invoice of 1,000.00 net plus 200.00 VAT (1,200.00) is issued on 2026-11-02 under those terms · then the invoice shows the discount rate (VAT Notice 700 para 16.3.1 lists it), the date it ends (2026-11-12) and the discounted amount 1,176.00; with settlement_discount_vat invoice_wording it also prints HMRC's statement that no credit note will be issued and the customer may only recover the VAT actually paid; the terms row is frozen once an issued invoice used it
Owner / finance manager · screen: Settings · reference: not built
AR-39As the biller, I want the statutory interest and compensation on a business customer's late payment worked out, so that we can claim what the law gives us when we decide to.
Given late_interest_mode suggest; a business customer's invoice of 12,000.00 due 2026-06-30 and paid 2026-09-28 (90 days late); the reference rate on 2026-06-30 was the base rate 4.25%, so the statutory rate for July-December is 12.25% · when I open the customer and accept the suggested interest note · then interest = 12,000.00 x 12.25% x 90 / 365 = 362.47 (simple interest, daily, from the day after the due date to the receipt date read from payments), plus fixed compensation 100.00 (a debt of 10,000.00 or more; 40.00 under 1,000.00, 70.00 from 1,000.00), raised as a draft invoice kind interest with tax code OS (statutory interest is outside the scope of VAT), naming the invoice and the days; the reference rates are dated rows (ar_interest_rate, from 30 June and 31 December); consumers are never charged (the treatment from tax says business or consumer); with mode off nothing is suggested; the draft is reviewed and issued like any other
Whoever sends the invoices (office, bookkeeper) · screen: Invoice · reference: not built
AR-40As the biller of one company in a group, I want to invoice another company of the group, so that intercompany recharges are real invoices both sides can reconcile.
Given company UK01 and company UK02 in one installation; UK02 is a business partner flagged as intercompany partner of company code UK02; a management recharge of 8,000.00 net · when I raise and issue the invoice from UK01 to UK02 · then the invoice carries company_code UK01 and trading_partner UK02, numbered from UK01's own series; it posts to the intercompany receivable and revenue purposes (ic_receivable, ic_revenue) with trading_partner on every line, so the ledger's intercompany reconciliation matches it to UK02's payable; VAT follows tax (one VAT group computes none: the treatment vat_group); on issue it is handed to the partner company's purchasing as a bill (AR-41)
Whoever sends the invoices (office, bookkeeper) · screen: Invoice · reference: not built
AR-42As the biller, I want to set up a recurring invoice by hand for something with no order (rent, a retainer), so that it raises itself like an order's repeating line.
Given a customer renting a desk at 450.00 a month from 2026-12-01 for 12 months, no order · when I create a recurring invoice with the line, the start and the number of periods · then a schedule keyed "man:<uuid>|1" with source_kind manual on the same engine as AR-18 (raised each period as a draft, reviewed unless the owner's auto_issue_sources names manual, finished after period 12, stopped with a reason dated today); starts_on is today or later (a manual schedule has no source document to date it earlier); editing the price is a new schedule from a later period, never an edit of issued invoices
Whoever sends the invoices (office, bookkeeper) · screen: Billing · reference: not built
AR-43As the biller, I want to send an invoice as a Peppol e-invoice to a customer who receives them, so that it lands in their accounts system without retyping and we are ready for the UK mandate.
Given customer 7311 with einvoice channel peppol and participant id 0088:5060012349998 (GLN) on their billing profile; an access-point provider capability composed · when I send an issued invoice · then the invoice is rendered as UBL 2.1 to Peppol BIS Billing 3.0 (CustomizationID urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0) from the frozen invoice (lines, unit_code UN/ECE Rec 20, VAT category per tax code, the totals) and validated against the EN 16931 and Peppol BIS 3 rules before it leaves; a failed rule refuses the send with {gate: einvoice_valid, met: false, reason: the rule id and text, fix: the field}; a valid one goes to the access point and the send is recorded with the message id; the PDF is still produced for our records; a credit note is a UBL CreditNote the same way
Whoever sends the invoices (office, bookkeeper) · screen: Invoice · reference: not built
AR-45As the finance manager, I want a provision for doubtful debts proposed at each month end from the aging and the disputes, so that the books show what we really expect to collect.
Given provision rates by aging bucket (0-30: 0%, 31-60: 2%, 61-90: 10%, 90+: 50%) and a specific 100% on invoices in dispute; payments' aging at 2026-11-30 · when the biller proposes the November provision and I approve it · then a provision run keyed "prov:<company_code>:2026-11" lists each bucket and each specific invoice with the rate, the outstanding EXCLUDING VAT (VAT is recovered by bad debt relief, not provided), and the provision; approval posts the movement since last month (debit bad-debt expense, credit the allowance for doubtful debts) dated the period end, journal id derived from the run; the proposer may not approve it when second_approver is on; rates are dated rows; a written-off invoice leaves the provision and its loss is the write-off's
Owner / finance manager · screen: Provisions · reference: not built
Things that happen on their own
AR-10on read (derived)The invoice shows what is still outstanding and how old it is whenever anyone looks, from payments' settlement, so that "overdue" is never stale.
Given an invoice of 1,000.00 with a 400.00 receipt and a 100.00 credit note allocated · when anyone opens it · then 500.00 outstanding, part paid, its age; computed by payments (PAY-30); invoicing stores no paid flag
· reference: implemented (ar-core, in-module); moves to payments
AR-18on the billing day of each schedule periodThe system raises the invoice for each schedule period that falls due, so that nobody bills monthly lines by hand.
Given a schedule of 12 monthly periods from 2026-10-01, in advance · when the daily pass runs on 2026-11-01, twice · then one draft for period 2, keyed invoice_id = "rec:<schedule_id>:2"; the second pass creates nothing (a plain-INSERT claim; the loser gets 23505 and moves on); which period is due, how many are billed and what remains are derived, never counted
· reference: not built
Usually different per customer: billing day (start anniversary or calendar month), in advance or in arrears, proration
AR-26when the last period of a schedule is raisedThe system finishes a schedule once every period is billed.
Given a schedule of 12 periods with 12 raised · when the pass runs · then the schedule is finished; nothing more is raised
· reference: not built
AR-34when a migration run is loaded (migration.odoo below)The system carries Odoo's customer invoices and credit notes over as history, read-only, so that statements, VAT records and open balances continue without re-keying.
Given an Odoo database with 1,200 posted out_invoice and 40 out_refund moves, mapped partners and tax codes · when the load runs twice · then one invoice per move keyed invoice_id = "odoo:<db>:<move id>", issued with Odoo's number, dates, lines, tax and totals exactly as Odoo stored them (never recomputed, never re-posted to the ledger, never re-sent, never raised again by a schedule); credit notes keyed the same way and linked to the invoice they reverse; the second run changes nothing
· reference: not built
AR-44when the access point reports delivery or the buyer's responseThe system records what happened to an e-invoice, so that "did they get it?" is answered by the network, not by email.
Given the e-invoice sent above · when the access point reports delivered, then a Peppol Invoice Response with status RE (rejected) and reason "PO number missing" · then the send row records each status with its time (delivered; AB acknowledged, IP in process, UQ under query, CA conditionally accepted, RE rejected, AP accepted, PD paid); a rejection shows on the invoice for the biller with the reason (the invoice is not changed: a correction is a credit note and a new invoice); a duplicate notification adds nothing
· reference: not built
AR-46monthly, when the ledger period closes (or by the composition's clock at month end)The system releases revenue invoiced in advance over the service period, so that an annual subscription is 1/12 revenue each month.
Given an invoice issued 2026-10-01 for an annual service 2026-10-01 to 2027-09-30 at 12,000.00 net, posted to deferred revenue (the line carries service_from / service_to) · when the release runs for October, twice · then 12,000.00 x 31/365 = 1,019.18 moves from deferred_revenue to revenue for October (days in the period over days in the service), keyed [invoice_id, line_no, period_id] so the second run adds nothing; the last period takes the remainder so the line releases exactly 12,000.00; a credit note against the line reverses what is not yet released first; lines without a service period post straight to revenue as before
· reference: not built
Things that cross into other modules
AR-20when a source asks for an invoice (a sales order SO-21, a deposit SO-09, an adapter)Sources ask invoicing for a draft through one use case, raise_draft(source_kind, source_id, bp_id, currency, lines), so that every way of selling bills the same way.
Given a sales order's request · when it calls raise_draft · then one draft keyed on (source_kind, source_id); a second call returns it; lines keep their source keys so "billed vs sold" per source line is one GROUP BY (billed_per_source)
· owned by ar · reference: partial: ar-core has the quote path only
AR-21when an invoice is issued or voided, or a credit note or write-off approved, and the ledger mode is postInvoicing posts the accounting entries to the ledger, so that the books agree with the invoices without re-keying.
Given an issued invoice of 1,000.00 plus 200.00 VAT, with the account map configured · when it posts · then a balanced journal (receivable 1,200.00 / revenue 1,000.00 / VAT by code 200.00) through the ledger's route, journal_id derived from the invoice id so re-posting changes nothing; a closed period is refused and named
· owned by gl · reference: implemented (ar-core), except the void's reversing journal
AR-22when a customer is invoiced for the first timeThe customer comes from the shared record rather than being typed again.
Given business-partner is installed · when an invoice is raised for a company that already exists in sales · then it uses the same bp_id (derived from the bp_key, business-partner v0.3.1), and no second customer row is created
· owned by business-partner · reference: implemented (ar-core), with the bp_key/bp_id column fault in known_gaps
AR-27when a source confirms a line that repeats (a recurring or metered order line SO-20, a contract line through an adapter)A repeating line becomes one billing schedule, so that each line can end on its own date.
Given plan_billing(source_kind, schedule_id = "<source_id>|<line_id>", bp_id, starts_on, periods, unit_price, discount_pct, currency, billing_kind, billing_plan) · when it is called twice · then one schedule per line, active, starts_on as the source line records it (an accounting fact of the order); a period whose billing day is already past is raised in the next daily pass, issued today, covering its own period; the second call changes nothing
· owned by ar · reference: not built
AR-28when the source of a schedule ends early (an order cancelled, a contract terminated or superseded)Billing stops after the period in progress; issued invoices are untouched.
Given an active schedule with 5 of 12 periods raised · when stop_billing(source_id, reason) is called · then the schedule is stopped with the reason, dated today; period 6 is never raised; the 5 issued invoices are unchanged (an earlier end the customer is owed is a credit note against them, never a back-dated stop)
· owned by ar · reference: not built
AR-29when a delivery item is accepted (a projects brick, a delivery adapter)An accepted one-off item is billed on acceptance.
Given an accepted item worth 35,000.00 · when raise_for_acceptance(item) is called · then one draft keyed "acc:<item_id>"; a second call returns it
· owned by ar · reference: not built
AR-30when a credit note is approved or a write-off approvedCredit notes and write-offs reduce a balance through payments' allocation, so that there is one mechanism behind every balance.
Given an approved credit note of 100.00 against an invoice · when it is allocated · then payments records an allocation (source_kind credit_note) and the invoice's outstanding falls by 100.00; invoicing never writes pay_ tables
· owned by payments · reference: implemented in ar-core as its own ar_allocations; moves to payments
AR-36when payments allocates a receipt to a payment request (PAY-03 names the request)A paid payment request becomes the deposit invoice dated by the money, so that the VAT tax point is the day the payment was received.
Given request DPR-2026-0004 for 6,000.00; a receipt of 6,000.00 received 2026-11-20 naming it; today 2026-11-21 · when payments calls POST /payment-requests/{request_id}/settle with {payment_id, received_on, amount} · then a deposit invoice keyed "dep:<request_id>:<n>" for the amount received (net and VAT split at the request's rates, tax point 2026-11-20 - a document-dated fact - issue date today), issued and numbered from the INV series, frozen by tax, posted in post mode; payments then allocates the receipt to that invoice, so it is paid; a part payment issues a deposit invoice for the part and the request stays open for the rest; the same payment settles once (keyed on payment_id)
· owned by ar · reference: not built
AR-38when payments allocates a receipt within the discount window that is short by the discount (PAY-16)Invoicing raises the settlement-discount credit note at the invoice's own rates, so that the VAT corrected is exactly the VAT on the discount.
Given the invoice above; a receipt of 1,176.00 received 2026-11-10 · when payments calls POST /invoices/{invoice_id}/settlement-discount with {payment_id, received_on, discount_amount 24.00} · then a credit note kind settlement_discount for 24.00 gross (20.00 net, 4.00 VAT, the lines pinned to the invoice's frozen codes pro rata per code: tax TAX-47), approved by the rule (the terms set the amount; no person is needed, its approved_by is "terms"), numbered CN-, credit date today, posted, and allocated by payments, so the invoice is paid; refused (gate within_discount_window) when received_on is after 2026-11-12, and (gate discount_matches_terms) when the amount is not the terms' percentage of the gross outstanding at the receipt, both exact; a second call for the same payment returns the same credit note; under invoice_wording no credit note is raised: payments records the discount as an allocation (source_kind settlement_discount) and tax reads it for the return
· owned by ar · reference: not built
AR-41when an intercompany invoice issues and the partner company is in this installationAn issued intercompany invoice arrives as a bill in the partner company, so that the two sides never differ by typing.
Given the issued invoice from UK01 to UK02 · when invoicing calls purchasing's POST /bills/intercompany for company UK02 · then one supplier bill keyed "ic:<invoice_id>" with the same lines, amounts and tax, in UK02; calling twice adds nothing; a credit note against the invoice is handed over the same way; where the partner company is elsewhere, the invoice is sent like any other (AR-13 or AR-43)
· owned by ar · reference: not built
AR-47when an invoice or credit note posts and the ledger splits documents by cost centreEach invoice line carries the cost centre it belongs to, so that the ledger can split the receivable and VAT lines and balance each segment.
Given an invoice with a consulting line of 6,000.00 (cost centre CC-CONS) and a training line of 4,000.00 (CC-TRAIN), VAT 2,000.00 · when it posts · then the revenue lines carry their cost_centre; the receivable and VAT lines are sent unsplit with the document's split basis (the revenue lines), and gl splits them 60/40 (receivable 7,200.00 / 4,800.00, VAT 1,200.00 / 800.00) when its document splitting is on; invoicing never decides a segment and never splits itself; a line with no cost centre takes the customer's billing profile default, else the gate cost_centre on issue where gl requires one
· owned by gl · reference: not built
How things move
schedule
active → finished → stopped
- none → active by system · when a source confirmed a recurring, instalment or usage line · one schedule per line, keyed <source_id>|<line_id>
- none → active by biller · when a customer with a billing profile; starts_on today or later · a schedule keyed man:<uuid>|1, source_kind manual, on the same engine (AR-42)
- active → finished by system · when every period raised
- active → stopped by system · when the source ended early (AR-28); the stop is dated today, never earlier · issued invoices are untouched; money owed back is a credit note
invoice
draft → issued → void → cancelled
- none → draft by system · when a schedule period is due · keyed rec:schedule:period, so a second run makes nothing
- none → draft by system · when a source called raise_draft (an order, a deposit, an adapter) · keyed on the source; lines keep their source keys
- none → draft by system · when an item was accepted (AR-29) · keyed acc:item
- none → draft by biller · when work with no order (AR-02) · totals and tax computed, never typed
- none → draft by biller · when late_interest_mode is not off; the customer is a business; an invoice paid late or still overdue · a draft kind interest at the statutory rate plus fixed compensation, code OS (AR-39)
- none → draft by system · when payments settled a payment request (AR-36) · keyed dep:<request_id>:<n>, tax point = received_on; issued at once (it is the money already received)
- draft → draft by system · when the pre-issue check is on · unusual amounts, a missing PO, an odd tax code or a duplicate of last month listed for the biller
- draft → draft by biller · drafts are not issued automatically unless the setting says so for the source
- draft → draft by biller · when the draft has a usage line
- draft → draft by biller · when the draft has findings (AR-32) · each decision recorded in ar_ai_finding; nothing changes without the biller
- draft → cancelled by biller · no number used; a zero-usage period ends here
- draft → issued by biller · when at least one line; usage filled in; the customer has a billing profile in force today; the tax content check passes; the tax point is not in a locked or filed VAT return (tax GET /vat-returns/tax-point-status) or a closed period; v4: each deposit deduction within what remains of its deposit; a cost centre on every revenue line where the ledger requires one · numbered from the company's series; issue date today; due date from the terms; tax and bill-to frozen; revenue for a service period to deferred revenue (AR-46)
- issued → issued by system · when the ledger mode is post · a balanced journal keyed on the invoice
- issued → issued by biller · the send recorded; delivery tracked by the mail capability, or by the e-invoice access point (v4)
- issued → issued by system · when the customer's channel is peppol with a participant id; the UBL passes EN 16931 and Peppol BIS 3 validation · UBL 2.1 to the access point, the message id on the send (AR-43)
- issued → issued by system · each status with its time on the send row (AR-44)
- issued → issued by system · when trading_partner names a company in this installation · a bill keyed ic:<invoice_id> in that company's purchasing (AR-41)
- issued → issued by system · when a line with a service period not fully released · deferred to revenue for the days in the period, keyed [invoice_id, line_no, period_id] (AR-46)
- issued → issued by customer
- issued → issued by collector · when overdue and outstanding above zero, and reminders are by hand
- issued → issued by customer
- issued → issued by collector · in payments: the receipt and its allocations; outstanding is derived
- issued → issued by biller · when the ledger mode is export · in one export batch, once
- issued → void by approver · when no allocations, and the owner's void_policy allows it (default never_sent) · needs reason · drops out of every balance; reversing journal dated today in post mode
credit_note
draft → approved → cancelled
- none → draft by biller · when an issued invoice to correct, or a goodwill credit on the customer
- draft → approved by approver · when lines and tax present; it does not exceed what remains creditable on the invoice it names; the approver is not its author where second_approver is on · numbered; credit date today; tax frozen; posted in post mode
- approved → approved by biller · in payments: against one or more invoices, or left on the customer
- draft → cancelled by biller
- none → approved by system · when received within the discount window; the amount is the terms' percentage of the gross outstanding at the receipt; settlement_discount_vat is credit_note · numbered, at the invoice's frozen rates pro rata (tax TAX-47), approved by the terms, posted, allocated by payments (AR-38)
writeoff
proposed → approved → rejected
- none → proposed by biller · needs reason
- proposed → approved by approver · when below the threshold, or the approver accepts it above · allocated in payments; bad debt posted in post mode
- proposed → rejected by approver · needs reason
migration_run
loaded → reconciled → signed → discarded
- none → loaded by system · when the customer's doors are decided (migration.odoo.door); business-partner and tax have mapped every partner and tax the moves use · documents written read-only, keyed odoo:<db>:<move id>; a re-run changes nothing (AR-34)
- loaded → reconciled by system · every migration.odoo.reconcile check computed on both sides, with the difference
- reconciled → reconciled by approver · when a check is not equal and may be explained · needs reason · the explanation recorded beside the check
- loaded / reconciled → loaded by system · when not signed · the same keys; explanations on unchanged checks kept
- reconciled → signed by owner · when every check equal, or explained where explained is allowed · who, when and the run's checksums recorded; invoicing takes writes for these customers from now
- loaded / reconciled → discarded by owner · needs reason · the run's documents are removed; nothing was ever issued from them
payment_request
draft → issued → settled → cancelled
- none → draft by biller · when deposit_mode request, or a pro forma asked; the amount within the order total less deposits already asked (sales-order SO-09) · keyed dpr:<sales_order_id>:<request_no> from an order, a uuid by hand; amounts computed by tax for display only (AR-35)
- draft → issued by biller · when a billing profile in force today · numbered DPR-; titled not a VAT invoice; nothing posted, nothing in a VAT return
- issued → issued / settled by system · when payments names a receipt and its amount, at most what remains of the request · a deposit invoice for the amount received, tax point the received date (AR-36); settled when nothing remains
- draft / issued → cancelled by biller · when nothing received against it · needs reason
provision_run
proposed → approved → rejected
- none → proposed by biller · when the month has ended; payments' aging as at its last day · a run keyed prov:<company_code>:<period_id>: per bucket and per disputed invoice, net of VAT (AR-45)
- proposed → approved by approver · when the approver is not the proposer where second_approver; the ledger period is open · the movement since the last run posted, dated the period end
- proposed → rejected by approver · needs reason
What it keeps
| Thing | Meaning | Identified by | Shared? |
|---|---|---|---|
| invoice | a demand for payment, addressed to a customer | invoice_id: immutable for life, derived from its source ("so:<sales_order_id>:<request_no>", "rec:<schedule_id>:<period>", "acc:<item_id>", "<adapter>:<source>") and a uuid otherwise (shared.yaml keys.invoice_id). The invoice NUMBER is stamped at issue, never the key | module-owned |
| invoice line | one billed item, with where it came from | invoice_idline_no | module-owned |
| invoice tax | the tax summary the document must print, one row per code (frozen copy of tax compute()) | invoice_idtax_code | module-owned |
| credit note | a tax document reducing what a customer owes | credit_id (immutable); credit_no stamped at approval | module-owned |
| writeoff | a balance the business accepts it will not collect | writeoff_id | module-owned |
| schedule | one sold line billed over time | schedule_id = "<source_id>|<line_id>" (an order line, or a contract line through an adapter) | module-owned |
| customer | how a party is billed (bill-to details, terms, currency), as dated rows | bp_idvalid_from | module-owned |
| send | a record that the document went out | invoice_idsent_at | module-owned |
| export batch | one export of issued documents to an outside ledger | batch_id = "<period>:<format>" | module-owned |
| number series | the counter behind invoice and credit-note numbers (STATE, not a setting) | series_id (e.g. "INV-2026", "CN-2026", "DPR-2026"; with more than one company "INV-UK01-2026", v4) | module-owned (state) |
| terms | when payment is due | terms_id | module-owned (configuration) |
| settings | how this business invoices, as dated rows | keyvalid_from | module-owned (configuration) |
| account map | which ledger account each posting hits | purposetax_codevalid_from | module-owned (configuration); the accounts themselves belong to the ledger |
| payment request | a down-payment request or a pro forma: asks for money, is not a VAT invoice (v4) | request_id: "dpr:<sales_order_id>:<request_no>" from an order, else a uuid; request_no stamped at issue from the DPR- series | module-owned |
| deposit claim | one final invoice's deduction from one deposit: the claim that stops two finals taking the same remainder (v4) | deposit_invoice_idfinal_invoice_id | module-owned (state) |
| interest rate | the statutory late-payment reference rate and margin from a date (v4) | valid_from | module-owned (configuration) |
| provision run | one month's doubtful-debt provision and what it posted (v4) | run_id = "prov:<company_code>:<period_id>" | module-owned |
| provision rate | the provision percentage per aging bucket from a date (v4) | bucketvalid_from | module-owned (configuration) |
| revenue release | the revenue released from deferred for one invoice line and period (v4) | invoice_idline_noperiod_id | module-owned |
| ai finding | one AI suggestion on a document and the person's decision on it (consent and audit) | invoice_idsteprun_no | module-owned |
| migration run | one load of another system's invoices, its reconciliation and the customer's signature | run_id = "odoo:<db>:<cutover_date>" | module-owned (state) |
| migration check | one reconciliation check of a run, both sides and the difference | run_idcheck_keyslice | module-owned (state) |
Invoicing is where a duplicated customer list finally costs money: the statement will not match the sales view and nobody can say which is right. Install business-partner first.
What runs on its own
| Story | When | What |
|---|---|---|
| AR-18 | daily | raise due drafts for every active schedule |
| AR-26 | in the same pass as AR-18 | finish schedules whose every period is raised |
| AR-46 | monthly, at the month end (the composition's clock worker) or when gl closes the period | release_deferred_revenue for every line with a service period |
| AR-44 | when the access point calls back | record_einvoice_status |
| AR-10 | on read | settlement, from payments |
Questions that shape your version
Read these out and let the customer correct one — people rarely recall a policy on demand and can always react to one. Standard is a named authority you can look up and hold us to. Commonly seen is exactly that: arrangements we have met, with no survey behind them. A customer doing none of them is not doing it wrong.
- What do you invoice from: an order, a signed contract, delivered work, or by hand?
- What should an invoice number look like, and does it restart each year?
Standard HMRC VAT Notice 700 para 16.3.1: a sequential number based on one or more series which uniquely identifies the document. EU VAT Directive 2006/112/EC art. 226 has the same rule.
- uk eu
- a prefix plus a running number, restarting each financial year
- groups
- a prefix per trading entity so two companies never share a number
- When is payment due: 30 days, end of month, half up front?
Standard UK: Late Payment of Commercial Debts (Interest) Act 1998 gives a statutory right to interest; EU Directive 2011/7/EU: 30 days unless agreed, 60 maximum between businesses.
- b2b services
- net 30 from the invoice date
- saas
- paid in advance, monthly or annually
- Does anything repeat every month, and is it billed in advance or in arrears?
- subscriptions
- in advance, on the start anniversary
- usage or support hours
- in arrears, at the month end, usage filled in by a person
- Should drafts from orders and schedules issue themselves, or wait for a person?
- most firms at first
- reviewed, until the drafts have been right for a few months
- Do you keep your books here, or with an accountant in another package?
- reference default
- post when the ledger is installed, else export monthly (decided 2026-10-18)
- under 20 staff
- export monthly to the accountant's package
- larger or multi entity
- books here
- Who may approve a credit note or write off a balance?
- Which time zone is 'today' in for your invoices?
- uk
- Europe/London
- When a repeating line starts in the past, should the missed periods be billed now?
- Do you invoice in more than one currency?
- Do you take deposits as a VAT invoice when you ask, or only once the customer pays?
Standard VAT Notice 700 section 14: a deposit's tax point is the earlier of payment and a VAT invoice
- Do you offer a discount for early payment?
Standard HMRC Revenue and Customs Brief 49 (2014): VAT on the amount actually paid; a credit note or the invoice statement
- Do you charge interest on late payment?
Standard Late Payment of Commercial Debts (Interest) Act 1998: 8% over the reference rate, fixed sums 40 / 70 / 100
- Do your customers want e-invoices (Peppol)?
- Is there more than one company in your group, and do they invoice each other?
- Do you bill annual or quarterly services in advance?
- Do you provide for doubtful debts each month?
What you can change yourself
These are settings, not code: someone in your team changes them on a screen, without a developer and without a release.
- how this business invoices; every row dated (valid_from after today; the first row of a key may start today)
- each AI step's mode (ai_steps: off | suggest)
- payment terms: 30 days, end of month following, early-payment discount
- per customer: bill-to name, address, invoice email, terms, currency
- which ledger account receivables, revenue, each tax code, bad debt, deposits and FX differences post to; v4: intercompany, deferred revenue, settlement discount, interest income and the doubtful-debt purposes
- v4: the statutory reference rate from 1 January and 1 July (margin 8%)
- v4: the doubtful-debt percentage per aging bucket, from a date after today
Where the platform limits what we can promise
Gap-free sequential invoice numbers are a legal requirement in many places, and DataK3 has no sequences. A high-water-mark row plus MAX(invoice_no), with the invoice row's own primary key as the uniqueness guard, claimed with a plain INSERT and a retry on conflict; issue through a single writer and re-read the number after issuing; tell the customer what the guarantee actually is today.
ALTER TABLE … ADD COLUMN unsettles reads on that table for minutes. migrate the test copy first, and change the live one at a quiet hour
No read-your-writes inside an open transaction. commit the draft, then read it back in a second transaction before handing it to tax or payments
DataK3 rejects CREATE VIEW. the sales-facing balance is a route, not a view
For builders
- Module spec — this page, for agents
- The lifecycle and the design template
- ar-core — version 1: invoices, tax per rate, receipts and allocation, credit notes, write-offs, collections and statements
Code
Public repositories, anonymous clone, one release tag each. Read README.md and AGENTS.md first.
- erp-brick-ar (brick, v0.1.2)
git clone --depth 1 --branch v0.1.2 https://git.dodil.io/dodil/erp-brick-ar.git
ssh:[email protected]:dodil/erp-brick-ar.git - brick-business-partner (brick, v0.4.0)
git clone --depth 1 --branch v0.4.0 https://git.dodil.io/dodil/erp-brick-business-partner.git
ssh:[email protected]:dodil/erp-brick-business-partner.git - erp-platform (platform, v0.9.13)
git clone --depth 1 --branch v0.9.13 https://git.dodil.io/dodil/erp-platform.git
ssh:[email protected]:dodil/erp-platform.git
Known gaps in the reference
- ar-core covers version 1's AR-01 to AR-09, AR-12 to AR-14, AR-17 and AR-21; schedules (AR-18, AR-26 to AR-28), metered drafts (AR-19), deposits (AR-15), the export (AR-24), the bill-to profile (AR-25) and the generic source (AR-20) are not built
- ar-core keeps receipts and allocations in ar_payments / ar_allocations; the brick moves them to payments (a one-way migration, keyed the same)
- a VOID does not yet post its reversing journal in ar-core
- ar-core's GET /api/invoices has no pagination and no source filter
- ar-core's column named bp_id is really a bp_KEY; the brick stores the BIGINT bp_id derived from bp_key (business-partner v0.3.1), and the migration converts it (design/ar-bp-id-change-request.md)
- v4 designs payment requests, settlement discounts, interest, intercompany, manual recurring invoices, Peppol, provisions and deferred revenue; erp-brick-ar implements v3 and none of these yet
- e-invoicing formats other than Peppol BIS Billing 3.0 (ZUGFeRD / XRechnung, FatturaPA, the UK's final mandate format when HMRC publishes it) come with the jurisdiction packs (tax M7); BIS 3 is the EN 16931 core they share
- revenue allocation across a bundle's performance obligations (IFRS 15 relative standalone selling price) is not computed: each line defers over its own service period
- the migration slice (AR-33, AR-34) depends on business-partner, tax and product publishing their Odoo maps, and on payments migrating allocations before the open-balance check can pass
- the AI-step marker in the BPMN is a task name until erp-platform draws dodil:ai / dodil:mode (M0 AI-step contract)