5
votes

What is the best solution to hide field eg. partner_id in

<xpath expr=".">
        <field name="partner_id" />
</xpath>
4

4 Answers

6
votes
<xpath expr="//field[@name='partner_id']" position="attributes">
       <attribute name="invisible">1</attribute>
</xpath>
4
votes

This is the best way of hiding any field from the view.

<xpath expr="//field[@name='partner_id']" position="attributes">
    <attribute name="invisible">1</attribute>
</xpath>
2
votes

Alternative way with more details to make field invisible, readonly etc at once based on specific condition.

<xpath expr="//field[@name='partner_id']" position="attributes">
    <attribute name="attrs">{'invisible': [('field_name', 'Operator', Value)], 
                             'readonly': [('field_name', 'Operator', Value)]}
    </attribute>
</xpath>
1
votes

Another way which you can implement is

<field name="partner_id" position="replace">
    <field name="partner_id" invisible="1" />
</field>

This is just an alternate of above solutions.