summaryrefslogtreecommitdiff
path: root/addons/web_editor/static
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2018-10-31 14:46:54 +0000
committerqsm-odoo <qsm@odoo.com>2018-10-31 15:50:45 +0000
commit912d4c2d4195b8bbd434d7a10b03f3fcdfc71254 (patch)
treed4773f19d60ba9eb563e5a04f31decec5d7933ca /addons/web_editor/static
parentb2584e141b1d38f091f0bef2bd96698449b19522 (diff)
[FIX] web_editor: fix automatic editor context for RPCs
With https://github.com/odoo/odoo/commit/55131b8f5becdd3d4776f4c3e7e4288a0b185706, we automatically add the known editor context (containing lang, website_id, etc) when using the `this._rpc` method. Some RPCs needed however to explicitely not send a value from this automatic context... but this was not correctly implemented. This can now be achieved by using the `noContextKeys` key in the `this._rpc`'s *options* parameter. closes odoo/odoo#28322
Diffstat (limited to 'addons/web_editor/static')
-rw-r--r--addons/web_editor/static/src/js/content/body_manager.js5
-rw-r--r--addons/web_editor/static/src/js/editor/rte.js4
-rw-r--r--addons/web_editor/static/src/js/widgets/ace.js3
3 files changed, 10 insertions, 2 deletions
diff --git a/addons/web_editor/static/src/js/content/body_manager.js b/addons/web_editor/static/src/js/content/body_manager.js
index 85ace262fc5..1045e94a65a 100644
--- a/addons/web_editor/static/src/js/content/body_manager.js
+++ b/addons/web_editor/static/src/js/content/body_manager.js
@@ -44,7 +44,12 @@ var BodyManager = rootWidget.RootWidget.extend(ServiceProviderMixin, {
var route = event.data.args[0];
if (_.str.startsWith(route, '/web/dataset/call_kw/')) {
var params = event.data.args[1];
+ var options = event.data.args[2];
params.kwargs.context = _.extend({}, weContext.get(), params.kwargs.context || {});
+ if (options) {
+ params.kwargs.context = _.omit(params.kwargs.context, options.noContextKeys);
+ event.data.args[2] = _.omit(options, 'noContextKeys');
+ }
params.kwargs.context = JSON.parse(JSON.stringify(params.kwargs.context));
}
}
diff --git a/addons/web_editor/static/src/js/editor/rte.js b/addons/web_editor/static/src/js/editor/rte.js
index dfa77214c3a..bf16cc090e5 100644
--- a/addons/web_editor/static/src/js/editor/rte.js
+++ b/addons/web_editor/static/src/js/editor/rte.js
@@ -576,7 +576,9 @@ var RTEWidget = Widget.extend({
this._getEscapedElement($el).prop('outerHTML'),
$el.data('oe-xpath') || null,
],
- context: withLang ? context : _.extend({}, context, {lang: undefined}),
+ context: context,
+ }, withLang ? undefined : {
+ noContextKeys: 'lang',
});
},
diff --git a/addons/web_editor/static/src/js/widgets/ace.js b/addons/web_editor/static/src/js/widgets/ace.js
index bd5b4a9c47a..f3c47f30050 100644
--- a/addons/web_editor/static/src/js/widgets/ace.js
+++ b/addons/web_editor/static/src/js/widgets/ace.js
@@ -594,7 +594,8 @@ var ViewEditor = Widget.extend({
model: 'ir.ui.view',
method: 'write',
args: [[session.id], {arch: session.text}],
- context: _.extend({}, weContext.get(), {lang: undefined}),
+ }, {
+ noContextKeys: 'lang',
}).then(function () {
self._toggleDirtyInfo(session.id, 'xml', false);
def.resolve();