[IMP] hr: display employees kanban from department

Currently on the HR employee form, clicking on the department displays the default form of the department.
Instead, it should display the kanban view of the employees who are part of the department

task-2678198

closes odoo/odoo#79339

Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
Philippe Wauthy
2021-11-18 18:00:58 +00:00
parent aba31e9f2d
commit 35b4df7389
2 changed files with 16 additions and 1 deletions
+15
View File
@@ -91,3 +91,18 @@ class Department(models.Model):
('parent_id', '=', department.manager_id.id)
])
employees.write({'parent_id': manager_id})
def get_formview_action(self, access_uid=None):
res = super().get_formview_action(access_uid=access_uid)
if (not self.user_has_groups('hr.group_hr_user') and
self.env.context.get('open_employees_kanban', False)):
res.update({
'name': self.name,
'res_model': 'hr.employee.public',
'view_type': 'kanban',
'view_mode': 'kanban',
'views': [(False, 'kanban'), (False, 'form')],
'context': {'searchpanel_default_department_id': self.id},
'res_id': False,
})
return res
+1 -1
View File
@@ -59,7 +59,7 @@
<field name="work_email" widget="email"/>
</group>
<group>
<field name="department_id"/>
<field name="department_id" context="{'open_employees_kanban': 1}"/>
<field name="employee_type"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="parent_id"/>