diff options
| author | Joren Van Onder <jov@odoo.com> | 2018-01-08 18:18:59 -0800 |
|---|---|---|
| committer | Joren Van Onder <jov@odoo.com> | 2018-01-12 11:14:09 -0800 |
| commit | 11c73cd0aa2ff9cbfde8e5eebf3f22dfa1c805f1 (patch) | |
| tree | dac8646c62c47b9456154fd5f67d7e3321b36c48 /addons | |
| parent | 26d3b77a1de2472a7ce69210dc6aef7f7a615e69 (diff) | |
[FIX] stock_landed_cost: round former_cost of valuations for total_cost
When computing the total_cost of a landed cost make sure to round the
individual costs of the valuation lines the same way as done by the
ORM (i.e. with the 'Product price' precision).
Otherwise the sum of the additional costs on the valuation lines will
not equal the price of the cost lines. This is wrong and leads to
errors during validation.
opw-804396
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/stock_landed_costs/stock_landed_costs.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/stock_landed_costs/stock_landed_costs.py b/addons/stock_landed_costs/stock_landed_costs.py index 6c0423d7e38..3c0dfbc06e7 100644 --- a/addons/stock_landed_costs/stock_landed_costs.py +++ b/addons/stock_landed_costs/stock_landed_costs.py @@ -288,9 +288,13 @@ class stock_landed_cost(osv.osv): v.update({'cost_id': cost.id, 'cost_line_id': line.id}) self.pool.get('stock.valuation.adjustment.lines').create(cr, uid, v, context=context) total_qty += v.get('quantity', 0.0) - total_cost += v.get('former_cost', 0.0) total_weight += v.get('weight', 0.0) total_volume += v.get('volume', 0.0) + + former_cost = v.get('former_cost', 0.0) + # round this because former_cost on the valuation lines is also rounded + total_cost += float_round(former_cost, precision_digits=digits[1]) if digits else former_cost + total_line += 1 for line in cost.cost_lines: |
