From b28bfcdb3a8752154fc1778f6410f8b83bbcf457 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 17 Apr 2015 17:32:47 +0200 Subject: [PATCH] [FIX] stock_account: real-time inventory valuation with free goods For a free purchase, the valuation amount fall-backed to the product cost price instead of the actual cost of the purchase. opw-63059 --- addons/stock_account/stock_account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock_account/stock_account.py b/addons/stock_account/stock_account.py index d1a66610264..cd80a630e67 100644 --- a/addons/stock_account/stock_account.py +++ b/addons/stock_account/stock_account.py @@ -201,9 +201,9 @@ class stock_quant(osv.osv): valuation_amount = context.get('force_valuation_amount') else: if move.product_id.cost_method == 'average': - valuation_amount = move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal' and cost or move.product_id.standard_price + valuation_amount = cost if move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal' else move.product_id.standard_price else: - valuation_amount = move.product_id.cost_method == 'real' and cost or move.product_id.standard_price + valuation_amount = cost if move.product_id.cost_method == 'real' else move.product_id.standard_price #the standard_price of the product may be in another decimal precision, or not compatible with the coinage of #the company currency... so we need to use round() before creating the accounting entries. valuation_amount = currency_obj.round(cr, uid, move.company_id.currency_id, valuation_amount * qty)