Technaureus Info Solutions Pvt. Ltd.April 30, 2024
Odoo ERP system is enterprise resource planning software used company wide for the management of business processes. Odoo provides seamlessly integrated functional business apps called Odoo apps that form an ERP solution when combined.
Likewise, a common business requirement is the ability to create documents to send to customers and to use internally. These reports can be used to summarise and display information in an organised template to support the business in different ways.
Now let’s look how to customize pdf report in Odoo 17 Invoice module.
Inherit account.move model
class AccountMove(models.Model):
_inherit = "account.move"
Next, we need to create an XML file for adding the report action.
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="action_report_account_move" model="ir.actions.report">
<field name="name">Invoice Report</field>
<field name="model">account.move</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">custom_report.report_invoice </field>
<field name="report_file">custom_report.report_invoice</field>
<field name="binding_model_id" ref="invoice.model_account_move"/>
<field name="binding_type">report</field>
</record>
</odoo>
Next, we need to define a template for the qweb-pdf with id report_invoice
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id=" report_invoice ">
<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>Invoice Report</h2>
<table>
<tr>
<td><span t-field="o.partner_id"/></td>
<td><span t-field="o.invoice_date"/></td>
<td><span t-field="o.product_id"/></td>
<td><span t-field="o.price_unit"/></td>
</tr>
</table>
</div>
</t>
</t>
</t>
</template>
</odoo>
This is how we can customize pdf reports in Odoo 17
0