[FIX] hr: onchange department don't reset manager
We should avoid reseting the manager_id on the employee when there is no manager defined on the department Also updates the department form view in order to display the fields better closes odoo/odoo#37028 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
@@ -220,7 +220,8 @@ class HrEmployeePrivate(models.Model):
|
||||
|
||||
@api.onchange('department_id')
|
||||
def _onchange_department(self):
|
||||
self.parent_id = self.department_id.manager_id
|
||||
if self.department_id.manager_id:
|
||||
self.parent_id = self.department_id.manager_id
|
||||
|
||||
@api.onchange('user_id')
|
||||
def _onchange_user(self):
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<form string="department">
|
||||
<sheet>
|
||||
<widget name="web_ribbon" text="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
|
||||
<field name="active" invisible="1"/>
|
||||
<group col="4">
|
||||
<field name="active" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="manager_id"/>
|
||||
<field name="parent_id"/>
|
||||
|
||||
Reference in New Issue
Block a user