[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
This commit is contained in:
Arthur Detroux (ard)
2022-10-10 11:56:57 +02:00
parent 7094781d3e
commit 24527568d1
+3 -2
View File
@@ -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, {