From ba896aabe7dad10f3108a4b83c4d8e304ae0935f Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 19 May 2015 16:27:50 +0200 Subject: [PATCH] [FIX] stock: if cost_method of a product is 'average' do not round the currency conversion This prevents rounding errors if product decimal precision is different from currency precision. Fixes #6547 opw-634390 Do not fowardport since already done in v8.0: https://github.com/odoo/odoo/blob/8.0/addons/stock_account/stock_account.py#L310 --- addons/stock/stock.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index f01e0995acc..16deddcca5b 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2354,7 +2354,11 @@ class stock_move(osv.osv): new_std_price = new_price else: # Get the standard price - amount_unit = product.price_get('standard_price', context=context)[product.id] + pricetype_obj = self.pool.get('product.price.type') + price_type_id = pricetype_obj.search(cr, uid, [('field','=','standard_price')])[0] + price_type_currency_id = pricetype_obj.browse(cr, uid, price_type_id).currency_id.id + amount_unit = self.pool.get('res.currency').compute(cr, uid, price_type_currency_id, + context['currency_id'], product.standard_price, round=False, context=context) new_std_price = ((amount_unit * product_avail[product.id])\ + (new_price * qty))/(product_avail[product.id] + qty)