summaryrefslogtreecommitdiff
path: root/addons/web/controllers/main.py
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-02-23 14:46:12 +0100
committerXavier Morel <xmo@openerp.com>2012-02-23 14:46:12 +0100
commit12825e4122adc2dd38df145db9426c2ec6ff7f03 (patch)
tree1bf60a87716407781816b0b83375264f1c0b4066 /addons/web/controllers/main.py
parent50853cbaac022fea60009b49c29bde2bac592c2a (diff)
[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
Diffstat (limited to 'addons/web/controllers/main.py')
-rw-r--r--addons/web/controllers/main.py10
1 files 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):