Intro Centuries ago, real estate agents used piles of paper or whatsoever was available during those days to save business […]
Systematically Generate a Report in XLS/XLSX Format in Odoo
Many corporate organizations require XLS reports on a regular basis. Data manipulation and representation become simple with an XLS file. The XLS/XLSX reports offer several useful features, including the ability to assist users to view data. This spreadsheet file is used in a variety of ways, some of which may amaze you.
In this blog, you will learn how to create XLS & XLSX format reports in Odoo.
Follow the given steps precisely to learn something new today!
Step 1: Odoo doesn’t support XLS, XLSX reports. So you need to install third-party modules for it.
Like (Base report XLSX→ https://apps.odoo.com/apps/modules/15.0/report_xlsx/
For the Base report XLSX module, you also need to install these python packages.
a- $ pip3 install xlsxwriter
b- $ pip3 install xlrd
So, In order to generate XLSX reports we need to download a third-party module for it. After that, you get the XLSX option in report type.
Step 2: Now we need to generate the report.
2.a- Now inherit the third-party module in your module and create a report XML.
<record id= report_test_records model=”ir.actions.report”>
<field name=”name”> Name </field>
<field name=”model”> model.name </field>
<field name=”report_type”> xlsx </field<>
<field name=”report_name”> module_name.report_name </field>
<field name=”report_type”> module_name.report_name </field>
<field name=”binding_model_id”> module_name.report_name </field>
<field name=”binding_type”> report </field>
2.b- Add the report_type as XLSX.
2.c- Add the model id in binding_model_id in which you want to show that report.
2.d- Now create a python class like the structure given below.
2.e- Set the name of the class which you pass in report_name in the XML.
Ex. _name = ‘report.module_name.report_name’
2.f- Now the generate_xlsx_report method will give you the XLSX report.
By following the given steps you can successfully create XLS and XLSX reports in Odoo.
If you need Odoo customization or module development service, contact the Ksolves experts.
Get expert assistance anytime anywhere. Contact us at the given details: