[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
This commit is contained in:
Nicolas Martinelli 2016-04-20 10:54:08 +02:00
parent 85fd972149
commit bd025cda6a
1 changed files with 2 additions and 1 deletions

View File

@ -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: