Fix precision compute on stock move

bzr revid: ced-984ecb17be469ce212cb77fbe22be0a126553d41
This commit is contained in:
ced
2007-10-05 13:31:05 +00:00
parent 920f7fb698
commit 63d43bbc9e
+10 -4
View File
@@ -156,6 +156,7 @@ class stock_location(osv.osv):
prod_ids_str = ','.join(map(str, product_ids))
location_ids_str = ','.join(map(str, ids))
results = []
results2 = []
if 'in' in what:
# all moves from a location out of the set to a location in the set
cr.execute(
@@ -167,7 +168,7 @@ class stock_location(osv.osv):
'and state in ('+states_str+') '\
'group by product_id,product_uom'
)
results += cr.fetchall()
results = cr.fetchall()
if 'out' in what:
# all moves from a location in the set to a location out of the set
cr.execute(
@@ -179,13 +180,18 @@ class stock_location(osv.osv):
'and state in ('+states_str+') '\
'group by product_id,product_uom'
)
results += cr.fetchall()
results2 = cr.fetchall()
uom_obj = self.pool.get('product.uom')
for amount, prod_id, prod_uom in results:
amount = uom_obj._compute_qty(cr, uid, prod_uom, amount, context.get('uom', False))
amount = uom_obj._compute_qty(cr, uid, prod_uom, amount,
context.get('uom', False))
res[prod_id] += amount
for amount, prod_id, prod_uom in results2:
amount = uom_obj._compute_qty(cr, uid, prod_uom, amount,
context.get('uom', False))
res[prod_id] -= amount
return res
def _product_get(self, cr, uid, id, product_ids=False, context={}, states=['done']):
ids = id and [id] or []
return self._product_get_multi_location(cr, uid, ids, product_ids, context, states)