Pointer
Pointer

Reputation: 2186

Hide field in xpath exp odoo 9

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

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

Upvotes: 5

Views: 1830

Answers (4)

Bhavesh Odedra
Bhavesh Odedra

Reputation: 11141

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>

Upvotes: 2

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.

Upvotes: 1

sfx
sfx

Reputation: 1841

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>

Upvotes: 4

user_odoo
user_odoo

Reputation: 2358

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

Upvotes: 6

Related Questions