diff -r 366b4e8da556 trytond/trytond/modules/stock/location.py --- a/trytond/trytond/modules/stock/location.py Wed Apr 10 14:21:58 2019 +0200 +++ b/trytond/trytond/modules/stock/location.py Wed Apr 10 17:42:42 2019 +0200 @@ -355,11 +355,14 @@ if trans_context.get('product') is not None: grouping = ('product',) grouping_filter = ([trans_context['product']],) - key = trans_context['product'] + key = (trans_context['product'],) + if trans_context.get('lot') is not None: + grouping += ('lot', ) + key += (trans_context['lot'],) else: grouping = ('product.template',) grouping_filter = ([trans_context['product_template']],) - key = trans_context['product_template'] + key = (trans_context['product_template'],) pbl = {} for sub_locations in grouped_slice(locations): location_ids = [l.id for l in sub_locations] @@ -370,7 +373,7 @@ grouping_filter=grouping_filter, with_childs=trans_context.get('with_childs', True))) - return dict((loc.id, pbl.get((loc.id, key), 0)) for loc in locations) + return dict((loc.id, pbl.get((loc.id,) + key, 0)) for loc in locations) @classmethod def search_quantity(cls, name, domain):