[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) <qsm@odoo.com>
This commit is contained in:
Benjamin Vray
2020-11-02 16:37:49 +00:00
committed by qsm-odoo
parent 265d8ce9d2
commit 2c21649d35
@@ -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());