コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
6338 ビュー

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! 
アバター
破棄
関連投稿 返信 ビュー 活動
1
4月 24
2320
1
8月 22
3067
0
5月 17
7725
1
3月 15
4131
2
3月 15
4676