diff options
| author | qsm-odoo <qsm@odoo.com> | 2018-09-28 14:50:18 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2018-09-30 19:55:17 +0200 |
| commit | 55131b8f5becdd3d4776f4c3e7e4288a0b185706 (patch) | |
| tree | 4eca54d0cd14a2180227ad2b155e3380d37fb9a6 /addons/web_editor/static/src/js/editor | |
| parent | feae553b98c88282695c77382f4a52c78b3f8f70 (diff) | |
[REF] website, *: add automatic context for call_kw rpc
* web_editor, website_blog, website_crm_partner_assign, website_links,
website_livechat, website_mail_channel, website_mass_mailing,
website_slides
Calling a model's method thanks to an RPC will now always send the
web_editor context automatically, making sure the method gets the
website_id all the time, removing the need to guess the current website
(now the get_current_website method uses the context website_id if any).
Note: other routes already have the website_id via request.env.context
if they correctly set website=True (this commit also adds website=True
for scss files customization routes).
Diffstat (limited to 'addons/web_editor/static/src/js/editor')
| -rw-r--r-- | addons/web_editor/static/src/js/editor/rte.js | 2 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/editor/snippets.options.js | 2 | ||||
| -rw-r--r-- | addons/web_editor/static/src/js/editor/translator.js | 8 |
3 files changed, 5 insertions, 7 deletions
diff --git a/addons/web_editor/static/src/js/editor/rte.js b/addons/web_editor/static/src/js/editor/rte.js index 11001cc7a06..8719779c079 100644 --- a/addons/web_editor/static/src/js/editor/rte.js +++ b/addons/web_editor/static/src/js/editor/rte.js @@ -573,8 +573,8 @@ var RTEWidget = Widget.extend({ $el.data('oe-id'), this._getEscapedElement($el).prop('outerHTML'), $el.data('oe-xpath') || null, - withLang ? context : _.omit(context, 'lang') ], + context: withLang ? context : _.extend({}, context, {lang: undefined}), }); }, diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index ab82d34a23b..aed0ca91a66 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -1236,7 +1236,6 @@ registry.many2one = SnippetOption.extend({ kwargs: { order: [{name: 'name', asc: false}], limit: 5, - context: weContext.get(), }, }).then(function (result) { self.$search.siblings().remove(); @@ -1275,7 +1274,6 @@ registry.many2one = SnippetOption.extend({ args: [[self.ID]], kwargs: { options: options, - context: weContext.get(), }, }).then(function (html) { $node.html(html); diff --git a/addons/web_editor/static/src/js/editor/translator.js b/addons/web_editor/static/src/js/editor/translator.js index cf9b0a0b085..c6cadb40562 100644 --- a/addons/web_editor/static/src/js/editor/translator.js +++ b/addons/web_editor/static/src/js/editor/translator.js @@ -34,12 +34,12 @@ var RTETranslatorWidget = rte.Class.extend({ method: 'save_html', args: [ [+$el.data('oe-translation-id')], - this._getEscapedElement($el).html(), - context || weContext.get() + this._getEscapedElement($el).html() ], + context: context, }).fail(function (error) { - Dialog.alert(null, error.data.message); - }); + Dialog.alert(null, error.data.message); + }); } return this._super($el, context, withLang === undefined ? true : withLang); }, |
