How to create Qweb reports in odoo 14

Qweb is a template engine or reporting engine which can be used to create reports. Odoo uses Qweb for generating reports. Qweb provides several tools for creating a report. By using Qweb, we can manipulate the data very easily.

This blog will provide insight on how we can create a custom PDF Report in Odoo 14?

 

How Qweb Reports Work in Odoo?

1: Under report add new file named “report.xml”

In  “report.xml” add :
syntax as follws:

<report id=”<model_report_id>”
model=”<model.name>”
string=”name ”
report_type=”qweb-pdf”
name=”<module name.body template id>”
file=”<module name.body template id>”/>
</report>
In practical case:
<report id=”<estimate_order_id>”
model=”estimate.contract”
string=”Estimate Contract ”
report_type=”qweb-pdf”
name=”building_contract.building_contract_body_format”
file=”building_contract.building_contract_body_format”/>
</report>

Defining  Report Templates:

Templates are designed in an HTML format. The structure will be written inside of <template> tags. We can use other templates inside our template using t-call property.

2: You can create an xml file inside the report directory

 

Leave a Reply

Your email address will not be published.