Financial report templates
Define the lines of a financial statement as account filters and formulas, and render them in the statement reports.
A Financial Report Template lists the lines of a statement. Each line sums accounts picked by a filter, or computes a value from other lines with a formula. The Custom Financial Statement report renders a template, and Profit and Loss Statement, Balance Sheet and Cash Flow render one when you set their Report Template filter.
Template fields
| Field | Meaning |
|---|---|
| Template Name | The record's name |
| Report Type | Profit and Loss Statement, Balance Sheet, Cash Flow or Custom Financial Statement |
| Disabled | A disabled template cannot be used in a report |
| Report Line Items | The Financial Report Row table, one row per line |
Each row in the Report Line Items table:
| Field | Meaning |
|---|---|
| Line Reference | A code other rows' formulas use, such as IS_REVENUE |
| Display Name | The text on the statement |
| Data Source | Account Data, Calculated Amount, Blank Line, Column Break or Section Break |
| Balance Type | For Account Data: Opening Balance, Closing Balance or Period Movement (Debits - Credits) |
| Formula or Account Filter | The Account filter for Account Data, or the formula for Calculated Amount |
| Indent Level | 0 for a heading, 1 for a sub-category, and so on |
| Reverse Sign | Show credits as positive, as for income |
| Hidden Line (Internal Use Only) | Compute the line for formulas but leave it off the statement |
| Hide If Zero, Bold Text, Italic Text, Color, Value Type | Display options |
| Include in Charts | Plot the line on the report's chart |
Account filters and Account Category
An Account Data row's filter uses ERPNext's JSON filter format on Account fields: ["field", "operator", value], or {"and": [...]} and {"or": [...]} to combine them. Supported operators are =, !=, <, >, <=, >=, in, not in, like, not like and is. The row sums the company's enabled ledger accounts that match.
Most standard rows filter on Account Category. Set it in an Account's Account Category field. ERP ships ERPNext's 29 categories, such as Cash and Cash Equivalents, Trade Receivables and Revenue from Operations, each with a Root Type, and the Standard chart's accounts already name them. Renaming a category updates the template filters that use it.
Formulas
A Calculated Amount formula is a cardinal_expr expression over earlier rows' Line References, evaluated per period. A division by zero or another error gives 0. ERPNext's Python a if c else b becomes if c then a else b.
This row from the Financial Ratios Analysis template in fixtures/financial_report_template.yaml:
- {reference_code: "RATIO_CURRENT", display_name: "Current Ratio (Target: 1.5 - 2.0)", indentation_level: 1, data_source: "Calculated Amount", calculation_formula: "if BS_CURRENT_LIAB != 0 then BS_CURRENT_ASSETS / BS_CURRENT_LIAB else 0", include_in_charts: true, fieldtype: "Float"}BS_CURRENT_ASSETS and BS_CURRENT_LIAB are hidden Account Data rows in the same template, for example:
- {reference_code: "BS_CASH", display_name: "Cash and Cash Equivalents", data_source: "Account Data", balance_type: "Closing Balance", hidden_calculation: true, calculation_formula: "[\"account_category\", \"=\", \"Cash and Cash Equivalents\"]"}Standard templates
ERP installs ERPNext v16's six templates:
| Template Name | Report Type |
|---|---|
| Financial Ratios Analysis | Custom Financial Statement |
| Horizontal Balance Sheet (Columnar) | Balance Sheet |
| Horizontal Profit and Loss (Columnar) | Profit and Loss Statement |
| Standard Balance Sheet (IFRS) | Balance Sheet |
| Standard Cash Flow Statement (IFRS) | Cash Flow |
| Standard Profit and Loss (IFRS) | Profit and Loss Statement |
Running a template
Open Custom Financial Statement, or Profit and Loss Statement, Balance Sheet or Cash Flow.
Pick the Report Template, the Company and the periods, by Fiscal Year or Date Range.
ERP computes each Account Data row per period from the GL, then each Calculated Amount row in order. Opening balances start from the last Period Closing Voucher before the first period.
The Finance Book, Cost Center, Project and accounting dimension filters narrow every sum.
Rules on save
- A Line Reference starts with a letter and holds only letters, numbers and underscores. It must be unique in the template.
- An Account Data row needs a Balance Type.
- Every row except Blank Line, Column Break and Section Break needs a formula or filter.
- A formula must compile to a number, may not reference its own line and may not form a circular reference.
- A filter must name real Account fields and supported operators.
- Custom API rows are refused. ERP has no registry of read-only methods for them yet.
See Chart of accounts for setting Account Category, and Fiscal years and closing for Period Closing Vouchers.