diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 844ec5d0bc5..ffabe97661b 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1001,6 +1001,10 @@ class Session(openerpweb.Controller): class Menu(openerpweb.Controller): _cp_path = "/web/menu" + @openerpweb.jsonrequest + def load(self, req): + return {'data': self.do_load(req)} + @openerpweb.jsonrequest def get_user_roots(self, req): return self.do_get_user_roots(req) @@ -1027,8 +1031,7 @@ class Menu(openerpweb.Controller): return Menus.search(menu_domain, 0, False, False, context) - @openerpweb.jsonrequest - def load(self, req, menu_id=None): + def do_load(self, req): """ Loads all menu items (all applications and their sub-menus). :param req: A request object, with an OpenERP session attribute @@ -1044,11 +1047,7 @@ class Menu(openerpweb.Controller): # menus are loaded fully unlike a regular tree view, cause there are a # limited number of items (752 when all 6.1 addons are installed) - if menu_id: - # for load only one sub menu - menu_ids = Menus.search([['id', 'child_of', menu_id]], 0, False, False, context) - else: - menu_ids = Menus.search([], 0, False, False, context) + menu_ids = Menus.search([], 0, False, False, context) menu_items = Menus.read(menu_ids, ['name', 'sequence', 'parent_id', 'action', 'needaction_enabled', 'needaction_counter'], context) # adds roots at the end of the sequence, so that they will overwrite # equivalent menu items from full menu read when put into id:item diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index aa6a7c19788..69dafa08c02 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -716,8 +716,7 @@ instance.web.Menu = instance.web.Widget.extend({ }, menu_loaded: function(data) { var self = this; - // TODO remove data.data - this.data = {"data": data}; + this.data = data; this.renderElement(); this.limit_entries(); // Hide toplevel item if there is only one