From 8d34ada28234cc5e87aee72e268087e1bb09cad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 11 Feb 2015 12:15:51 +0100 Subject: [PATCH] [FIX] web: prevent crash after searchview is destroyed The method view_loaded could be called after the searchview was destroyed, which is not really a good idea. As a side effect, this fixes a crash when a form view with a one2many switch to edit view, then discards the changes. --- addons/web/static/src/js/search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 04eebc2c0a1..4d47dc4d788 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -410,7 +410,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea this.$('.oe_searchview_unfold_drawer') .toggleClass('fa-caret-down', !this.visible_filters) .toggleClass('fa-caret-up', this.visible_filters); - return this.alive($.when(this._super(), load_view.then(this.view_loaded.bind(this)))); + return this.alive($.when(this._super(), this.alive(load_view).then(this.view_loaded.bind(this)))); }, view_loaded: function (r) { var self = this;