Enable Dark Mode!
how-to-create-new-report-layouts-in-odoo-15.jpg
By: Athul K

How to Create New Report Layouts in Odoo 15

Technical Odoo 15

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="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;], &quot;no_marker&quot;: 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:

how-to-create-new-report-layouts-in-odoo-15-cybrosys

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.


If you need any assistance in odoo, we are online, please chat with us.



0
Comments



Leave a comment

 
whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

London

Cybrosys Limited
Alpha House,
100 Borough High Street, London,
SE1 1LB, United Kingdom

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message