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

bzr revid: hda@tinyerp.com-20090128142942-7d7ljmq44fwqk2uf
This commit is contained in:
hda (Tiny) 2009-01-28 19:59:42 +05:30
parent a9b7443c9c
commit 597a05d7b5
2 changed files with 9 additions and 4 deletions

View File

@ -66,8 +66,11 @@ class product_product(osv.osv):
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))

View File

@ -63,7 +63,8 @@ def _fill_inventory(self, cr, uid, data, context):
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=[]
@ -73,7 +74,8 @@ def _fill_inventory(self, cr, uid, data, context):
#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)])