Inheriting Existing Default Report Templates in Odoo 19

March 10, 2026 by
Inheriting Existing Default Report Templates in Odoo 19
Fazri Muhammad Yazid
| No comments yet

Overview

Reports in Odoo are generated using QWeb templates. Default reports (invoice, sale order, delivery slip, etc.) are defined in XML templates inside core modules. Customization is done by inheriting the existing template rather than modifying the original file. This preserves upgrade compatibility.


Locate the Original Template

Example template used by the invoice report:

	​account.report_invoice_document

Example Original Template

	​<template id="report_invoice_document">
​ <t t-call="web.external_layout">
​<t t-set="o" t-value="doc"/>
​<div class="page">
​<h2>Invoice</h2>
​</div>
​</t>
​</template>


Inheriting the Template

Create a new XML file in your custom module and inherit the template.

Example:

	​<odoo>
    ​ <template id="custom_invoice_report"
​inherit_id="account.report_invoice_document">
        ​<xpath expr="//h2" position="after">
            ​<p>
                ​Custom message inside inherited report
            ​</p>
        ​</xpath>
    ​</template>
​</odoo>

Explanation:

  • inherit_id references the original template.
  • xpath selects the node to modify.
  • position defines how the modification is applied.


Result

The custom module loads after the original module, applies the inherited template, and modifies the report structure without altering core code.

Inheriting Existing Default Report Templates in Odoo 19
Fazri Muhammad Yazid March 10, 2026
Share this post
Archive
Sign in to leave a comment