[FIX] stock: add location in context on prodlot search

To be consistant with the results of _get_stock. Otherwise search made on
stock_available may not display results with the same value than the search
criteria.
Fixes #3976
This commit is contained in:
Loïc BELLIER 2014-12-01 15:34:17 +01:00 committed by Martin Trigaux
parent 6e346f0adb
commit 34b9f43011
1 changed files with 9 additions and 1 deletions

View File

@ -1437,7 +1437,15 @@ class stock_production_lot(osv.osv):
""" Searches Ids of products
@return: Ids of locations
"""
locations = self.pool.get('stock.location').search(cr, uid, [('usage', '=', 'internal')])
if context is None:
context = {}
if 'location_id' not in context:
locations = self.pool['stock.location'].search(
cr, uid, [('usage', '=', 'internal')], context=context)
else:
locations = context['location_id'] and [context['location_id']] or []
cr.execute('''select
prodlot_id,
sum(qty)