how-to-create-a-customized-purchase-order-report-in-odoo-18

How to Create a Customized Purchase Order Report in Odoo 18?

Why Customize Purchase Order Reports?

Creating a customized Purchase Order report in Odoo 18 isn’t just about changing the look of your documents. It’s about changing your procurement process into something more innovative, sharper, and custom-made for your business. Whether you’re a procurement officer, developer, or business owner, having the ability to generate reports that reflect your unique workflows, data points, and branding can provide a competitive edge.

Odoo is a powerful open-source ERP system that allows businesses to manage all their operations in one place. One of its strengths is its customizable reporting engine, especially for documents like invoices, sales orders, and purchase orders. 

In this guide, we’ll walk you through creating a customized Purchase Order report in Odoo 18, giving you the tools to extract insights, simplify communication, and enhance professional presentation while harnessing the power and flexibility of Odoo’s backend architecture. Let’s dive in and turn your purchase data into a strong business asset.

What is a QWeb Report?

QWeb is Odoo’s templating engine for rendering reports. It allows you to write XML-based templates that dynamically insert data from Odoo models. QWeb reports are often used for PDF outputs like invoices and purchase orders.

Basic Report Architecture

An Odoo report consists of:

  • A QWeb template (XML)
  • A paper format record
  • A report action record
  • Optional Python helper functions (for complex logic)

Folder Structure for Custom Report

A typical folder structure looks like this:

				
					my_module/
├── report/
│ ├── report_purchase_order.xml
│ └── report_templates.xml
├── views/
│ └── report_menus.xml
├── __manifest__.py

				
			

Creating the Template

The report’s core is the XML template, which defines how the data is displayed. Here is a working template:

				
					 



<div class="header">
<div style="text-align: right;position: relative;top: -10px;margin-right: 30px">

<img style="max-height: 110px;max-width: 50%" alt="Logo" />

</div>
<div class="page">


<div style="width: 270px;text-align: center;border: 1px solid #B2B2B2;padding: 8px;background-color: #d0d0d0;padding: 2px">
<b style="margin: 0;font-size: 22px;font-weight: 900">PURCHASE ORDER</b>
</div>

<table style="width: 100%;margin-left: auto;margin-right: auto;border-collapse: collapse;margin-top: 10px">
<thead>
<tr>
<th><strong>No</strong></th>
<th><strong>Part Number</strong></th>
<th><strong>Description</strong></th>
<th><strong>Qty</strong></th>
<th><strong>Unit Price</strong></th>
<th><strong>Discount Amount</strong></th>
<th><strong>VAT 5% Amount</strong></th>
<th><strong>Amount</strong></th>
</tr>
</thead>





<tbody style="text-align:center">
<tr>
<td></td>
<td><span /></td>
<td><span /></td>
<td></td>
<td><span /></td>
<td><span /></td>
<td></td>
<td></td>
</tr>
</tbody>

</table>

<div class="footer" style="text-align: center;margin-top: 20px;font-size: 12px;line-height: 1.5">
<strong>
<span />
</strong>
<br />


</strong>
</div>
</div>
</div>





				
			

Paper Format XML

This defines the layout properties like page size and margins:

				
					


 Paper Format

A4
Portrait
115
25
5
5

100




				
			

Report Action XML

This links the model and template to create the report:

				
					


Purchase Order
purchase.order
qweb-html
my_module.report_purchase_order
my_module.report_purchase_order

report





				
			

Explanation of Key Parts

Section

What it does

<t t-call=”web.basic_layout”>

Inherits base PDF layout used in Odoo reports

<t t-foreach=”docs” t-as=”doc”>

Loops through purchase orders (usually one per report)

image_data_uri(…)

Embeds the company logo as base64-encoded image

t-field and t-esc

Outputs fields (with or without formatting)

Footer section

Dynamically renders company contact information

Benefits of Custom Purchase Order Reports in Odoo

Brand Consistency: Add your logo, layout, and business info for a professional appearance.

Clarity & Precision: Only show the most relevant information for stakeholders.

Flexibility: Easily modify templates as your business evolves.

Better Communication: Improve understanding between departments, vendors, and finance.
Data Insight: Use customized fields to analyze and audit purchasing trends.

Make Your Reports Work for You

  • The report is fully dynamic and supports multi-company.
  • You can add more fields, conditions, or sections based on business needs.
  • Odoo’s templating allows using Python-like expressions inside XML with ease.
  • You can replace the basic_layout with custom layouts for more control.
Picture of Ashna George

Ashna George

I am Ashna George, a Python and Odoo Developer specializing in developing and customizing Odoo modules. I focus on building efficient, user-friendly ERP solutions using Python, XML, and QWeb.

Get a free quote