Giải pháp tốt nhất để ẩn trường, ví dụ: partner_id inẨn trường trong xpath exp odoo 9
<xpath expr=".">
<field name="partner_id" />
</xpath>
Giải pháp tốt nhất để ẩn trường, ví dụ: partner_id inẨn trường trong xpath exp odoo 9
<xpath expr=".">
<field name="partner_id" />
</xpath>
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
Đây là cách tốt nhất để ẩn bất kỳ trường nào khỏi chế độ xem.
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
Một cách khác mà bạn có thể thực hiện là
<field name="partner_id" position="replace">
<field name="partner_id" invisible="1" />
</field>
Đây chỉ là một thay thế các giải pháp trên.
Cách thay thế với nhiều chi tiết hơn để tạo trường vô hình, chỉ đọc vv cùng một lúc dựa trên điều kiện cụ thể.
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="attrs">{'invisible': [('field_name', 'Operator', Value)],
'readonly': [('field_name', 'Operator', Value)]}
</attribute>
</xpath>