SlideShare a Scribd company logo
7
Most read
13
Most read
15
Most read
How to Create a PDF Report in Odoo
18
Enterprise
Enterprise
In Odoo 18, creating a PDF report involves defining a report
template using QWeb, linking it to a model, and customizing its
structure. The process includes setting up an XML report
definition, designing the layout with a QWeb template, and
integrating it into your module. This allows you to generate
detailed, printable reports (e.g., invoices, sale orders) directly from
the Odoo interface.
Introduction
Enterprise
QWeb is Odoo's templating engine, used to convert XML data into
HTML with ease. It supports dynamic content, conditional
statements, and customizable templates, making it ideal for
creating reports, emails, and documents. Whether for invoices,
financial statements, or business reports, QWeb ensures outputs
are clear and visually appealing.
What is Qweb?
Enterprise
Enterprise
First, we need to define the structure. For this, we'll use an
example by creating a new module named custom_report. Inside
this module, create a folder called report and add two files:
ir_actions_report.xml and product_report.xml, then specify the
necessary code in them.
Explanation
Enterprise
In your module's "report" folder, create an XML file named
ir_actions_report.xml. This file will define the report action that
links the report to the model. Here's an example of what the XML
file could include:
Create the Report Action (XML file)
Enterprise
Report Action (XML file)
<?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>
Enterprise
1. XML Declaration: Specifies the XML format and character
encoding.
2. Root Element: Defines <odoo> as the root element for Odoo
XML files.
3. Report Record: Creates a report action with a unique ID
(action_report_product_template).
4. Report Name: Names the report as "Product Report" for
display in the UI.
5. Model: Links the report to the product.template model.
Explanation(code)
Enterprise
● Report Type: Specifies the report format as QWeb PDF.
● QWeb Template Name: Points to the QWeb template
(custom_report.report_product).
● Template File Name: Specifies the QWeb template file for rendering the report.
● Dynamic Report Name: Sets a dynamic name using the product's name (e.g.,
"Product Report - [Name]").
● Binding to Model: Binds the report to the product.template model using its
reference.
● Binding Type: Marks the report as available in the "Print" menu for the model.
● Closing Tags: Ends the <record> and <odoo> elements properly.
Explanation(code)
Enterprise
This XML file defines a report action with a name, an associated
model (product.template), the report type (qweb-pdf), and a link
to the QWeb template we’ll create next.
Once added, this report will appear as a new option under the
"Print" menu in the product.template model.
Report(print product report)
Enterprise
Enterprise
Next, create an XML file named product_report.xml. This file will
define the layout and content of your custom PDF report. Here's
a simple example:
Create the QWeb Template (XML file)
Enterprise
Code
<?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></br>
<p>Name : <span t-field="o.name"/></p></div></t></t></t>
</template>
</odoo>
Enterprise
● XML Declaration: Declares the XML version and encoding.
● Root Element: Defines the root element <odoo> for Odoo XML files.
● Template Definition: Creates a QWeb template with the ID report_product.
● HTML Container: Calls Odoo's default HTML container for consistent layout.
● Loop Through Records: Iterates over records (docs) to generate the report for each.
● External Layout: Applies Odoo's default external layout (e.g., header, footer).
● Page Content: Defines the report’s content, such as the product name (o.name).
Explanation(code)
Enterprise
● Define a template in the QWeb XML with the same name as the
report_name field in the report action.
● Use t-foreach to loop through the product records and generate
content for each one.
● Apply HTML and QWeb expressions to format and display the
information.
Explanation(workflow)
Enterprise
The Template Will Generate the
PDF Report Below
Enterprise
It shows how to create a custom PDF report in Odoo 18 using
QWeb templates. By defining the report action and template,
you can easily generate and print reports directly from Odoo.
This makes it simple to add custom reports to your system.
Conclusion
For More Info.
Check our company website for related blogs
and Odoo book.
Check our YouTube channel for
functional and technical videos in Odoo.
Enterprise
www.cybrosys.com

More Related Content

PPTX
Reporting - Printed (Pdf) Reports
PPTX
Qweb Templates and Operations in Odoo 18
PPTX
Odoo technical features
PPTX
Client Actions In Odoo 17 - Odoo 17 Slides
PDF
Multiple odoo with single vue storefront
DOCX
QWeb Report in odoo
PPTX
How to Create a Custom Web Form View in Odoo 17
PPTX
Demonstration module in Odoo 17 - Odoo 17 Slides
Reporting - Printed (Pdf) Reports
Qweb Templates and Operations in Odoo 18
Odoo technical features
Client Actions In Odoo 17 - Odoo 17 Slides
Multiple odoo with single vue storefront
QWeb Report in odoo
How to Create a Custom Web Form View in Odoo 17
Demonstration module in Odoo 17 - Odoo 17 Slides

