From 37c41f9c78ef7ef2eab0f1cd74f907cbe824c95c Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 29 Apr 2014 16:53:32 +0200 Subject: [PATCH] [FIX] stock: when delivering a product in average cost, make sure the price_unit on the stock.move is up to date (opw 607272) bzr revid: mat@openerp.com-20140429145332-s3c22w47aihdsfub --- addons/stock/stock.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 9a1c93f436e11..d2d5ba3fab17d 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2322,7 +2322,9 @@ def _get_reference_accounting_values_for_valuation(self, cr, uid, move, context= # if product is set to average price and a specific value was entered in the picking wizard, # we use it - if move.product_id.cost_method == 'average' and move.price_unit: + if move.location_dest_id.usage != 'internal' and move.product_id.cost_method == 'average': + reference_amount = qty * move.product_id.standard_price + elif move.product_id.cost_method == 'average' and move.price_unit: reference_amount = qty * move.price_unit reference_currency_id = move.price_currency_id.id or reference_currency_id