Skip to content
Snippets Groups Projects
Commit bd025cda authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] stock_landed_costs: former_cost_per_unit precision

The precision of `former_cost_per_unit` should not be set. Indeed, a
stock move can contain several quants with different unit prices.
Therefore, we should not round the field when stored, otherwise the
difference per unit will not be calculated correctly.

This is a workaround since we cannot change the DB structure in stable.

opw-675222
parent 85fd9721
Branches
Tags
No related merge requests found
......@@ -230,7 +230,8 @@ class stock_landed_cost(osv.osv):
if not line.move_id:
continue
per_unit = line.final_cost / line.quantity
diff = per_unit - line.former_cost_per_unit
# FORWARDPORT UP TO SAAS-10
diff = per_unit - (line.former_cost / line.quantity if line.quantity else 1.0)
quants = [quant for quant in line.move_id.quant_ids]
quant_dict = {}
for quant in quants:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment