[IMP] account: cleanup
authorMartin Trigaux <mat@openerp.com>
Mon, 18 Nov 2013 16:56:31 +0000 (17:56 +0100)
committerMartin Trigaux <mat@openerp.com>
Mon, 18 Nov 2013 16:56:31 +0000 (17:56 +0100)
bzr revid: mat@openerp.com-20131118165631-13pfg3w6ri0zbuau

addons/account/account.py

index 7c2cef8..f3abf3e 100644 (file)
@@ -1456,9 +1456,11 @@ class account_move(osv.osv):
     def unlink(self, cr, uid, ids, context=None, check=True):
         if context is None:
             context = {}
+        if isinstance(ids, (int, long)):
+            ids = [ids]
         toremove = []
         obj_move_line = self.pool.get('account.move.line')
-        for move in self.browse(cr, uid, (ids if hasattr(ids, '__iter__') else [ids]), context=context):
+        for move in self.browse(cr, uid, ids, context=context):
             if move['state'] != 'draft':
                 raise osv.except_osv(_('User Error!'),
                         _('You cannot delete a posted journal entry "%s".') % \