diff options
| author | Benoit Socias <bso@odoo.com> | 2021-01-22 11:45:27 +0000 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2021-01-22 14:53:30 +0000 |
| commit | 42e0f9112404541d1c11ba35e7a3d9bcb939f73b (patch) | |
| tree | e9cdcada30f469c488a68c74f9ece93c11613706 /addons/web_editor/static/src | |
| parent | 94f919e00e6da2dab6512732f51f5291952d405f (diff) | |
[FIX] web_editor: save custom snippets per website
Before this commit the custom snippets were saved across websites
because the RPC mechanism used by the save & reload does not include the
context by default.
After this commit the custom snippets are saved for the specific website
as initially intended.
No migration is needed: already created snippets that have been created
across all sites will have the correct lifecycle because of the
copy-on-unlink system: trying to delete one will make it specific on
other websites.
Related to task-2374802
closes odoo/odoo#64917
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src')
| -rw-r--r-- | addons/web_editor/static/src/js/editor/snippets.options.js | 5 |
1 files changed, 5 insertions, 0 deletions
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 1caa65c2d90..d3365f607ef 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -4706,6 +4706,10 @@ registry.SnippetSave = SnippetOptionWidget.extend({ key: snippetKey, onSuccess: url => thumbnailURL = url, }); + let context; + this.trigger_up('context_get', { + callback: ctx => context = ctx, + }); this.trigger_up('request_save', { reloadEditor: true, onSuccess: async () => { @@ -4725,6 +4729,7 @@ registry.SnippetSave = SnippetOptionWidget.extend({ 'template_key': this.options.snippets, 'snippet_key': snippetKey, 'thumbnail_url': thumbnailURL, + 'context': context, }, }); }, |
