Replace product_ids by grouping_filter

issue7141
review43151002
This commit is contained in:
Cédric Krier
2018-02-28 18:27:08 +01:00
parent eec8bbdf56
commit fa071d8596
2 changed files with 6 additions and 4 deletions
+2 -2
View File
@@ -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
+4 -2
View File
@@ -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