Ensure count of grouped_slice is at least 1

issue8474
review257701002
This commit is contained in:
Cédric Krier committed 2019-07-13 00:06:22 +02:00
1 parent a8fc7f0e50
commit 3c5cec7bf1
1 file changed
+1
+1
View File
@@ -225,6 +225,7 @@ def grouped_slice(records, count=None):
from trytond.transaction import Transaction
if count is None:
count = Transaction().database.IN_MAX
count = max(1, count)
for i in range(0, len(records), count):
yield islice(records, i, i + count)