location_ids = [id for (id,) in cr.fetchall()]
# build the list of ids of children of the location given by id
- child_location_ids = self.pool.get('stock.location').search(cr, uid, [('location_id', 'child_of', location_ids)])
- location_ids= len(child_location_ids) and child_location_ids or location_ids
+ if context.get('compute_child',True):
+ child_location_ids = self.pool.get('stock.location').search(cr, uid, [('location_id', 'child_of', location_ids)])
+ location_ids= len(child_location_ids) and child_location_ids or location_ids
+ else:
+ location_ids= location_ids
states_str = ','.join(map(lambda s: "'%s'" % s, states))
res=location_obj._product_get(cr, uid, location)
res_location[location]=res
else:
- res=location_obj._product_get(cr, uid, data['form']['location_id'])
+ context.update({'compute_child':False})
+ res=location_obj._product_get(cr, uid, data['form']['location_id'],context=context)
res_location[data['form']['location_id']]=res
product_ids=[]
#product_ids.append(product_id)
prod = pool.get('product.product').browse(cr, uid, [product_id])[0]
uom = prod.uom_id.id
- amount=pool.get('stock.location')._product_get(cr, uid, location, [product_id], {'uom': uom})[product_id]
+ context.update({'uom': uom})
+ amount=pool.get('stock.location')._product_get(cr, uid, location, [product_id], context=context)[product_id]
if(amount):
line_ids=inventory_line_obj.search(cr,uid,[('inventory_id','=',data['id']),('location_id','=',location),('product_id','=',product_id),('product_uom','=',uom),('product_qty','=',amount)])