From 12825e4122adc2dd38df145db9426c2ec6ff7f03 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 23 Feb 2012 14:46:12 +0100 Subject: [PATCH] [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 --- addons/web/controllers/main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index cfb87a04021..47f3837f018 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -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):