[FIX]:in stock real time accounting wrong values for stock moves with purchase unit
authorKirti Savalia (OpenERP) <ksa@tinyerp.com>
Thu, 17 Nov 2011 10:07:52 +0000 (15:37 +0530)
committerKirti Savalia (OpenERP) <ksa@tinyerp.com>
Thu, 17 Nov 2011 10:07:52 +0000 (15:37 +0530)
lp bug: https://launchpad.net/bugs/889093 fixed

bzr revid: ksa@tinyerp.com-20111117100752-774f7kkcfr1wtajg

addons/purchase/stock.py

index 42d9c40..c212a17 100644 (file)
@@ -35,16 +35,12 @@ class stock_move(osv.osv):
         on the purchase order in case the valuation data was not directly specified during picking
         confirmation.
         """
-        product_uom_obj = self.pool.get('product.uom')
-
         reference_amount, reference_currency_id = super(stock_move, self)._get_reference_accounting_values_for_valuation(cr, uid, move, context=context)
-        default_uom = move.product_id.uom_id.id
-        qty = product_uom_obj._compute_qty(cr, uid, move.product_uom.id, move.product_qty, default_uom)
         if move.product_id.cost_method != 'average' or not move.price_unit:
             # no average price costing or cost not specified during picking validation, we will
             # plug the purchase line values if they are found.
             if move.purchase_line_id and move.picking_id.purchase_id.pricelist_id:
-                reference_amount, reference_currency_id = move.purchase_line_id.price_unit * qty, move.picking_id.purchase_id.pricelist_id.currency_id.id
+                reference_amount, reference_currency_id = move.purchase_line_id.price_unit * move.product_qty, move.picking_id.purchase_id.pricelist_id.currency_id.id
         return reference_amount, reference_currency_id
 
 stock_move()