Fix the use of rowcount because it can return -1 or None according to PEP249
This commit is contained in:
+1
-1
@@ -91,7 +91,7 @@ class FiscalYear(ModelSQL, ModelView):
|
||||
fiscalyear.end_date, fiscalyear.end_date,
|
||||
fiscalyear.start_date, fiscalyear.end_date,
|
||||
fiscalyear.company.id, fiscalyear.id))
|
||||
if cursor.rowcount:
|
||||
if cursor.fetchone():
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@@ -165,8 +165,6 @@ class Party(ModelSQL, ModelView):
|
||||
'AND'.join(['(SUM((COALESCE(l.debit, 0) - COALESCE(l.credit, 0))) ' \
|
||||
+ ' ' + x[1] + ' %s) ' for x in args]),
|
||||
[code] + today_value + [company_id] + [x[2] for x in args])
|
||||
if not cursor.rowcount:
|
||||
return [('id', '=', 0)]
|
||||
return [('id', 'in', [x[0] for x in cursor.fetchall()])]
|
||||
|
||||
Party()
|
||||
|
||||
Reference in New Issue
Block a user