32 lines
1.3 KiB
Diff
32 lines
1.3 KiB
Diff
diff -r ad935d7f423e trytond/trytond/modules/stock/location.py
|
|
--- a/trytond/trytond/modules/stock/location.py Mon Mar 28 10:34:04 2016 +0200
|
|
+++ b/trytond/trytond/modules/stock/location.py Thu Apr 07 11:25:56 2016 +0200
|
|
@@ -224,6 +224,11 @@
|
|
return [(cls._rec_name,) + tuple(clause[1:])]
|
|
|
|
@classmethod
|
|
+ def _quantity_grouping_and_key(cls):
|
|
+ product_id = Transaction().context['product']
|
|
+ return ('product', ), (product_id,)
|
|
+
|
|
+ @classmethod
|
|
def get_quantity(cls, locations, name):
|
|
pool = Pool()
|
|
Product = pool.get('product.product')
|
|
@@ -255,12 +260,13 @@
|
|
pbl = {}
|
|
for sub_locations in grouped_slice(locations):
|
|
location_ids = [l.id for l in sub_locations]
|
|
+ grouping, key = cls._quantity_grouping_and_key()
|
|
with Transaction().set_context(context):
|
|
pbl.update(Product.products_by_location(
|
|
location_ids=location_ids, product_ids=[product_id],
|
|
- with_childs=True))
|
|
+ with_childs=True, grouping=grouping))
|
|
|
|
- return dict((loc.id, pbl.get((loc.id, product_id), 0))
|
|
+ return dict((loc.id, pbl.get((loc.id,) + key, 0))
|
|
for loc in locations)
|
|
|
|
@classmethod
|