[FIX] stock: '_product_value' function: some ids were missing in the 'result' dict
bzr revid: olt@tinyerp.com-20101004084328-l63el272pkzi2ua3
This commit is contained in:
parent
9d3e1dbac2
commit
83582f7648
|
@ -110,7 +110,6 @@ class stock_location(osv.osv):
|
|||
@param field_names: Name of field
|
||||
@return: Dictionary of values
|
||||
"""
|
||||
result = dict([(i, {}.fromkeys(field_names, 0.0)) for i in ids])
|
||||
|
||||
product_product_obj = self.pool.get('product.product')
|
||||
|
||||
|
@ -118,6 +117,9 @@ class stock_location(osv.osv):
|
|||
res_products_by_location = sorted(cr.dictfetchall(), key=itemgetter('location_id'))
|
||||
products_by_location = dict((k, [v['product_id'] for v in itr]) for k, itr in groupby(res_products_by_location, itemgetter('location_id')))
|
||||
|
||||
result = dict([(i, {}.fromkeys(field_names, 0.0)) for i in ids])
|
||||
result.update(dict([(i, {}.fromkeys(field_names, 0.0)) for i in list(set([aaa['location_id'] for aaa in res_products_by_location]))]))
|
||||
|
||||
currency_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
|
||||
currency_obj = self.pool.get('res.currency')
|
||||
currency = self.pool.get('res.currency').browse(cr, uid, currency_id)
|
||||
|
@ -129,6 +131,8 @@ class stock_location(osv.osv):
|
|||
for prod in product_product_obj.browse(cr, uid, product_ids, context=c):
|
||||
for f in field_names:
|
||||
if f == 'stock_real':
|
||||
if loc_id not in result:
|
||||
result[loc_id] = {}
|
||||
result[loc_id][f] += prod.qty_available
|
||||
elif f == 'stock_virtual':
|
||||
result[loc_id][f] += prod.virtual_available
|
||||
|
|
Loading…
Reference in New Issue