Every report must be declared as report action. For simplicity, a shortcut <report>element is available to define a report, rather than have to set up the action and its surroundings manually.
That <report>can take the following attributes:
id - The generated record’s external id
name (mandatory) - Only useful as a description of the report when looking for one in a list of some sort
model (mandatory) - The model your report will be about
report type (mandatory) - Either qweb-pdf for PDF reports or qweb-html for HTML
report name - The name of your report (which will be the name of the PDF output)
Calling external_layout will add the default header and footer on your report. The PDF body will be the content inside the <div class="page">.The template’s id must be the name specified in the report declaration; for example laundry.iron_report.Since this is a QWeb template, you can access all the fields of the docs objects received by the template.
There are some specific variables accessible in reports, mainly:
docs - records for the current report
doc_ids - list of ids for the docs records
doc_model - a model for the doc’s records
Differing from version to version:
From the template <t t-call="web.html_container"> this can differ for the odoo versions and the methods which we use in python also gets differ from versions. For odoo 10 we use to get values of the report by method render_html, but in odoo 11 and 12 have to use get_report_values.
Likewise, from the method print_report returning action be get_action in odoo 10 and report_action used in odoo 11 and 12. These are the main things which we follow while doing the report.
Passing parameter in POS Report:
By using self.chrome.do_action call the report template and passing the parameter by a method which calls while clicking on Print button.
Passing parameter in Dashboard Report:
From this accounting dashboard, we click on label difference to get a particular journal report.
From this popup passing date parameter by method, which will be called while clicking on the Print button.