From 5ced670050366830203d59fb0f09209477c3bb91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 10 Oct 2015 17:46:14 +0200 Subject: [PATCH] Correctly handle all empty value of menu action Empty action for the reference field can be None or an negative id. issue4915 review22511002 --- trytond/ir/ui/menu.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/trytond/ir/ui/menu.py b/trytond/ir/ui/menu.py index 28ecb75061..e7ee292958 100644 --- a/trytond/ir/ui/menu.py +++ b/trytond/ir/ui/menu.py @@ -222,8 +222,6 @@ class UIMenu(ModelSQL, ModelView): @classmethod def set_action(cls, menus, name, value): - if not value: - return pool = Pool() ActionKeyword = pool.get('ir.action.keyword') action_keywords = [] @@ -237,11 +235,13 @@ class UIMenu(ModelSQL, ModelView): if action_keywords: with Transaction().set_context(_timestamp=False): ActionKeyword.delete(action_keywords) + if not value: + return if isinstance(value, basestring): action_type, action_id = value.split(',') else: action_type, action_id = value - if not int(action_id): + if int(action_id) <= 0: return Action = pool.get(action_type) action = Action(int(action_id))