Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
6350 Widoki

What is the best practice on using eval on values for integers, bools etc in xml record data files? I see it both used and not in the odoo source code

Example:

<record id="foo_bar" model="foo.bar">
<field name="test">True</field>
<field name="number">1</field>
</record>

vs
<record id="foo_bar" model="foo.bar">
<field name="test" eval="True"/>
<field name="number" eval="1"/>
</record>

Bonus question: If you don't use eval, does Odoo auto evaluate the value?
Awatar
Odrzuć
Najlepsza odpowiedź

Normally, content inside <field> tags are always evaluated as strings.

So using eval for float, integer and boolean is a good practice! 
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
kwi 24
2325
1
sie 22
3074
0
maj 17
7731
1
mar 15
4149
2
mar 15
4681