Skip to Content

Odoo Reports with QWeb: Customize Invoices and Orders

PDF reports that match your brand

Odoo generates PDF reports for invoices, sales orders, delivery slips, inventory operations, and more. All are built on QWeb templates (XML-based templating) that you can customize.

QWeb basics

QWeb is Odoo's template engine. It uses XML with special attributes: t-field to display field values, t-foreach for loops, t-if for conditions, t-esc for raw text. The syntax resembles Jinja2 but is XML-based.

Customizing an existing report

Create a new template that inherits the existing one. Use XPath to find and replace specific elements. Change the logo, modify layout, add extra fields. The entire customization is done in a module without touching core code.

Invoice template

The most common customization. Add the company logo, bank details in the footer, custom colors and typography. Reference template: account.report_invoice_document. Inherit it and modify with XPath.

Paper and margins

Under Settings → Technical → Reporting → Paper Format. A4 is standard in Sweden. Set margins (top, bottom, left, right). Header and footer can be defined per company.

WeasyPrint

Odoo 18 has switched to WeasyPrint for PDF rendering (replacing wkhtmltopdf). It provides better CSS support, faster rendering, and more consistent results. CSS grid and flexbox now work in reports.

Tips

Test the report with real data, not just test data. Long product names, invoices with 50 lines, customers with long addresses. It's at the edges where things break. And test printing: margins in PDF and margins when printing can differ.

Odoo XML-RPC: Integrate with Python, Node, and Go
Odoo's external interface explained