[FIX] stock : Stock Valuation Entries Don't Adjust with UoM
authorHarry (Open ERP) <hmo@tinyerp.com>
Mon, 3 Aug 2009 05:54:59 +0000 (11:24 +0530)
committerHarry (Open ERP) <hmo@tinyerp.com>
Mon, 3 Aug 2009 05:54:59 +0000 (11:24 +0530)
lp bug: https://launchpad.net/bugs/400093 fixed

bzr revid: hmo@tinyerp.com-20090803055459-jl8mvaimb2vlxalz

addons/stock/stock.py

index 7468e58..7c533f3 100644 (file)
@@ -1231,12 +1231,14 @@ class stock_move(osv.osv):
                                 move.product_id.categ_id.id,))
                 journal_id = move.product_id.categ_id.property_stock_journal.id
                 if acc_src != acc_dest:
-                    ref = move.picking_id and move.picking_id.name or False
-
+                    ref = move.picking_id and move.picking_id.name or False  
+                    product_uom_obj = self.pool.get('product.uom')
+                    default_uom = move.product_id.uom_id.id
+                    q = product_uom_obj._compute_qty(cr, uid, move.product_uom.id, move.product_qty, default_uom)
                     if move.product_id.cost_method == 'average' and move.price_unit:
-                        amount = move.product_qty * move.price_unit
+                        amount = q * move.price_unit
                     else:
-                        amount = move.product_qty * move.product_id.standard_price
+                        amount = q * move.product_id.standard_price
 
                     date = time.strftime('%Y-%m-%d')
                     partner_id = False