changeset 36af5e031a6c in modules/sale_stock_quantity:default
details: 
https://hg.tryton.org/modules/sale_stock_quantity?cmd=changeset&node=36af5e031a6c
description:
        Limit size of grouping_filter ids

        The list of ids in grouping_filter are used inside an IN-clause so we 
must
        limit the size.

        issue10589
        review379471002
diffstat:

 sale.py |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r 1ed8d57f2736 -r 36af5e031a6c sale.py
--- a/sale.py   Sun Jul 04 17:54:48 2021 +0200
+++ b/sale.py   Sat Oct 30 02:27:19 2021 +0200
@@ -2,6 +2,7 @@
 # this repository contains the full copyright notices and license terms.
 
 import datetime
+from collections import defaultdict
 
 from trytond.i18n import gettext
 from trytond.pool import PoolMeta, Pool
@@ -95,10 +96,12 @@
             with transaction.set_context(forecast=True,
                     stock_date_start=date,
                     stock_date_end=date):
-                pbl = Product.products_by_location(
-                    [self.warehouse.id],
-                    with_childs=True,
-                    grouping_filter=(product_ids,))
+                pbl = defaultdict(int)
+                for sub_product_ids in grouped_slice(product_ids):
+                    pbl.update(Product.products_by_location(
+                            [self.warehouse.id],
+                            with_childs=True,
+                            grouping_filter=(list(sub_product_ids),)))
             delta = {}
             for key, qty in pbl.items():
                 _, product_id = key

Reply via email to