From 2c21649d357262be49aee9fe7554b031babecfce Mon Sep 17 00:00:00 2001 From: Benjamin Vray Date: Tue, 27 Oct 2020 11:45:35 +0000 Subject: [PATCH] [FIX] web_editor: avoid traceback on form inputs double-clicks Before this commit, double clicking on the border or on the padding of a form input generated a traceback. task-2312878 closes odoo/odoo#61201 X-original-commit: 904af21214a5a6924ec80b5690a523819aaec5f1 Signed-off-by: Quentin Smetz (qsm) --- addons/web_editor/static/src/js/editor/snippets.options.js | 7 +++++++ 1 file changed, 7 insertions(+) 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 79719a04287..50e6201634e 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -279,6 +279,13 @@ const UserValueWidget = Widget.extend({ * Closes the widget (only meaningful for widgets that can be closed). */ close: function () { + if (!this.el) { + // In case the method is called while the widget is not fully + // initialized yet. No need to prevent that case: asking a non + // initialized widget to close itself should just not be a problem + // and just be ignored. + return; + } this.trigger_up('user_value_widget_closing'); this.el.classList.remove('o_we_widget_opened'); this._userValueWidgets.forEach(widget => widget.close());