Similar to How to Create a PDF Report in Odoo 18 - Odoo Slides (20)

PPTX
Smart form
PDF
Angular - Chapter 4 - Data and Event Handling
PPTX
URLS and routing in odoo 18 - Odoo Slides
DOCX
Sap business objects bobi training
PPTX
URLs and Routing in the Odoo 17 Website App
PPTX
Oracle Cloud ERP Report and Analytics | What are Cloud ERP reporting Options ...
PPT
Oracle Enterprise 2.0 & Business Applications
PPT
ebs xml.ppt
PPTX
Odoo 15 Composition of Module
PPTX
Types of Actions in Odoo 18 - Odoo Slides
PPTX
How to embed reporting into your asp.net core web applications
PDF
treeview
PDF
treeview
PPTX
bi-publisher.pptx
PDF
Step-by-Step Guide to Customizing Odoo Modules
PDF
C# .NET Developer Portfolio
DOCX
Company Visitor Management System Report.docx
PDF
Django 1.10.3 Getting started
PDF
بررسی چارچوب جنگو
PDF
Develop an App with the Odoo Framework
Smart form
Angular - Chapter 4 - Data and Event Handling
URLS and routing in odoo 18 - Odoo Slides
Sap business objects bobi training
URLs and Routing in the Odoo 17 Website App
Oracle Cloud ERP Report and Analytics | What are Cloud ERP reporting Options ...
Oracle Enterprise 2.0 & Business Applications
ebs xml.ppt
Odoo 15 Composition of Module
Types of Actions in Odoo 18 - Odoo Slides
How to embed reporting into your asp.net core web applications
treeview
treeview
bi-publisher.pptx
Step-by-Step Guide to Customizing Odoo Modules
C# .NET Developer Portfolio
Company Visitor Management System Report.docx
Django 1.10.3 Getting started
بررسی چارچوب جنگو
Develop an App with the Odoo Framework
Ad

More from Celine George (20)

PPTX
How to Implement OWL Notification Service in Odoo 18
PPTX
Tracking Profit Margins in Sales Orders with Odoo 18
PPTX
How to Configure Outgoing Shipment in 3 Steps Using Odoo 18
PPTX
How to Configure Outgoing Shipment in 1 Step Using Odoo 18.pptx
PPTX
How to Configure Outgoing Shipment in 2 Steps Using Odoo 18
PPTX
How to Add New Applicants in Odoo 18 Recruitment
PPTX
How to Analyze the Recruitment Process in Odoo 18 Recruitment
PPTX
How to Manage Referral Reporting in Odoo 18 Referrals
PPTX
How to Set, Track, & Review Employee Goals in Odoo 18 Appraisals
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PPTX
How to Manage Bill Control Policy in Odoo 18
PPTX
How to Manage Loyalty Points in Odoo 18 Sales
PPTX
Odoo 18 Sales_ Managing Quotation Validity
PPTX
How to Manage Global Discount in Odoo 18 POS
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
How to Implement OWL Notification Service in Odoo 18
Tracking Profit Margins in Sales Orders with Odoo 18
How to Configure Outgoing Shipment in 3 Steps Using Odoo 18
How to Configure Outgoing Shipment in 1 Step Using Odoo 18.pptx
How to Configure Outgoing Shipment in 2 Steps Using Odoo 18
How to Add New Applicants in Odoo 18 Recruitment
How to Analyze the Recruitment Process in Odoo 18 Recruitment
How to Manage Referral Reporting in Odoo 18 Referrals
How to Set, Track, & Review Employee Goals in Odoo 18 Appraisals
Revamp in MTO Odoo 18 Inventory - Odoo Slides
How to Manage Starshipit in Odoo 18 - Odoo Slides
How to Manage Bill Control Policy in Odoo 18
How to Manage Loyalty Points in Odoo 18 Sales
Odoo 18 Sales_ Managing Quotation Validity
How to Manage Global Discount in Odoo 18 POS
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Tips Management in Odoo 18 POS - Odoo Slides
How to Close Subscription in Odoo 18 - Odoo Slides
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
How to Track Skills & Contracts Using Odoo 18 Employee
Ad

Recently uploaded (20)

PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Classroom Observation Tools for Teachers
PDF
Computing-Curriculum for Schools in Ghana
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
GDM (1) (1).pptx small presentation for students
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
RMMM.pdf make it easy to upload and study
PPTX
master seminar digital applications in india
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Cell Structure & Organelles in detailed.
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Classroom Observation Tools for Teachers
Computing-Curriculum for Schools in Ghana
O7-L3 Supply Chain Operations - ICLT Program
Renaissance Architecture: A Journey from Faith to Humanism
GDM (1) (1).pptx small presentation for students
VCE English Exam - Section C Student Revision Booklet
RMMM.pdf make it easy to upload and study
master seminar digital applications in india
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Abdominal Access Techniques with Prof. Dr. R K Mishra
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
TR - Agricultural Crops Production NC III.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Microbial disease of the cardiovascular and lymphatic systems
Cell Structure & Organelles in detailed.
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf

How to Create a PDF Report in Odoo 18 - Odoo Slides

  • 1. How to Create a PDF Report in Odoo 18 Enterprise
  • 2. Enterprise In Odoo 18, creating a PDF report involves defining a report template using QWeb, linking it to a model, and customizing its structure. The process includes setting up an XML report definition, designing the layout with a QWeb template, and integrating it into your module. This allows you to generate detailed, printable reports (e.g., invoices, sale orders) directly from the Odoo interface. Introduction
  • 3. Enterprise QWeb is Odoo's templating engine, used to convert XML data into HTML with ease. It supports dynamic content, conditional statements, and customizable templates, making it ideal for creating reports, emails, and documents. Whether for invoices, financial statements, or business reports, QWeb ensures outputs are clear and visually appealing. What is Qweb?
  • 5. Enterprise First, we need to define the structure. For this, we'll use an example by creating a new module named custom_report. Inside this module, create a folder called report and add two files: ir_actions_report.xml and product_report.xml, then specify the necessary code in them. Explanation
  • 6. Enterprise In your module's "report" folder, create an XML file named ir_actions_report.xml. This file will define the report action that links the report to the model. Here's an example of what the XML file could include: Create the Report Action (XML file)
  • 7. Enterprise Report Action (XML file) <?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>
  • 8. Enterprise 1. XML Declaration: Specifies the XML format and character encoding. 2. Root Element: Defines <odoo> as the root element for Odoo XML files. 3. Report Record: Creates a report action with a unique ID (action_report_product_template). 4. Report Name: Names the report as "Product Report" for display in the UI. 5. Model: Links the report to the product.template model. Explanation(code)
  • 9. Enterprise ● Report Type: Specifies the report format as QWeb PDF. ● QWeb Template Name: Points to the QWeb template (custom_report.report_product). ● Template File Name: Specifies the QWeb template file for rendering the report. ● Dynamic Report Name: Sets a dynamic name using the product's name (e.g., "Product Report - [Name]"). ● Binding to Model: Binds the report to the product.template model using its reference. ● Binding Type: Marks the report as available in the "Print" menu for the model. ● Closing Tags: Ends the <record> and <odoo> elements properly. Explanation(code)
  • 10. Enterprise This XML file defines a report action with a name, an associated model (product.template), the report type (qweb-pdf), and a link to the QWeb template we’ll create next. Once added, this report will appear as a new option under the "Print" menu in the product.template model. Report(print product report)
  • 12. Enterprise Next, create an XML file named product_report.xml. This file will define the layout and content of your custom PDF report. Here's a simple example: Create the QWeb Template (XML file)
  • 13. Enterprise Code <?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></br> <p>Name : <span t-field="o.name"/></p></div></t></t></t> </template> </odoo>
  • 14. Enterprise ● XML Declaration: Declares the XML version and encoding. ● Root Element: Defines the root element <odoo> for Odoo XML files. ● Template Definition: Creates a QWeb template with the ID report_product. ● HTML Container: Calls Odoo's default HTML container for consistent layout. ● Loop Through Records: Iterates over records (docs) to generate the report for each. ● External Layout: Applies Odoo's default external layout (e.g., header, footer). ● Page Content: Defines the report’s content, such as the product name (o.name). Explanation(code)
  • 15. Enterprise ● Define a template in the QWeb XML with the same name as the report_name field in the report action. ● Use t-foreach to loop through the product records and generate content for each one. ● Apply HTML and QWeb expressions to format and display the information. Explanation(workflow)
  • 16. Enterprise The Template Will Generate the PDF Report Below
  • 17. Enterprise It shows how to create a custom PDF report in Odoo 18 using QWeb templates. By defining the report action and template, you can easily generate and print reports directly from Odoo. This makes it simple to add custom reports to your system. Conclusion
  • 18. For More Info. Check our company website for related blogs and Odoo book. Check our YouTube channel for functional and technical videos in Odoo. Enterprise www.cybrosys.com