summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/chrome/action_manager_report.js
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2020-10-06 08:18:38 +0000
committerNicolas Martinelli <nim@odoo.com>2020-10-09 13:58:22 +0000
commit99fb65fa58a46ee7dcf6e91d617930005cccd154 (patch)
treea01b2f28a274d49f13d5bf0c90a7f087dad22872 /addons/web/static/src/js/chrome/action_manager_report.js
parent507295ca80e8eac9c75714f41b599d9e2e8a2549 (diff)
[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) <nim@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/chrome/action_manager_report.js')
-rw-r--r--addons/web/static/src/js/chrome/action_manager_report.js1
1 files changed, 1 insertions, 0 deletions
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));