Do you know how to check whether the field exists (is defined in model) in the report template?
For example if field xxx is defined FOO is printed:
<t t-if="test(o.xxx)">FOO</t>
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Do you know how to check whether the field exists (is defined in model) in the report template?
For example if field xxx is defined FOO is printed:
<t t-if="test(o.xxx)">FOO</t>
I found the answer:
<t t-if="'xxx' in o">FOO</t>
Update, or:
<t t-if='o.get("xxx")'>FOO</t>
You can write, also this,
<t t-if="o.xxx">
FOO
</t>
This is not a good solution, if filed xxx not exists in model cause the error: ... object has no attribute 'xxx'" while evaluating.
You are right, I misunderstood the question.. I forgot to notice "field exists (is defined in model)".
Crie uma conta hoje mesmo para aproveitar os recursos exclusivos e interagir com nossa incrível comunidade!
Inscreva-sePublicações relacionadas | Respostas | Visualizações | Atividade | |
---|---|---|---|---|
|
0
mar. 24
|
3187 | ||
|
3
out. 16
|
6882 | ||
|
1
dez. 23
|
26860 | ||
|
1
mar. 15
|
7776 | ||
|
3
set. 24
|
46648 |