Correctly handle all empty value of menu action

Empty action for the reference field can be None or an negative id.

issue4915
review22511002
This commit is contained in:
Cédric Krier committed 2015-10-10 17:46:14 +02:00
1 parent 24c499737e
commit 5ced670050
1 file changed
+3 -3
+3 -3
View File
@@ -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))