From d3daae2716d09f6b6ff7ad421eb8cf37505e2276 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 15 May 2012 15:35:23 +0200 Subject: [PATCH] [IMP] client action 'reload': optionally open a given menu_id bzr revid: rco@openerp.com-20120515133523-78amsdjhtbzr6akj --- addons/web/static/src/js/views.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 5501be58f9e..e38f2422111 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1319,13 +1319,24 @@ instance.web.str_to_xml = function(s) { instance.web.client_actions = new instance.web.Registry(); /** - * Client action to reload the whole interface; refreshes the menu and reloads the current view + * Client action to reload the whole interface. + * If params has an entry 'menu_id', it opens the given menu entry. */ instance.web.client_actions.add("reload", "instance.web.Reload"); instance.web.Reload = instance.web.Widget.extend({ + init: function(parent, params) { + this._super(parent); + this.menu_id = (params && params.menu_id) || false; + }, start: function() { - window.location.reload(); + if (this.menu_id) { + // open the given menu id + var url_without_fragment = window.location.toString().split("#", 1)[0]; + window.location = url_without_fragment + "#menu_id=" + this.menu_id; + } else { + window.location.reload(); + } } });