How To Create Pdf Report In Odoo 14

How To Articles

In this article, I will walk you through the steps of generating a PDF report in Odoo 14. As a seasoned Odoo specialist, I have discovered that creating PDF reports is a crucial function for countless companies, as it enables them to showcase data in a polished and conveniently accessible manner.

Why PDF Reports are Important

PDF reports are widely used in various industries because of their versatility and compatibility across different devices and operating systems. They allow you to present data, such as invoices, sales reports, and financial statements, in a standardized format that can be easily printed or emailed to clients and stakeholders.

Now, let’s dive into the process of creating a PDF report in Odoo 14.

Step 1: Define the Report Model

The first step in creating a PDF report in Odoo 14 is to define the report model. The report model specifies the data structure and layout of the report. To do this, you need to create a new Python model that inherits from the ‘’ class.

class MyReport(models.AbstractModel):
_name = ''
_inherit = ''
_template = 'my_module.my_report_template'
# Add fields and methods

Make sure to replace ‘my_module’ with the name of your Odoo module and ‘my_report’ with the name of your report model.

Step 2: Create the Report Template

Once you have defined the report model, the next step is to create the report template. The report template defines the structure and layout of the PDF report. Odoo uses the QWeb templating engine for generating reports, which allows you to use HTML-like syntax to define the report’s structure.

<template id="my_report_template">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="doc">
<div class="page">


Replace the content within the ‘div’ tag with the desired content and styling for your report.

Step 3: Generate the Report

After defining the report model and creating the report template, you need to generate the report. To do this, you can use the ‘render_report’ method of the ‘’ class. This method takes the report model, report template, and other parameters as input and returns the generated PDF report.

report = self.env[''].sudo().create({
'model': '',
'report_name': 'my_module.my_report',
'template': 'my_module.my_report_template',
'data': data_dict, # Add data if required
'context': self.env.context, # Add context if required

pdf_report = report.render_report()

You can then save the ‘pdf_report’ variable as a PDF file or attach it to a record in Odoo, depending on your requirements.


Creating PDF reports in Odoo 14 is a powerful feature that allows you to present your data in a professional and easily shareable format. By following the steps outlined in this article, you can generate customized PDF reports that meet your specific business needs. Make sure to explore the different possibilities offered by the QWeb templating engine to create visually appealing and informative reports.

Remember, creating a PDF report in Odoo 14 is just one of the many features and functionalities that this versatile ERP system offers. With its extensive range of modules and customizable options, Odoo can be tailored to suit the unique requirements of any business.