[FIX] correctly handle the user's menu_id being set to an action with domain=False (literally)

that's a bit stupid, but apparently people do set their menu action to a dashboard...

lp bug: https://launchpad.net/bugs/937691 fixed

bzr revid: xmo@openerp.com-20120223134612-3sm2e4yq3hbjqnz7
This commit is contained in:
Xavier Morel 2012-02-23 14:46:12 +01:00
parent 50853cbaac
commit 12825e4122
1 changed files with 6 additions and 4 deletions

View File

@ -762,11 +762,13 @@ class Menu(openerpweb.Controller):
Menus = s.model('ir.ui.menu')
# If a menu action is defined use its domain to get the root menu items
user_menu_id = s.model('res.users').read([s._uid], ['menu_id'], context)[0]['menu_id']
menu_domain = [('parent_id', '=', False)]
if user_menu_id:
menu_domain = s.model('ir.actions.act_window').read([user_menu_id[0]], ['domain'], context)[0]['domain']
menu_domain = ast.literal_eval(menu_domain)
else:
menu_domain = [('parent_id', '=', False)]
domain_string = s.model('ir.actions.act_window').read([user_menu_id[0]], ['domain'], context)[0]['domain']
if domain_string:
menu_domain = ast.literal_eval(domain_string)
return Menus.search(menu_domain, 0, False, False, context)
def do_load(self, req):