Merge lp:~openerp-dev/openobject-addons/7.0-stock-average-refresh-opw-607272-mat into lp:openobject-addons/7.0

Proposed by Martin Trigaux (OpenERP)
Status: Merged
Merged at revision: 10026
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-stock-average-refresh-opw-607272-mat
Merge into: lp:openobject-addons/7.0
Diff against target: 13 lines (+3/-1)
1 file modified
stock/stock.py (+3/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-stock-average-refresh-opw-607272-mat
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+217619@code.launchpad.net

Description of the change

When we deliver a product with average cost, use the cost of the product at the time of delivery.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/stock.py'
2--- stock/stock.py 2014-04-23 15:06:21 +0000
3+++ stock/stock.py 2014-04-29 14:54:17 +0000
4@@ -2322,7 +2322,9 @@
5
6 # if product is set to average price and a specific value was entered in the picking wizard,
7 # we use it
8- if move.product_id.cost_method == 'average' and move.price_unit:
9+ if move.location_dest_id.usage != 'internal' and move.product_id.cost_method == 'average':
10+ reference_amount = qty * move.product_id.standard_price
11+ elif move.product_id.cost_method == 'average' and move.price_unit:
12 reference_amount = qty * move.price_unit
13 reference_currency_id = move.price_currency_id.id or reference_currency_id
14