I do not know which is the right syntax for if-else in qweb.
<t t-if="origin != l.origin">
<td>foo</td>
<t t-else/>
<td>bar</td>
</t>
What is wrong here?
In every Industry, a report is an essential factor to analyze their business process efficiency. Odoo also supports Qweb reports for easy report making. This is the technical document which helps to create a report. In an XML file we can declare a report inside the ‘ <report></report>’ tag.
For making a simple pdf report in Odoo we can go through the following steps In an XML file we can declare a report inside the ‘ <report></report>’ tag. . - model:- It is a mandatory field which represents the model that the report will stand for - report_type:- Type of report. We have many types of reports - Name:- It is a mandatory field.
QWeb is the primary templating engine used by Odoo 2. It is an XML templating engine 1 and used mostly to generate HTML fragments and pages. Template directives are specified as XML attributes prefixed with t- , for instance t-if for conditionals, with elements and other attributes being rendered directly.
Most Python-side uses of QWeb are in controllers (and during HTTP requests), in which case templates stored in the database (as views) can be trivially rendered by calling openerp.http.HttpRequest.render (): This automatically creates a Response object which can be returned from the controller (or further customized to suit).
You have to use <t t-else=""><td>bar</td></t>
, take a look the documentation.
In above lines you have closed else tag <t t-else/>
You should write as following :
<t t-if="origin != l.origin">
<td>foo</td>
</t>
<t t-else="">
<td>bar</td>
</t>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With