changeset 13c9be5bfcaf in modules/account_payment_sepa:default
details:
https://hg.tryton.org/modules/account_payment_sepa?cmd=changeset&node=13c9be5bfcaf
description:
Replace cursor fetchall by iteration over cursor
issue5817
review335831003
diffstat:
payment.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diffs (34 lines):
diff -r a59ad15c8b62 -r 13c9be5bfcaf payment.py
--- a/payment.py Thu Mar 11 23:00:10 2021 +0100
+++ b/payment.py Sun Mar 21 16:09:13 2021 +0100
@@ -656,7 +656,7 @@
cursor.execute(*payment.select(payment.sepa_mandate, Literal(True),
where=red_sql,
group_by=payment.sepa_mandate))
- has_payments.update(cursor.fetchall())
+ has_payments.update(cursor)
return {'has_payments': has_payments}
@@ -768,7 +768,9 @@
def __register__(cls, module_name):
pool = Pool()
Group = pool.get('account.payment.group')
- cursor = Transaction().connection.cursor()
+ transaction = Transaction()
+ cursor = transaction.connection.cursor()
+ update = transaction.connection.cursor()
table = cls.__table__()
super(Message, cls).__register__(module_name)
@@ -780,8 +782,8 @@
group = Group.__table__()
cursor.execute(*group.select(
group.id, group.sepa_message, group.company))
- for group_id, message, company_id in cursor.fetchall():
- cursor.execute(*table.insert(
+ for group_id, message, company_id in cursor:
+ update.execute(*table.insert(
[table.message, table.type, table.company,
table.origin, table.state],
[[