From 2c77907898dc7c24122e29cc2ce3530e8aa4f040 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Thu, 6 Nov 2014 16:46:07 +0100 Subject: [PATCH] Use grouped_slice on get_lines_to_pay issue4321 review6651002 --- invoice.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/invoice.py b/invoice.py index dc2d31d7b7..f15529bbfe 100644 --- a/invoice.py +++ b/invoice.py @@ -608,11 +608,9 @@ class Invoice(Workflow, ModelSQL, ModelView): line = MoveLine.__table__() invoice = cls.__table__() cursor = Transaction().cursor - in_max = cursor.IN_MAX lines = defaultdict(list) - for i in range(0, len(invoices), in_max): - sub_ids = [i.id for i in invoices[i:i + in_max]] + for sub_ids in grouped_slice(invoices): red_sql = reduce_ids(invoice.id, sub_ids) cursor.execute(*invoice.join(line, condition=((invoice.move == line.move)