From ecc4e512cd3abfae72486f448cd5691de3cb491c Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Tue, 28 Jul 2015 09:24:40 +0200 Subject: [PATCH] [IMP] web: action manager: restore action When clicking on the breadcrumb to come back to a previously loaded action, the restore() function is called. With this rev, this old action is shown only once the Deferred returned by the optional on_reverse_breadcrumb callback is resolved, i.e. when the action is ready, as it should be. --- addons/web/static/src/js/action_manager.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/js/action_manager.js b/addons/web/static/src/js/action_manager.js index 7d9f84a24f8..4a3f31b27f3 100644 --- a/addons/web/static/src/js/action_manager.js +++ b/addons/web/static/src/js/action_manager.js @@ -118,8 +118,10 @@ var WidgetAction = Action.extend({ * Restores WidgetAction by calling do_show on its widget */ restore: function() { - this.widget.do_show(); - return this._super(); + var self = this; + return $.when(this._super()).then(function() { + return self.widget.do_show(); + }); }, /** * Destroys the widget @@ -147,10 +149,9 @@ var ViewManagerAction = WidgetAction.extend({ * @param {int} [view_index] the index of the view to select */ restore: function(view_index) { - var self = this; - var _super = this._super; + var _super = this._super.bind(this); return this.widget.select_view(view_index).then(function() { - _super.call(self); + return _super(); }); }, /**