India

ZestyBeanz Technologies Pvt Ltd 4th Floor, Nila, Technopark Thiruvananthapuram,
India – 695581
Phone: +91 471 4063254
Fax : +91 471 2700171

   .

ZestyBeanz Technologies Pvt Ltd
2987, Manikkath Cross Road
Ravipuram, Kochi, India - 682016
Phone: +91 484 4063254

  UAE

Zesty Labs
Office # 2003, Millennium Plaza Building
Sheikh Zayed Rd, Dubai, UAE
Phone: +971 4333 2222​
Mobile: +971-50-5417245​

  Germany​

ZestyBeanz Technologies GmbH
Reuterstraße 1
90408 Nürnberg
Fon: +49 911 4801 444
Fax: +49 911 4801 445

Spreadsheet/Xls report in odoo using report_xls

Contact Form


Parvathy R's picture

Spreadsheet/Xls report in odoo using report_xls

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

  1. We can define the title, header, number, date, and normal style using add_format(). For example,
                     heading_format = workbook.add_format({'align': 'left','bold': True, 'size': 14})
  2. We can add sheet to the workbook using add_worksheet() method.
            For example, work_sheet = workbook.add_worksheet(‘Payroll Sheet’)
  3. For write into the sheet,
                    For example, work_sheet.write(4,4,’Date From’,font_size)
  4. To set width of the cell,
                    For example, work_sheet.set_column('A:A', 10)
  5. To add formula,
                    For example, worksheet.write_formula(20,4, '{=SUM(C7:C19)},normal_num_bold)

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

Katharyn Alfred's picture

Hello Guys, I was searching

Hello Guys, I was searching for someplastic products manufacturers, which were truly valuable and they are doing this work with being well disposed with pockets.

keila Anise's picture

Heyyy Guys you will love

Heyyy Guys you will love these unique led pendant light manufacturer , they have the best collection of pendant lights

Katharyn Alfred's picture

hello Guys, I was Surfing for

hello Guys, I was Surfing for some Medical Appliances and I ran over these injection mold supplier, would anybody enable me to check if the item is comparable to they say?

Katharyn Alfred's picture

hello Guys, I was Surfing for

hello Guys, I was Surfing for some Medical Appliances and I ran over these injection mold supplier, would anybody enable me to check if the item is comparable to they say?