Skip to content
Snippets Groups Projects
Commit 53f9359d authored by Kevin Baptiste's avatar Kevin Baptiste
Browse files

[FIX] hr_org_chart: don't loop when own manager


When an employee was their own manager, the org chart would be filled
with their own name.

task-3093917

closes odoo/odoo#107402

Signed-off-by: default avatarYannick Tivisse (yti) <yti@odoo.com>
parent 7a63cfa8
Branches
Tags
No related merge requests found
......@@ -61,7 +61,7 @@ class HrOrgChartController(http.Controller):
# compute employee data for org chart
ancestors, current = request.env['hr.employee.public'].sudo(), employee.sudo()
while current.parent_id and len(ancestors) < self._managers_level+1:
while current.parent_id and len(ancestors) < self._managers_level+1 and current != current.parent_id:
ancestors += current.parent_id
current = current.parent_id
......@@ -73,7 +73,7 @@ class HrOrgChartController(http.Controller):
if idx < self._managers_level
],
managers_more=len(ancestors) > self._managers_level,
children=[self._prepare_employee_data(child) for child in employee.child_ids],
children=[self._prepare_employee_data(child) for child in employee.child_ids if child != employee],
)
values['managers'].reverse()
return values
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment