From 99fb65fa58a46ee7dcf6e91d617930005cccd154 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 6 Oct 2020 08:18:38 +0000 Subject: [FIX] web: report controller in multi-company - Create 2 companies A & B - Set a website on company A - Switch to company B - Open a done MO - Open the cost analysis An AccessError is displayed. The error arises in: https://github.com/odoo/enterprise/blob/923cbffe4e60572a5c17ee962d571c037e9cff44/mrp_account_enterprise/reports/mrp_cost_structure.py#L90 The root cause is coming from the call to `/report/html/`, which is called without any `data`. In this situation, the following adds an incorrect `allowed_company_ids` in the context: https://github.com/odoo/odoo/blob/d1413a2f06bcb44b1fbb6dba8658e698c8da4018/addons/website/models/ir_http.py#L196-L205 Indeed, the `allowed_company_ids` is the one from the website, in this case company A. The issue doesn't occur when downloading a PDF from the interface since in this case the `data` dictionary contains the appropriate context which is set in: https://github.com/odoo/odoo/blob/d1413a2f06bcb44b1fbb6dba8658e698c8da4018/addons/web/controllers/main.py#L1958 As a solution, we add the `user_context` in the `/report/html` route. opw-2341747 closes odoo/odoo#59654 X-original-commit: 932e347a90bfd4bf025e4e8e54ef9c66cc49c5d0 Signed-off-by: Nicolas Martinelli (nim) --- addons/web/static/src/js/chrome/action_manager_report.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/web/static/src/js/chrome') diff --git a/addons/web/static/src/js/chrome/action_manager_report.js b/addons/web/static/src/js/chrome/action_manager_report.js index 61dbdbbcc96..b3c057969bd 100644 --- a/addons/web/static/src/js/chrome/action_manager_report.js +++ b/addons/web/static/src/js/chrome/action_manager_report.js @@ -189,6 +189,7 @@ ActionManager.include({ return value += activeIDsPath; }); } + reportUrls.html += '?context=' + encodeURIComponent(JSON.stringify(session.user_context)); } else { var serializedOptionsPath = '?options=' + encodeURIComponent(JSON.stringify(action.data)); serializedOptionsPath += '&context=' + encodeURIComponent(JSON.stringify(action.context)); -- cgit v1.2.3