summaryrefslogtreecommitdiff
path: root/odoo/http.py
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2019-12-27 16:34:37 +0000
committerNicolas Lempereur <nle@odoo.com>2020-01-15 16:19:03 +0000
commitb2392011900825bbc0d4d5e2456cd669595e2565 (patch)
treedfdb7ffc2443b9fe22c5cedcdb4880f0745d05fe /odoo/http.py
parent4a1dfb50b7cbcd08a46c6b37f4ad2b4c4bf37e6e (diff)
[FIX] *: avoid muting res.users().context_get return
Some code modify return of res.users().context_get, but this is a cached method so this will unexpectedly affects totally unrelated code. For example, changing the company with the company switcher could add `allowed_company_ids` inside the cache, then it will be cached until the server is restarted, even if we change company again inbetween. Added test failed with: "NotImplementedError: '__setitem__' not supported on frozendict" on the line with `User = User.with_context(context)` where User already contained `allowed_company_ids` in its context. note: in this forward-port, context_get is also changed to return frozendict and prevent being able to have an unexpected issue by code that modify context_get returns. opw-2158340 closes #42465 closes odoo/odoo#42723 X-original-commit: 5d69885c1cd6921b3de00aae7e0ed6fff243ff95 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'odoo/http.py')
-rw-r--r--odoo/http.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/http.py b/odoo/http.py
index 222a2eeabb4..9962f8a47b1 100644
--- a/odoo/http.py
+++ b/odoo/http.py
@@ -1062,7 +1062,7 @@ class OpenERPSession(werkzeug.contrib.sessions.Session):
:returns: the new context
"""
assert self.uid, "The user needs to be logged-in to initialize his context"
- self.context = request.env['res.users'].context_get() or {}
+ self.context = dict(request.env['res.users'].context_get() or {})
self.context['uid'] = self.uid
self._fix_lang(self.context)
return self.context