Skip to Content
Menu
This question has been flagged
1 Reply
842 Views
  • <record id="hr_employee_view_form_inherit" model="ir.ui.view">
    <field name="name">hr.employee.view.form.inherit</field>
    <field name="model">hr.employee</field>
    <field name="inherit_id" ref="hr.view_employee_form"/>
    <field name="arch" type="xml">
    <xpath expr="//sheet//notebook//page[@name='hr_settings']" position="after">
    <page name="test" string="test" groups="hr.group_hr_user"
    attrs="{'invisible': [('department_id.name', '!=', 'Sales')]}">
    <group>
    <field name="test_value"/>
    </group>
    </page>
    </xpath>
    </field>
    </record>
Avatar
Discard
Author Best Answer

I solved it by defining a boolean feild

is_sale = fields.Boolean(string="is sales", compute='_is_sale_person')

@api.onchange('department_id')
def _is_sale_person(self):
if self.department_id.name.__eq__('Sales Dept'):
self.is_sale = True
print(self.is_sale)
else:
self.is_sale = False
print(self.is_sale)
and add this to page tage
attrs="{'invisible': [('is_sale', '=', False)]}">
Avatar
Discard