Fix the use of rowcount because it can return -1 or None according to PEP249

This commit is contained in:
Cédric Krier
2009-07-07 19:39:26 +02:00
parent edd106df5e
commit 2ffb95c1c2
+1 -1
View File
@@ -1706,7 +1706,7 @@ class Invoice(ModelSQL, ModelView):
cursor.execute('SELECT id FROM sale_invoices_rel ' \
'WHERE invoice IN (' + ','.join(['%s' for x in ids]) + ')',
ids)
if cursor.rowcount:
if cursor.fetchone():
self.raise_user_error(cursor, 'delete_sale_invoice',
context=context)
return super(Invoice, self).delete(cursor, user, ids,