MODULES / FINANCE

Invoice Aging & Previous Balance

Two invoice PDFs: previous/current account balance, or the same invoice with a detailed aging statement.

Overview

Module idask_aging_previous_balance_report
Version1.0.0
Who uses itAnyone who uses the screens listed below.
InstalledOn demand, from Settings → Modules. Anything it needs is installed with it.

How it links to other modules

  • Needs: Accounting
  • Works better with: no other module in particular
  • Needed by: no other module

A module that is needed cannot be turned off while the module that needs it is on.

Details

Invoice aging and previous balance

Optional module ID: ask_aging_previous_balance_report. Install from Settings > Modules. Adds PDF With Previous Balance and PDF With Aging to posted invoice screens. The normal PDF remains available. No discount fields, calculations or posting changes are included.

Report functionality adapted from the two reports in D:/Odoo18/sparkosol/addons.odoo18/eg_sale_global_discount. This is a separate, reports-only ASKERP addon, outside the original 58-module migration inventory.

Previous balance sums the partner's posted receivable ledger before this invoice; current balance adds this document's signed ledger impact. Vendor documents use payables separately. Credit notes and unapplied payments reduce balances. All opening entries count; drafts and other companies never do.

The boundary is the invoice accounting date: every posted entry dated on or before it counts, with same-date entries ordered by posting timestamp, entry number and ID up to this invoice. An entry dated earlier but posted later — a setup opening balance entered after the invoices — is therefore included, so this figure matches the partner ledger (D162). Reconciliations count when their date is on or before the invoice date. Aging lists the remaining open amounts and a running balance, with days since each document date, matching the source report's document-age convention. This is not overdue aging by due date. It is a live ledger reconstruction as of that date, not an archived snapshot: later backdated entries or removed reconciliations change what a reprint shows, while every figure always ties to the ledger.

Both PDFs include prepared-by and signature areas. Long aging tables paginate with repeated headers. Balances use Decimal arithmetic and company currency precision. Disabling the module hides the buttons and blocks direct report URLs, without changing invoices or accounting records; reinstalling restores access.

Authenticated web and API invoice PDF endpoints accept report=previous-balance or report=aging; omitted report selects the standard invoice. Unknown report names return HTTP 400.

Verification: npx vitest run addons/ask_aging_previous_balance_report/addon.test.ts server/pdf.test.ts. Browser smoke script: node --env-file=.env --import tsx scripts/invoice-reports-smoke.ts (set E2E_BASE_URL for another local port).

Invoice Aging & Previous Balance | ASKERP Docs