[FIX] stock: when delivering a product in average cost, make sure the price_unit on the stock.move is up to date (opw 607272)

The price mentioned on the stock move from the delivery order is the one at the time of the sale order confirmation. On average price, the price can be different when the delivery is actually done. The price will then be refreshed with the one specified on the product.

bzr revid: mat@openerp.com-20140430102847-o1fzo318rpmq9n1j
This commit is contained in:
Martin Trigaux 2014-04-30 12:28:47 +02:00
commit c16d0fc456
1 changed files with 3 additions and 1 deletions

View File

@ -2322,7 +2322,9 @@ class stock_move(osv.osv):
# 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