From 78d4822abbec54f4c97e27fc1921da1b8445453c Mon Sep 17 00:00:00 2001 From: Mohammed Shekha Date: Sat, 10 Jan 2015 17:01:13 +0530 Subject: [PATCH] [FIX]History Back: Fixed the issue of history back, when calling action history_back it always redirect to home page, instead of previous view --- addons/web/static/src/js/chrome.js | 4 ++-- addons/web/static/src/js/views.js | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index a494bb1a7e4..755d11061cd 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -746,9 +746,9 @@ instance.web.client_actions.add("reload_context", "instance.web.ReloadContext"); * If can't go back in history stack, will go back to home. */ instance.web.HistoryBack = function(parent) { - if (!parent.history_back()) { + parent.history_back().fail(function() { instance.web.Home(parent); - } + }); }; instance.web.client_actions.add("history_back", "instance.web.HistoryBack"); diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index e4a577321e7..d1b9040de5e 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -119,18 +119,19 @@ instance.web.ActionManager = instance.web.Widget.extend({ if (this.widgets.length > 1) { widget = this.widgets[this.widgets.length - 2]; var index = widget.view_stack && widget.view_stack.length - 1; - this.select_widget(widget, index); + return this.select_widget(widget, index); } + return $.Deferred().reject(); }, select_widget: function(widget, index) { var self = this; if (this.webclient.has_uncommitted_changes()) { - return false; + return $.Deferred().reject(); } var widget_index = this.widgets.indexOf(widget), def = $.when(widget.select_view && widget.select_view(index)); - def.done(function () { + return def.done(function () { if (widget.__on_reverse_breadcrumb) { widget.__on_reverse_breadcrumb(); }