From 2ffb95c1c2b75a67f2685194ccf6428913db9bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 7 Jul 2009 19:39:26 +0200 Subject: [PATCH] Fix the use of rowcount because it can return -1 or None according to PEP249 --- sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sale.py b/sale.py index 4eb4fee0bf..0b41a89eca 100644 --- a/sale.py +++ b/sale.py @@ -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,