From 24527568d1fea455ea3515b3ab75b92cee9fcd11 Mon Sep 17 00:00:00 2001 From: "Arthur Detroux (ard)" Date: Tue, 4 Oct 2022 13:43:59 +0000 Subject: [PATCH] [FIX] web: do not override params context keys with user_context in RPCs Commit [1] added back the user context to every RPC called from the legacy env when it's mapped to the WowlEnv but in doing so, overrode the params' context keys. This is incorrect as the params could very well have context params that are different from the session's params for a reason. For example, in master, after [2], editing the menus of a website displayed in a language different from the user's will lead to incorrect languages in the context when the page is saved. This is cause the language in which the page is edited is passed as a context param, and the language of the user is in the session (under the same `lang` key). [1]: https://github.com/odoo/odoo/commit/d959638e23a92cf880049a760c42da33e5908f41 [2]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b X-original-commit: 8cdb2293f294558c3bea4ed59a49e0f52b3d217e Part-of: odoo/odoo#102799 --- addons/web/static/src/legacy/utils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/legacy/utils.js b/addons/web/static/src/legacy/utils.js index 47e50561453..248430848a8 100644 --- a/addons/web/static/src/legacy/utils.js +++ b/addons/web/static/src/legacy/utils.js @@ -156,8 +156,9 @@ export function mapLegacyEnvToWowlEnv(legacyEnv, wowlEnv) { // Add user context in kwargs if there are kwargs if (params && params.kwargs) { params.kwargs.context = Object.assign( - params.kwargs.context || {}, - legacyEnv.session.user_context + {}, + legacyEnv.session.user_context, + params.kwargs.context, ); } const jsonrpc = wowlEnv.services.rpc(route, params, {