diff --git a/purchase_request.py b/purchase_request.py index ef8df9a970..1f66f35ac0 100644 --- a/purchase_request.py +++ b/purchase_request.py @@ -115,7 +115,7 @@ class PurchaseRequest: with Transaction().set_context(forecast=True, stock_date_end=min_date or datetime.date.max): pbl = Product.products_by_location(warehouse_ids, - product_ids, with_childs=True) + with_childs=True, grouping_filter=(product_ids,)) for warehouse_id in warehouse_ids: min_date_qties = defaultdict(lambda: 0, ((x, pbl.pop((warehouse_id, x), 0)) @@ -345,7 +345,7 @@ class PurchaseRequest: stock_date_start=current_date, stock_date_end=current_date): pbl = Product.products_by_location([location_id], - product_ids, with_childs=True) + with_childs=True, grouping_filter=(product_ids,)) for key, qty in pbl.iteritems(): _, product_id = key current_qties[product_id] += qty diff --git a/shipment.py b/shipment.py index 1fa0c3fc17..6cc74b8f3c 100644 --- a/shipment.py +++ b/shipment.py @@ -96,7 +96,7 @@ class ShipmentInternal(ModelSQL, ModelView): with Transaction().set_context(forecast=True, stock_date_end=today): pbl = Product.products_by_location( - location_ids, product_ids, with_childs=True) + location_ids, with_childs=True, grouping_filter=(product_ids,)) shipments = [] date = today @@ -182,7 +182,9 @@ class ShipmentInternal(ModelSQL, ModelView): stock_date_start=date, stock_date_end=date): pbl = Product.products_by_location( - location_ids, product_ids, with_childs=True) + location_ids, + with_childs=True, + grouping_filter=(product_ids,)) for key, qty in pbl.iteritems(): current_qties[key] += qty