[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
This commit is contained in:
Nicolas Martinelli 2015-05-19 16:27:50 +02:00
parent 9c6ae3cf6c
commit ba896aabe7
1 changed files with 5 additions and 1 deletions

View File

@ -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)