Skip to content

Commit

Permalink
[FIX] stock_account: setting standard price with multiple real-price …
Browse files Browse the repository at this point in the history
…outs with negative quants fixes odoo#24925

Somehow the function treated multiple records with
 the new api translation from 9 to 10.

Steps to reproduce:
This applies to delivery orders and manufacturing orders. As an example:

Create an MO with 2 products on the BOM
Both products must have real time costing with FIFO
The first product on the bom must not be available
For the second product on the BOM, the standard_price must be different from the cost of the next quant to be consumed
Complete the MO, letting the first product result in a negative quant
Current behavior:
The standard_price of the second product on the BOM does not get updated.

Behavior after this fix:
The standard_price of the second product on the BOM gets updated.

Thanks to matt454357.
  • Loading branch information
jco-odoo authored and nim-odoo committed May 29, 2018
1 parent 6340186 commit eabcb9f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/stock_account/models/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def _store_average_cost_price(self):
# product_obj = self.pool.get('product.product')
if any(q.qty <= 0 for q in move.quant_ids) or move.product_qty == 0:
# if there is a negative quant, the standard price shouldn't be updated
return
continue
# Note: here we can't store a quant.cost directly as we may have moved out 2 units
# (1 unit to 5€ and 1 unit to 7€) and in case of a product return of 1 unit, we can't
# know which of the 2 costs has to be used (5€ or 7€?). So at that time, thanks to the
Expand Down

0 comments on commit eabcb9f

Please sign in to comment.