changeset 09b8cbde96ac in modules/sale_extra:default
details:
https://hg.tryton.org/modules/sale_extra?cmd=changeset&node=09b8cbde96ac
description:
Replace cursor fetchall by iteration over cursor
issue5817
review335831003
diffstat:
sale.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r dfdd044c1e98 -r 09b8cbde96ac sale.py
--- a/sale.py Sun Mar 07 11:13:53 2021 +0100
+++ b/sale.py Sun Mar 21 16:09:13 2021 +0100
@@ -107,7 +107,9 @@
def __register__(cls, module_name):
pool = Pool()
PriceList = pool.get('product.price_list')
- cursor = Transaction().connection.cursor()
+ transaction = Transaction()
+ cursor = transaction.connection.cursor()
+ update = transaction.connection.cursor()
sql_table = cls.__table__()
price_list = PriceList.__table__()
@@ -121,10 +123,10 @@
).select(sql_table.id, price_list.company,
where=sql_table.company == Null)
cursor.execute(*query)
- for extra_id, company_id in cursor.fetchall():
+ for extra_id, company_id in cursor:
query = sql_table.update([sql_table.company], [company_id],
where=sql_table.id == extra_id)
- cursor.execute(*query)
+ update.execute(*query)
@staticmethod
def default_company():