By: Niyas Raphy

How to Create a XLS Report in Odoo ?

Technical Odoo 8 Odoo 10

XLS reports are often necessary for many business organizations. Data representation and manipulation can be done in XLS file very easily. In this blog, we will be discussing ‘how to create XLs report in Odoo.’ You know by default Odoo doesn’t’ support  XLS file creation of a report. So you an extra module ‘report_xls’ and you can download it from here: XLSX Report 


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 the 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:

class CrmReport(models.TransientModel):
    _name = ''
    sales_person = fields.Many2one('res.users', string="Sales Person")
    start_date = fields.Date('Start Date')
    end_date = fields.Date('End Date',
    def print_xls_report(self, cr, uid, ids, context=None):
        data =, uid, ids)[0]
        return {'type': '',
                'report_name': 'crm_won_lost_report.report_crm_won_lost_report.xlsx',
                'datas': data

This is the python file created for the wizard. Here the fields start_date, end_date, and sales_person are filtration fields. The data in the wizard can be filtered according to the value in the fields


XML File:

Wizard view:

<record id="view_crm_won_lost_report" model="ir.ui.view">
    <field name="name">CRM Report</field>
    <field name="model"></field>
    <field name="arch" type="xml">
        <form string="Choose your details">
                     <field name="sales_person"  style="width: 40%%" />
                    <field name="start_date" />
                    <field name="end_date" />
                <button name="print_xls_report" string="Print Report" type="object"  class="oe_highlight"  />
                <button string="Cancel" class="oe_link" special="cancel" groups="base.group_sale_manager"/>

This is the code for the view of the wizard (or the design of the wizard). In this view, the user can enter the filter details such as date and the salesperson. After selecting the required fields, the user can click the ‘print report’ button to print the ‘Xls’ report. When the user clicks the print button, the call goes to ‘print_xls_report’ function defined in the given model


defprint_xls_report(self,cr, uid,ids, context=None):
    rec = self.browse(data)     data = {}     data['form'] =['sales_person', 'start_date', 'end_date'])     return self.env['report'].get_action(rec, 'crm_won_lost_report.report_crm_won_lost_report.xlsx',     data=data)

 In the next step, we have to define the report in the name ‘report_crm_won_lost_report’ import ReportXlsx
class CrmReportWonLost(ReportXlsx):
    defgenerate_xlsx_report(self,workbook, data,lines):
        #We can recieve the data entered in the wizard here as data
        sheet= workbook.add_worksheet()
CrmReportWonLost('report.crm_won_lost_report.report_crm_won_lost_report.xlsx', '')

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')


Now we can load the report to the database.  For that, we have to add a report tag in XML,


This is developed in the version 9. You can follow similar steps in v8 and in v10. According to the version, we have to change the version of the ‘report_xlsx’. It can be downloaded from Odoo apps.


We already have uploaded a module using above code in the app store, you can check and use it for reference along with this blog.

cybrosys youtube



Jesus pozzo

25/09/2018 - 2:09PM

how to upload the report to the database ?????

Jesus pozzo

25/09/2018 - 1:59PM

in what file should I place this CrmReportWonLos class? I do not understand well what is this class


25/07/2018 - 7:00AM

Why there are two function with the same name print_xls_report ? i didn't understand can you explain why ? where i put the first and the second one


24/04/2018 - 9:23AM

hi i can't receive data from wizard can you give me an exemple? thanks in advance.

Hoang Quan

18/08/2019 - 8:22PM

return self.env['report'].get_action(rec, 'crm_won_lost_report.report_crm_won_lost_report.xlsx', where is model 'report' ? it's not for free ?

????? ???

14/11/2017 - 5:04PM

What's up,I log on to your blogs named "How to Create a XLS Report in Odoo ?" on a regular basis.Your story-telling style is awesome, keep up the good work! And you can look our website about ????? ???.


02/07/2019 - 10:08PM

I want to develop it on odoo 12

Niyas Raphy

01/05/2018 - 9:00PM

Hi Abdessamad, In the function generate_xlsx_report, you can receive the data from the wizard in the data

Leave a comment


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


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


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


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

Send Us A Message