Every organization wants to know its progress and needs to present growth in front of the board and authorities. This is where reports are useful. Odoo offers a variety of reports including PDFs, pivots, and graphical representations.
For custom modules, you can also customize the report. Similar to regular Odoo views, reports are written using HTML / QWeb. Report actions and report templates are used to generate reports for the actions you want to use.
Odoo has a standard layout. Like a web.external_layout. web.internal_layout etc
You can also create new report layouts with custom reports. This blog helps you to create a new report layout.
To create a new external custom layout we need to create a template.
Add the XML file to the views or reports directory.
<template id="custom_report_external_layout">
<t t-call="web.html_container">
<t t-if="not o" t-set="o" t-value="docs" />
<t t-set="company" t-value="company_id" />
<div class="header">
<div style="border-top: 1px solid black;">
<img t-if="o.company_id.logo" t-att-src="image_data_uri(o.company_id.logo)" alt="Company Logo" class="float-left" />
<div style="font-size:14px;text-align:right;" class="float-right">
<div>
<strong t-field="o.company_id.partner_id.name" />
<span t-field="o.company_id.partner_id" t-options="{"widget": "contact", "fields": ["address"], "no_marker": true}" />
<span t-field="o.company_id.partner_id.website" />
</div>
</div>
</div>
</div>
<div class="footer">
<div class="text-center" style="border-top: 1px solid black;">
<ul class="list-inline">
<li t-if="o.company_id.phone">E-mail: <span t-field="o.company_id.email" />
</li>
</ul>
</div>
</div>
</t>
</template>
In the above template, I have added the company logo, company name, and website in the report header. and company email in the footer.
All the information you need is available in the doc. We can pass more information from Python to the template if needed.
Here I have created a custom template with the name ‘custom_report_external_layout’.
You can create multiple custom templates and call them on the report as needed.
The report looks like this:
In conclusion, Report is an easy method for analyzing big data. For efficient analysis, we need simple and structured layouts for our reports. You can customize your report Layout as per needs.