Creating a custom report on Odoo 11 is very different from Odoo 10. That’s because on Odoo 11 doesn’t have report module like Odoo 10, and compounded by incorrect documentation on Odoo website, as can be seen in https://www.odoo.com/documentation/11.0/reference/reports.html#custom-reports.
In this tutorial, I will display the employee attendance summary (recap), and display presence and absence data for each employee. The final result of the report is as shown below.
Initial Preparation
For initial preparation, you must create a new database and tick “Load demonstration data”, so that there is preliminary data that we can use to test the code. Then install hr_attendance module, this module is a default module from Odoo. And don’t forget to make sure that the wkhtmltopdf 0.12.1 has been installed.
After installing the hr_attendance module, you can see attendance data with the following demo data is as shown below.
Create a Wizard Model
Create a wizard model that inherits from TransientModel.
Create an XML Wizard View
Create a view to display the wizard based on the wizard model above.
After creating the wizard, the result is as shown below.
Modify Wizard Model and Create New AbstractModel
Modify method get_report() in model attendance.recap.report.wizard, and create a model that inherits from AbstractModel. As you can see below.
Create an XML Template Report
Last step is to create an XML for template report as needed.
That’s it. Please check https://github.com/CakJuice/odoo11-custom-report for full code, or you can download then install the module to try.