how to make an odoo field invisible if a many2many field value is "rice"

615 views Asked by At

I am trying to make a duration character field visible 'only if' parent field called category_ids Many2Many field value "Non-Permanent" is selected. I have tried so many things but seems not working. Below is my code snippet

Model:

class hr_employee(models.Model):
    _inherit = 'hr.employee'

    identification_id = fields.Char(string="Employee No")
    duration = fields.Char(string="Duration")

View:

<!-- Employee Form View -->
<record model="ir.ui.view" id="hr_custom_form_view">
    <field name="name">hr.custom</field>
    <field name="model">hr.employee</field>
    <field name="inherit_id" ref="hr.view_employee_form"/>
    <field name="groups_id" eval="[(4, ref('base.group_hr_user'))]"/>
    <field name="arch" type="xml">

        <xpath expr="//field[@name='user_id']" position="after">
            <field name="duration"/>
        </xpath>

    </field>
</record>
0

There are 0 answers