[FIX] stock_landed_costs: do not prorate
- Set the product A in FIFO, real-time valuation
- Receive 5 units @ 2000 each
- Create a landed cost of 1000, apply on the picking
=> the cost of A is 2200
- Sell one unit
- Create another landed cost of 1000, apply on the same picking
The cost of A is 2360, while one expects 2400.
The value of the move after the second landed cost is computed as:
value = previous value + prorata of landed cost 2
= 11000 + (1000 * 4/5)
= 11800
This is not correct. The whole value of the second landed cost should be
taken into account for the `value` field. The prorata is only useful for
the field `remaining_value`.
opw-1878229
This commit is contained in:
committed by
Nicolas Martinelli
parent
0b9d4643ec
commit
2aa5c81248
@@ -107,9 +107,9 @@ class LandedCost(models.Model):
|
||||
new_landed_cost_value = line.move_id.landed_cost_value + line.additional_landed_cost
|
||||
line.move_id.write({
|
||||
'landed_cost_value': new_landed_cost_value,
|
||||
'value': line.move_id.value + cost_to_add,
|
||||
'value': line.move_id.value + line.additional_landed_cost,
|
||||
'remaining_value': line.move_id.remaining_value + cost_to_add,
|
||||
'price_unit': (line.move_id.value + cost_to_add) / line.move_id.product_qty,
|
||||
'price_unit': (line.move_id.value + line.additional_landed_cost) / line.move_id.product_qty,
|
||||
})
|
||||
# `remaining_qty` is negative if the move is out and delivered proudcts that were not
|
||||
# in stock.
|
||||
|
||||
Reference in New Issue
Block a user