今日已更新 32 条资讯 | 累计 27207 条内容
关于我们

Mastering QWeb PDF Reports in Odoo 19: From Beginner to Advanced

RayMiles 2026年08月02日 23:51 0 次阅读 来源:Dev.to

Learn how to build professional PDF reports in Odoo 19 using QWeb . This guide covers everything from creating your first report to advanced techniques like reusable templates, custom paper formats, barcodes, multilingual reports, RTL support, and performance optimization. Introduction Every Odoo application relies on reports. Whether you're printing: Sales Quotations Customer Invoices Purchase Orders Delivery Slips Manufacturing Orders Inventory Labels Payroll Documents Custom Certificates you're using QWeb , Odoo's XML-based templating engine. Although creating a basic report is straightforward, building maintainable, scalable, and professional reports requires understanding how the entire reporting pipeline works. In this tutorial, we'll build a complete report from scratch while exploring best practices used by experienced Odoo developers. By the end of this guide, you'll be able to: Create custom PDF reports Understand how Odoo generates PDFs Design reusable templates Display relational data Build dynamic tables Format currencies and dates correctly Add company logos, images, barcodes, and QR codes Create custom paper formats Pass additional data from Python Optimize report performance Debug common QWeb issues How Odoo Generates a PDF Before writing any XML, it's important to understand the report generation process. User clicks "Print" │ ▼ ir.actions.report │ ▼ Report Model (_get_report_values) │ ▼ QWeb Template │ ▼ Rendered HTML │ ▼ wkhtmltopdf │ ▼ PDF Download Each step has a specific responsibility: Component Responsibility ir.actions.report Registers the report Report Model Prepares business data QWeb Generates HTML wkhtmltopdf Converts HTML into PDF Understanding this workflow makes debugging significantly easier. Project Structure A clean module structure helps keep reports maintainable. my_module/ │ ├── models/ │ └── sale_order.py │ ├── report/ │ ├── sale_order_report.xml │ ├── report_action.xml │ └── paperformat.xml │ ├── security/ │ ├── views/ │ └── _

本文内容来源于互联网,版权归原作者所有
查看原文