[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:
@@ -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
|
||||
|
||||
@@ -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"/>
|
||||
|
||||
Reference in New Issue
Block a user