From 0c71b22f810609c30f83f48c683f77abd50877ea Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 1 Feb 2012 12:37:24 +0100 Subject: [PATCH] [FIX] purchase: remove incorrect PO-based stock move valuation for incoming shipments As discussed on bug 923191, the current override is incorrect because it will silently replace the cost of incoming stock moves with PO prices for products w/ standard costing - this should only concern products with average costing for which no cost was manually provided. And in fact we can completely remove this override because even for products with average costing, the PO prices are already provided as default cost prices in the picking/move reception wizard, so the PO price is already taken into account and the cost will never be missing. Thanks to Graeme Gellatly for the excellent analysis! lp bug: https://launchpad.net/bugs/923191 fixed bzr revid: odo@openerp.com-20120201113724-y18fna1v7z6kxka4 --- addons/purchase/stock.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index 5cfcafcce9e..34579d2a7d9 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -29,20 +29,6 @@ class stock_move(osv.osv): readonly=True), } - def _get_reference_accounting_values_for_valuation(self, cr, uid, move, context=None): - """ - Overrides the default stock valuation to take into account the currency that was specified - on the purchase order in case the valuation data was not directly specified during picking - confirmation. - """ - reference_amount, reference_currency_id = super(stock_move, self)._get_reference_accounting_values_for_valuation(cr, uid, move, context=context) - 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 * move.product_qty, move.picking_id.purchase_id.pricelist_id.currency_id.id - return reference_amount, reference_currency_id - stock_move() #