From 5ef7c4a6a1838a3821ee1bcf14d93d0203e9fbc1 Mon Sep 17 00:00:00 2001 From: Cecile Tonglet Date: Mon, 17 Feb 2014 11:49:20 +0100 Subject: [PATCH] [FIX] getParent() js error when clicking to fast on menu items that load a list view after loading a form view bzr revid: cto@openerp.com-20140217104920-fu8hcqd51bh7qnrp --- addons/web/static/src/js/view_list.js | 7 +++++-- addons/web/static/src/js/views.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index f3ecc373ca5..5bee82c28d2 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1623,9 +1623,12 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we function synchronized(fn) { var fn_mutex = new $.Mutex(); return function () { + var obj = this; var args = _.toArray(arguments); - args.unshift(this); - return fn_mutex.exec(fn.bind.apply(fn, args)); + return fn_mutex.exec(function () { + if (obj.isDestroyed()) { return $.when(); } + return fn.apply(obj, args) + }); }; } var DataGroup = instance.web.Class.extend({ diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 8d04110885c..875b113a82f 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1301,7 +1301,7 @@ instance.web.View = instance.web.Widget.extend({ "context": this.dataset.get_context(), }); } - return view_loaded_def.then(function(r) { + return this.alive(view_loaded_def).then(function(r) { self.fields_view = r; // add css classes that reflect the (absence of) access rights self.$el.addClass('oe_view')