[FIX] ir_actions: ids of unlink method can either be an ID list or one ID

This commit is contained in:
Denis Ledoux
2014-10-07 16:07:46 +02:00
parent cc9973d464
commit c741d45ac1
+4
View File
@@ -62,6 +62,10 @@ class actions(osv.osv):
"""unlink ir.action.todo which are related to actions which will be deleted.
NOTE: ondelete cascade will not work on ir.actions.actions so we will need to do it manually."""
todo_obj = self.pool.get('ir.actions.todo')
if not ids:
return True
if isinstance(ids, (int, long)):
ids = [ids]
todo_ids = todo_obj.search(cr, uid, [('action_id', 'in', ids)], context=context)
todo_obj.unlink(cr, uid, todo_ids, context=context)
return super(actions, self).unlink(cr, uid, ids, context=context)