Skip to content

Extending Financial Reports

The accounting reports — Tax Return, Balance Sheet, Profit & Loss, the ledgers — are built on the server and drawn by one report screen. A module can add to a report it does not own without touching the screen: options the report offers, buttons in its toolbar, and a panel above it. That is how a country’s e-filing lives on the Tax Return itself (the UK files its VAT return with HMRC from there) instead of on a screen of its own.

Inherit FinancialReportData and override extend_report(result). It receives the report as built and returns it, extended. Act only on the reports you mean, and always pass the result through super() — several modules may extend one report.

from fullfinity.engine.base import *
class MyTaxReport(Model):
__inherit__ = "FinancialReportData"
async def extend_report(self, result):
result = await super().extend_report(result)
if self.report_type != "Tax Return" or not self.company_id:
return result
result["notice"] = {"title": t("Filed"), "color": "green",
"rows": [{"label": t("Reference"), "value": "A123"}]}
return result

self carries the report’s inputs: report_type, company_id, date_from / date_to (or as_of_date), and any filter the user set.

KeyShapeShown as
periods[{label, date_from, date_to, status, color}] (ISO dates)A picker beside the date range; choosing one sets the report’s dates. For named periods that are not calendar ones — a tax authority’s return periods.
actions[{label, model, method, record_id, icon, primary}]Toolbar buttons. A click runs method on model — on the record when record_id is given — and its result is handled like any button’s (a wizard opens, a toast shows); the report then refreshes.
notice{title, color, text, rows: [{label, value}]}A panel under the report’s heading. color is a theme colour (blue, green, orange, red, gray).
default_period{date_from, date_to} (ISO dates)Where the report opens when the user has not picked dates — the next return to file, say, instead of the year to date. Once the user chooses dates, theirs stand.

Labels and text are shown as you send them: write them with t(). Values in rows are text — format amounts and dates on the server (format_monetary, readable_date).

An action’s method is an ordinary @Model.client_callable method. To ask the user something first (a declaration, a choice), have it return a wizard ({"type": "wizard", ...}) and do the work in the wizard’s button; return {"type": "close", "reload": True} from that button so the report reloads with the outcome.