Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
6327 Переглядів

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?
Аватар
Відмінити
Найкраща відповідь

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

So using eval for float, integer and boolean is a good practice! 
Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
квіт. 24
2317
1
серп. 22
3066
0
трав. 17
7723
1
бер. 15
4129
2
бер. 15
4670