diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2019-12-27 16:34:37 +0000 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2020-01-15 16:19:03 +0000 |
| commit | b2392011900825bbc0d4d5e2456cd669595e2565 (patch) | |
| tree | dfdb7ffc2443b9fe22c5cedcdb4880f0745d05fe /odoo/tests | |
| parent | 4a1dfb50b7cbcd08a46c6b37f4ad2b4c4bf37e6e (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/tests')
| -rw-r--r-- | odoo/tests/common.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/tests/common.py b/odoo/tests/common.py index f6eec4d2a9a..3539e067d97 100644 --- a/odoo/tests/common.py +++ b/odoo/tests/common.py @@ -1133,7 +1133,7 @@ class HttpCase(TransactionCase): session.uid = uid session.login = user session.session_token = uid and security.compute_session_token(session, env) - session.context = env['res.users'].context_get() or {} + session.context = dict(env['res.users'].context_get() or {}) session.context['uid'] = uid session._fix_lang(session.context) |
