From f6f575543f9d9866f44529632c6bad2d662d86a6 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 3 May 2013 12:22:48 +0200 Subject: [PATCH] [FIX] need_action: avoid reloading needaction counters when there is no menu - guard do_load_needaction to prevent exceptions when there is no menu to load - avoid calling do_load_needaction where there is no menu to reload in the first place bzr revid: odo@openerp.com-20130503102248-vjl1b8xju9uwfq97 --- addons/web/static/src/js/chrome.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index e6870b82629..3492d5670a0 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -900,6 +900,10 @@ instance.web.Menu = instance.web.Widget.extend({ }, do_load_needaction: function (menu_ids) { var self = this; + menu_ids = _.reject(menu_ids, _.isEmpty); + if (_.isEmpty(menu_ids)) { + return $.when(); + } return this.rpc("/web/menu/load_needaction", {'menu_ids': menu_ids}).done(function(r) { self.on_needaction_loaded(r); }); @@ -1037,9 +1041,11 @@ instance.web.Menu = instance.web.Widget.extend({ }, do_reload_needaction: function () { var self = this; - self.do_load_needaction([self.current_menu]).then(function () { - self.trigger("need_action_reloaded"); - }); + if (self.current_menu) { + self.do_load_needaction([self.current_menu]).then(function () { + self.trigger("need_action_reloaded"); + }); + } }, /** * Jquery event handler for menu click