[FIX] hr_org_chart: Fix traceback on employee creation

While creating employee and selecting a company other than the current company,
saving record shows a traceback.

Currently xml template expects managers and children key returned from
/get_org_chart controller but /get_org_chart was returning blank dict, and which
is used as qweb context to render template.

Return {'managers': [], 'children': []} if _check_employee returns False

task-2000269
This commit is contained in:
Shreya Modi
2019-06-25 08:04:08 +00:00
committed by Yannick Tivisse
parent ccf4fc244a
commit e092060dfe
@@ -53,7 +53,10 @@ class HrOrgChartController(http.Controller):
employee = self._check_employee(employee_id, **kw)
if not employee: # to check
return {}
return {
'managers': [],
'children': [],
}
# compute employee data for org chart
ancestors, current = request.env['hr.employee.public'].sudo(), employee.sudo()