[FIX] stock, multicompany: avoid crashing when computing inventory levels and no warehouse/locations exists for a company

This is a cherry-pick backport of the trunk fix for bug 921561,
originally merged in trunk at revid fp@openerp.com-20130224101111-zz5n34c5fmr4n8jt

lp bug: https://launchpad.net/bugs/921561 fixed

bzr revid: odo@openerp.com-20130417132021-pmf0cdvwaxrsx9ew
This commit is contained in:
Olivier Dony 2013-04-17 15:20:21 +02:00
parent dcd398d33e
commit d279819af7
1 changed files with 2 additions and 0 deletions

View File

@ -235,6 +235,8 @@ class product_product(osv.osv):
else:
location_ids = []
wids = warehouse_obj.search(cr, uid, [], context=context)
if not wids:
return res
for w in warehouse_obj.browse(cr, uid, wids, context=context):
location_ids.append(w.lot_stock_id.id)