changeset 45199a288fba in modules/project_revenue:default
details: 
https://hg.tryton.org/modules/project_revenue?cmd=changeset&node=45199a288fba
description:
        Replace cursor fetchall by iteration over cursor

        issue5817
        review335831003
diffstat:

 work.py |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r ecb3b008b154 -r 45199a288fba work.py
--- a/work.py   Fri Mar 05 15:49:19 2021 +0100
+++ b/work.py   Sun Mar 21 16:09:13 2021 +0100
@@ -81,7 +81,7 @@
                     ).select(table.id, Sum(line.cost_price * line.duration),
                     where=red_sql,
                     group_by=[table.id]))
-            for work_id, cost in cursor.fetchall():
+            for work_id, cost in cursor:
                 # SQLite stores timedelta as float
                 if not isinstance(cost, float):
                     cost = cost.total_seconds()
@@ -130,13 +130,13 @@
                     condition=invoice_line.invoice == invoice.id
                     ).select(invoice_line.id, table.id,
                     where=where & ~invoice.state.in_(['draft', 'cancelled'])))
-            iline2work.update(cursor.fetchall())
+            iline2work.update(cursor)
 
             cursor.execute(*table.join(company,
                     condition=table.company == company.id
                     ).select(table.id, company.currency,
                     where=where))
-            work2currency.update(cursor.fetchall())
+            work2currency.update(cursor)
 
         currencies = Currency.browse(set(work2currency.values()))
         id2currency = {c.id: c for c in currencies}

Reply via email to