Spreadsheet displays multiple cells usually in a two-dimensional matrix or grid consisting of rows and columns. We have so many reporting softwares that will simply create spreadsheets. But the problem is, these reporting softwares may not support on all systems and also take lot of CPU time.
XLS reports are often necessary for many business organizations. Data representation and manipulation can be done in XLS file very easily. By default, Odoo doesn’t support XLS file creation of a report. This blog will help you to generate XLS report with wizard using an extra module report_xls and you can download it from here: XLSX Report
Here is the simple code introduction for create the spreadsheet
Now move on to the code
Here we are going to create an XLS report from a wizard. Wizard can be used to enter the data and based on this data we can filter the report. In this wizard, we will add some fields to filter the content of the report. So let us first look how the wizard is created.
Wizard Creation
Python file:
This is the python file created for the wizard. Here the fields start_date, end_date are filtration fields.
XML File:
This is the code for view of the wizard . In this view, the user can enter values for start date and end date. After entering the values, the user can click the ‘Print Report’ button to print the ‘Xls’ report.
Simple xls Report
For making a simple xls report in Odoo, we can go through the following steps
– Declaring a report action
– Defining a report
Declare a report action
In an XML file we can declare a report inside the ‘ <report></report>’ tag.
– Id:- Represents the report’s external id
– string:- Represents the Report
– model:- It is a mandatory field which represents the model that the report will stand for
– report_type:- Type of report.
– Name:- It is a mandatory field. It is useful for description of the report when looking for one in a list of some sort.
– File:- File Name
Defining a report
We can define a simple report as follow.
In the above code, we have to write the last line properly. It should be like this
Classname(‘report.module_name.report_name.xlsx’, ‘model_name’)
Final output of report is given below
velez.cu: I follow yours steps, but when I press button "Print Report" I got this error Tipo de informe desconocido: xlsx: (, NotImplementedError(u'Tipo de informe desconocido: xlsx',), ) Unknown report type: xlsx: (, NotImplementedError(u'Unknown report type: xlsx',), )".
Leave a Reply