summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorBenjamin Vray <bvr@odoo.com>2020-10-27 11:45:35 +0000
committerqsm-odoo <qsm@odoo.com>2020-11-02 14:36:32 +0000
commit904af21214a5a6924ec80b5690a523819aaec5f1 (patch)
tree59c1155be16f9fae7bf2117393d1f1d3d0610aa2 /addons/web_editor/static/src/js
parent7676fc069d8b6458d0fc1f8eafe087ce553743f0 (diff)
[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#60816 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.options.js7
1 files changed, 7 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 d117df5e49a..652a05571cd 100644
--- a/addons/web_editor/static/src/js/editor/snippets.options.js
+++ b/addons/web_editor/static/src/js/editor/snippets.options.js
@@ -264,6 +264,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());