[FIX] hr_org_chart: use context in kwargs

Steps to reproduce:
-------------------
- being in a multi-company context;
- select a company that is not the user's default company;
- add a manager to an employee;

Issue:
------
We don't see the organization chart.

Cause:
------
There is no "allowed_company_ids" key
in the context of the rpc call.

Solution:
---------
If a context is passed explicitly
in the call rpc kwargs, it must be used.
Otherwise, use the default context of call rpc.

opw-3422642

closes odoo/odoo#129233

X-original-commit: 32353bcf94fa4f7378f61c22664267e1e8a34a1f
Signed-off-by: Kevin Baptiste <kba@odoo.com>
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
This commit is contained in:
Thomas Lefebvre (thle)
2023-07-24 08:58:19 +02:00
parent 1c7b6f4020
commit 352345a1af
@@ -14,8 +14,9 @@ class HrOrgChartController(http.Controller):
return None
employee_id = int(employee_id)
if 'allowed_company_ids' in request.env.context:
cids = request.env.context['allowed_company_ids']
context = kw.get('context', request.env.context)
if 'allowed_company_ids' in context:
cids = context['allowed_company_ids']
else:
cids = [request.env.company.id]