Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
6325 มุมมอง

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 ตอบกลับ มุมมอง กิจกรรม
Data for relations table แก้ไขแล้ว
1
เม.ย. 24
2317
1
ส.ค. 22
3066
0
พ.ค. 17
7722
1
มี.ค. 15
4128
2
มี.ค. 15
4669