[QWeb2] t-if, t-elseif, t-else
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Web (MOVED TO GITHUB) |
Confirmed
|
Wishlist
|
OpenERP R&D Web Team |
Bug Description
For QWeb2-templated I would like to have elseif- and else-directives instead of a couple of if-directives where each and every is evaluated to test for any combination of operands.
In base.res_
[code]
<ul>
<li t-if="record.
<li t-if="!
<li t-if="record.
<li t-if="record.
<li t-if="!
<li t-if="record.
<li t-if="record.
</ul>
[/code]
It would be more expressive and easier to manage for more complex expressions this way:
[code]
<ul>
<li t-if="record.
<t t-if="record.
<li t-elseif=
</li>
<li t-if="record.
<field name="city"/><t t-if="record.
<li t-elseif=
</li>
<li t-if="record.
</ul>
[/code]
See attachment for my proposal.
Hello Daniel,
It's really nice Amelioration, But this is not a bug but rather than it's your suggestion to Improve the code of qweb2.js for manage complex expressions.
We can also Improve this code with out change qweb2.js in following way... city.raw_ value or record. country. raw_value" > city.raw_ value and record. country. raw_value" >,</t>
<li t-if="record.
<field name="city"/>
<t t-if="record.
</t><field name="country"/>
</li>
But.......... ... ..
It's good Implementation as per the coding conventions point of view. So we can consider this is as your suggestion and considering it as a "Wishlist". and Let the team to take decision on it.
@Antoine (al) : please give look.
Thanks for the reporting!