I know, it is not a bug and the wishlist is what I have expected.
Currently I am "playing around" with partners, crm and the new great web-client. I wanted to have different avatars for non-company-partners of type 'contact' and other non-company-partners (a human head next to a delivery address looks somehow wrong) in the kanaban-view.
As you can see there are two forms to use this directives:
1.
<div t-if>
"if-content"
<div t-elseif/>
"elseif-content"
<div t-else/>
"else-content"
</t-if>
Both are compiled to something like that
if (cond) {
r.push('<div>"if content"</div>')
} else if (cond) {
r.push('<div>"elseif- content"</div>')
} else {
r.push('<div>"else- content"</div>')
}
It might be confusing for a reviewer if both forms are mixed within one if-elseif-else-compound.
In the second form content between the last closing </t> and the closing </t-if> is appended to the else-content.
Solution 1: Well documentation and responsibility of the developer who designs the view.
Solution 2: QWeb2 raises an exception on malformed usage (first form only for non-t-tags second form only for t-tags; strip whitespaces between <elseif>, <else> and the closing </t>, fail on other content).
If the team likes this extensions and wants me to do this I would would work on solution 2.
Hello Amit,
thank you for you comment.
I know, it is not a bug and the wishlist is what I have expected.
Currently I am "playing around" with partners, crm and the new great web-client. I wanted to have different avatars for non-company- partners of type 'contact' and other non-company- partners (a human head next to a delivery address looks somehow wrong) in the kanaban-view.
Following the whole thing: partner_ kanban" model="ir.ui.view"> res_partner_ kanban_ view" /> >res.partner. kanban. names</ field> >res.partner< /field> kanban/ field[1] " position="after"> kanban/ templates/ /a[@type= 'open'] [1]/t[2] /t[2]/img" position="replace"> has_image. raw_value === true"> "kanban_ image(' res.partner' , 'image_small', record.id.value)" class=" oe_kanban_ image"/ > "record. is_company. raw_value === true" t-att-src='_s + "/base/ static/ src/img/ company_ image.png" ' class=" oe_kanban_ image"/ > "record. type.raw_ value === 'contact'" t-att-src='_s + "/base/ static/ src/img/ avatar. png"' class=" oe_kanban_ image"/ > static/ src/img/ icon.png" ' class=" oe_kanban_ image"/ > kanban/ templates/ /ul" position="replace"> parent_ id.raw_ value"> function. raw_value" ><field name="function"/> <i>at</i> </t><field name="parent_id"/> "record. function. raw_value" ><field name="function" /></li> city.raw_ value"> country_ id.raw_ value"> , <field name="country_ id"/></ t> "record. country_ id.raw_ value"> <field name="country_ id"/></ li> email.raw_ value"> <a t-attf- href="mailto: #{record. email.raw_ value}" ><field name="email" /></a>< /li>
[code]
<record id="view_
<field name="inherit_id" ref="base.
<field name="name"
<field name="model"
<field name="arch" type="xml">
<data>
<xpath expr="/
<field name="type"/>
</xpath>
<xpath expr="/
<a type="open">
<t t-if="record.
<img t-att-src=
<img t-elseif=
<img t-elseif=
<img t-else="" t-att-src='_s + "/base/
</t>
</a>
</xpath>
<xpath expr="/
<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>
</xpath>
</data>
</field>
</record>
[/code]
As you can see there are two forms to use this directives:
1.
<div t-if>
"if-content"
<div t-elseif/>
"elseif-content"
<div t-else/>
"else-content"
</t-if>
2. "if-content" </div> "elseif- content" </div> "else-content" </div>
<t t-if>
<div>
<t t-elseif>
<div>
</t>
<t t-else>
<div>
</t>
</t-if>
Both are compiled to something like that '<div>" elseif- content"</div>') '<div>" else- content"</div>')
if (cond) {
r.push('<div>"if content"</div>')
} else if (cond) {
r.push(
} else {
r.push(
}
It might be confusing for a reviewer if both forms are mixed within one if-elseif- else-compound.
In the second form content between the last closing </t> and the closing </t-if> is appended to the else-content.
Solution 1: Well documentation and responsibility of the developer who designs the view.
Solution 2: QWeb2 raises an exception on malformed usage (first form only for non-t-tags second form only for t-tags; strip whitespaces between <elseif>, <else> and the closing </t>, fail on other content).
If the team likes this extensions and wants me to do this I would would work on solution 2.