summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorBenoit Socias <bso@odoo.com>2020-11-27 15:42:23 +0000
committerBenoit Socias <bso@odoo.com>2020-12-09 12:24:26 +0000
commit4de0519d5b54634604e22b32d91a099695378088 (patch)
tree727827ed629c714cb11aacd0897e6e61d1686aca /addons/web_editor/static/src
parentb5e186124de69061e91f657e1a330ba019614256 (diff)
[FIX] web_editor, test_website: will fix the deletion of custom snippets
Before this commit the deletion of custom snippets failed because the button click event got intercepted by the drag'n'drop mechanism. The currentTarget of the event was used in an asynchronous call where it had already been replaced by the jQuery's event bubbling mechanism when invoking the other handler. After this commit the deletion of custom snippets works again and a test tour is introduced to make sure it does not get broken again task-2405854 closes odoo/odoo#62555 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.editor.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js
index 5e25ecd32a7..391310b57b1 100644
--- a/addons/web_editor/static/src/js/editor/snippets.editor.js
+++ b/addons/web_editor/static/src/js/editor/snippets.editor.js
@@ -2369,6 +2369,8 @@ var SnippetsMenu = Widget.extend({
*/
_onDeleteBtnClick: function (ev) {
const $snippet = $(ev.target).closest('.oe_snippet');
+ const snippetId = parseInt(ev.currentTarget.dataset.snippetId);
+ ev.stopPropagation();
new Dialog(this, {
size: 'medium',
title: _t('Confirmation'),
@@ -2382,7 +2384,7 @@ var SnippetsMenu = Widget.extend({
model: 'ir.ui.view',
method: 'delete_snippet',
kwargs: {
- 'view_id': parseInt(ev.currentTarget.dataset.snippetId),
+ 'view_id': snippetId,
'template_key': this.options.snippets,
},
});