From 352345a1af3726607df1730fca76837cb426903f Mon Sep 17 00:00:00 2001 From: "Thomas Lefebvre (thle)" Date: Thu, 20 Jul 2023 08:20:33 +0000 Subject: [PATCH] [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 Signed-off-by: Thomas Lefebvre (thle) --- addons/hr_org_chart/controllers/hr_org_chart.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/hr_org_chart/controllers/hr_org_chart.py b/addons/hr_org_chart/controllers/hr_org_chart.py index 0cf4c5ffecd..f1d48a66b24 100644 --- a/addons/hr_org_chart/controllers/hr_org_chart.py +++ b/addons/hr_org_chart/controllers/hr_org_chart.py @@ -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]