From 11907c17bb3055242e5889d7b7ec6f055d14ea46 Mon Sep 17 00:00:00 2001 From: Author Name Date: Mon, 23 Mar 2020 16:14:37 +0000 Subject: [PATCH] [FIX] website_event: event registration in edit mode The event registration form is made up of a public widget that instantiates an internal normal widget. All public widget are automatically destroyed when entering in edit mode as well as the widget it created. Therefore, it's main element is removed from the DOM when the widget is destroyed. Here, we're detaching the main element from the internal widget before the widget is destroyed so that we avoid to destroy his main element from the DOM when entering in edit mode. task-2210733 closes odoo/odoo#52426 X-original-commit: d515e4233a009250f41e8a1c1b02235685a69532 Signed-off-by: Quentin Smetz (qsm) --- addons/website_event/static/src/js/website_event.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/website_event/static/src/js/website_event.js b/addons/website_event/static/src/js/website_event.js index 36c0f5df526..527d954c524 100644 --- a/addons/website_event/static/src/js/website_event.js +++ b/addons/website_event/static/src/js/website_event.js @@ -77,8 +77,16 @@ publicWidget.registry.EventRegistrationFormInstance = publicWidget.Widget.extend */ start: function () { var def = this._super.apply(this, arguments); - var instance = new EventRegistrationForm(this); - return Promise.all([def, instance.attachTo(this.$el)]); + this.instance = new EventRegistrationForm(this); + return Promise.all([def, this.instance.attachTo(this.$el)]); + }, + /** + * @override + */ + destroy: function () { + this.instance.setElement(null); + this._super.apply(this, arguments); + this.instance.setElement(this.$el); }, });