[MERGE] menu possible to reload only a submenu

bzr revid: al@openerp.com-20121114005029-41tkuo2g93vbnz60
This commit is contained in:
Antony Lesuisse 2012-11-14 01:50:29 +01:00
commit d639ae250c
2 changed files with 9 additions and 7 deletions

View File

@ -1001,10 +1001,6 @@ 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)
@ -1031,7 +1027,8 @@ class Menu(openerpweb.Controller):
return Menus.search(menu_domain, 0, False, False, context)
def do_load(self, req):
@openerpweb.jsonrequest
def load(self, req, menu_id=None):
""" Loads all menu items (all applications and their sub-menus).
:param req: A request object, with an OpenERP session attribute
@ -1047,7 +1044,11 @@ 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)
menu_ids = Menus.search([], 0, False, False, context)
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_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

View File

@ -716,7 +716,8 @@ instance.web.Menu = instance.web.Widget.extend({
},
menu_loaded: function(data) {
var self = this;
this.data = data;
// TODO remove data.data
this.data = {"data": data};
this.renderElement();
this.limit_entries();
// Hide toplevel item if there is only one