Odoo 19 offers powerful and flexible tools for generating PDF reports, making it easier than ever to produce professional documents for your business. Whether it’s sales invoices, purchase orders, financial statements, or custom reports, Odoo 19 allows you to create highly customizable PDF outputs that meet your organization’s needs.
Role of QWeb Templates in Report Generation
Odoo uses QWeb, an XML-based templating engine, to create the structure and layout of PDF reports. QWeb templates define how data from Odoo models is presented in a report. They allow you to include tables, headers, footers, dynamic fields, loops, and conditional content, giving you full control over the report’s appearance and content.
Components of a PDF Report
Report Action
The report action acts as a bridge between the QWeb template and the underlying model data. It tells Odoo: “When this report is triggered, use this template and pull data from this model.”
Creating the Report Action (XML file)
To make your PDF report accessible in Odoo, you need to define a report action that links the report template to a specific model. This is done by creating an XML file inside your module’s report directory. Let’s name this file ir_actions_report.xml.
The report action specifies the model, report type, template, and how the report should be triggered.
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="action_report_product_template" model="ir.actions.report">
<field name="name">Product Report</field>
<field name="model">product.template</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">custom_report.report_product</field>
<field name="report_file">custom_report.report_product</field>
<field name="print_report_name">'Product Report - %s' % (object.name)</field>
<field name="binding_model_id" ref="product.model_product_template"/>
<field name="binding_type">report</field>
</record>
</odoo>
- model: The Odoo model from which data is fetched (e.g., sale.order, purchase.order).
- report_type: Defines the format of the output; usually qweb-pdf for PDF reports.
- report_name: References the QWeb template (which you will create separately).
- report_file: Usually matches report_name; used internally by Odoo.
- print_report_name: Dynamic PDF file name using Python expression (e.g., including the product name).
- binding_model_id: Connects the report to the model so it appears in the “Print” menu of that model.
- binding_type: report ensures it is accessible as a report action from the model.
With the defined report action, a new option will automatically appear under the 'Print' menu of the product.template form view. This ensures that the custom report is directly accessible from the standard interface, allowing users to generate it conveniently from within the product record.

Report Template (QWeb XML)
This is the heart of the report where you define the HTML structure, CSS styling, and dynamic data rendering using QWeb tags such as <t-foreach> and <t-esc>. Create a separate XML file named product_report.xml to define the layout and content of your custom PDF report. Below is a simple example:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_product">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout">
<div class="page">
<div class="oe_structure"/>
<h2>Product Report</h2>
<br/>
<p><strong>Name:</strong> <span t-field="o.name"/></p>
</div>
</t>
</t>
</t>
</template>
</odoo>
In this template, the id corresponds to the name used in the report action. The t-foreach loop iterates over the product records (docs), creating a separate section for each product. You can enhance the layout using standard HTML along with QWeb expressions to display the required fields.
When executed, this template will generate a PDF report that lists all products along with their details.

Creating and managing PDF reports in Odoo 19 is both flexible and powerful, allowing businesses to generate professional documents tailored to their needs. By leveraging QWeb templates, report actions, and Odoo’s dynamic expressions, you can design highly customizable reports for sales, purchases, inventory, or any other model. With the ability to include custom layouts, styling, and automated data rendering, Odoo 19 simplifies reporting and helps organizations maintain accurate, visually appealing, and easily shareable documentation.
To read more about How to Create a PDF Report in Odoo 18?, refer to our blog How to Create a PDF Report in Odoo 18?