Invoice Joins
Consolidate several unissued customer invoices into one document and one receivable, with per-source allocation and reversal.
The Invoice Joins screen consolidates several customer invoices that have not yet been issued into one invoice. The customer receives one document, one number and one receivable — instead of five separate bills demanding five separate payments.
Getting there
Section titled “Getting there”- Menu Sales → Invoice Joins (route
o2c/invoice-joins). - Requires
read:invoice-jointo view the register,create:invoice-jointo consolidate, andreverse:invoice-jointo undo. - By default Finance/Admin holds all three; Sales holds
readandcreateonly.
Only unissued invoices can be joined
Section titled “Only unissued invoices can be joined”This is the rule the whole feature is built on, and it is not a convenience.
| Invoice status | Joinable? | Why |
|---|---|---|
DRAFT | ✅ | No AR journal exists. |
PENDING | ✅ | Awaiting approval; no AR journal exists. |
APPROVED, SENT, OVERDUE | ❌ | Already issued; carries an AR journal. |
PARTIAL_PAID, PAID | ❌ | Money is already allocated. |
CANCELLED, MERGED | ❌ | Already terminal. |
Rules that still apply
Section titled “Rules that still apply”Even within the unissued band, further guards apply. All of them are reported together, never one at a time:
| Code | Meaning |
|---|---|
TOO_FEW_SOURCES | Fewer than the minimum number of invoices (2 by default). |
TOO_MANY_SOURCES | More than the maximum per consolidation. |
DUPLICATE_SOURCE | The same invoice appears more than once. |
CUSTOMER_MISMATCH | Invoices belong to different customers. |
CURRENCY_MISMATCH | Invoices use different currencies. |
SOURCE_NOT_ELIGIBLE | Status outside the policy’s allow-list. |
SOURCE_ALREADY_JOINED | The invoice is already part of another consolidation. |
SOURCE_HAS_PAYMENT | It has a payment or a balance reduced by a credit. |
SOURCE_DATE_AFTER_JOIN_DATE | The invoice date is later than the join date. |
ORGANIZATIONAL_UNIT_MISMATCH | Different org unit (when the policy requires the same one). |
SALESPERSON_MISMATCH | Different salesperson (when the policy requires the same one). |
Warnings that do not block
Section titled “Warnings that do not block”Two things are reported as warnings rather than refusals, because they are legitimate but change what the resulting document means:
- The sources span more than one accounting period. The merged invoice takes the latest period’s date, so be aware if a period is already closed.
- The sources were taxed at different PPN rates. The merged invoice carries the blended effective rate (
ppn_amount / net_amount, 4 dp). The authoritative figure is alwaysppn_amount, never the rate.
Totals are copied exactly, never recomputed
Section titled “Totals are copied exactly, never recomputed”The merged invoice’s figures are the exact sum of each source’s stored columns. They are not recomputed from lines, because round(a×r) + round(b×r) is not round((a+b)×r) — and invoices with different PPN treatment (one taxable, one exempt) make that the normal case rather than an edge case.
Recomputing would leave a permanent sub-cent residue in the general ledger that reconciles to nothing. Therefore:
- The merged header is supplied explicitly from the source totals.
- Source lines are copied value-for-value (
quantity,unitPrice,discountPct), socomputeLinereproduces the same figures. - Before writing, the server verifies that the line sum equals the stored subtotal. If it does not (for example, a header that was edited by hand), the consolidation is refused with a message naming the offending invoice — refusing is better than issuing a document whose lines do not foot.
Due date: credit is never extended
Section titled “Due date: credit is never extended”By default the merged invoice takes the earliest source due date. Consolidation is an administrative courtesy, not new credit. Using the latest date would turn consolidation into a quiet way of granting a customer extra days nobody approved.
A tenant whose commercial policy really is to normalise a customer’s schedule can select the LATEST strategy through the invoice.join.v1 setting — and that is recorded as a decision rather than being the default.
Allocation: every source is recorded
Section titled “Allocation: every source is recorded”The merged invoice shows one number; the allocation table shows how that number was arrived at. Each source is stored with:
- its invoice number (snapshotted, so the historical document stays readable even if the source row is later deleted),
- the status it held before the merge (used to restore it),
- its invoice and due dates,
- all five money columns (subtotal, discount, net, PPN, total),
- its AR journal id.
Storing one merged total and re-splitting it on reversal is lossy: a discount, an exempt line, or an already-rounded PPN cannot be divided back into its original parts and survive.
Undoing a consolidation
Section titled “Undoing a consolidation”Undoing a consolidation will:
- Cancel the merged invoice — its AR journal is reversed, with a narration naming the join number and the reason.
- Restore every source to the status it held before the merge (
DRAFTorPENDING). - Mark the join
REVERSED, recording the reason, the actor and the time.
Because the sources never posted a journal, their restoration is purely a status change — the ledger lands exactly where it started. That is the reason the “unissued only” rule exists.
Undo is only possible while the merged invoice is untouched: not cancelled, and with no payment or credit allocated. If money has been applied, it must be unapplied first — the same condition the sources had to meet on the way in. Symmetry is the point.
Where consolidations appear
Section titled “Where consolidations appear”- The Invoice Joins register lists every consolidation with filters (status, date range, number/title search), multi-column sort, and a CSV export that applies exactly the same filters.
- The merged invoice is an ordinary invoice: it appears in the invoice list, ages, is dunned, sits in receivables, and counts for commission.
- Source invoices are
MERGEDand do not appear as receivables. The status is terminal and is automatically excluded from every “what is still owed?” reader — ageing, dunning, credit exposure and commission — because they all filter in the open statuses.
Tenant settings
Section titled “Tenant settings”The policy is stored under invoice.join.v1 and read through SettingsService:
| Field | Default | Meaning |
|---|---|---|
minSources | 2 | Minimum invoices per consolidation. |
maxSources | 100 | Maximum invoices per consolidation (hard ceiling 500). |
allowedSourceStatuses | ["DRAFT","PENDING"] | Joinable statuses; cannot widen the forbidden set. |
requireSameOrganizationalUnit | false | When on, every source must share one org unit. |
requireSameSalesperson | false | When on, every source must share one salesperson. |
dueDateStrategy | EARLIEST | EARLIEST or LATEST. |
A corrupt or partial value never widens a guard: normalisation falls back to the safe status list, so a settings typo cannot make an issued invoice joinable.
Frequently asked questions
Section titled “Frequently asked questions”Why is the “Join” button missing for some customers?
Their invoices may already be issued. Check the status: only DRAFT and PENDING can be joined.
Can invoices in different currencies be joined? No. The merged invoice has one currency, and a cross-currency consolidation produces a legally wrong document.
What happens to the source sales orders or contracts? Nothing. The source invoices already consumed them when they were created, and the merged invoice deliberately does not reference them again, so consumption is not advanced twice.
Can a merged invoice be joined again?
No. It is an ordinary invoice, but source invoices left in MERGED can never be selected again.