[FIX] stock_landed_costs: precision

Oversight of commit bd025cda.
I'm an idiot, I should have checked that another solution was applied
from 9.0 with accounting refactoring. We apply it here as well.
This commit is contained in:
Nicolas Martinelli 2016-04-20 14:05:32 +02:00
parent eb26694e0f
commit b112631bef
1 changed files with 3 additions and 4 deletions

View File

@ -230,8 +230,7 @@ class stock_landed_cost(osv.osv):
if not line.move_id:
continue
per_unit = line.final_cost / line.quantity
# FORWARDPORT UP TO SAAS-10
diff = per_unit - (line.former_cost / line.quantity if line.quantity else 1.0)
diff = per_unit - line.former_cost_per_unit
# If the precision required for the variable diff is larger than the accounting
# precision, inconsistencies between the stock valuation and the accounting entries
@ -411,9 +410,9 @@ class stock_valuation_adjustment_lines(osv.osv):
'weight': fields.float('Weight', digits_compute=dp.get_precision('Product Unit of Measure')),
'volume': fields.float('Volume', digits_compute=dp.get_precision('Product Unit of Measure')),
'former_cost': fields.float('Former Cost', digits_compute=dp.get_precision('Product Price')),
'former_cost_per_unit': fields.function(_amount_final, multi='cost', string='Former Cost(Per Unit)', type='float', digits_compute=dp.get_precision('Account'), store=True),
'former_cost_per_unit': fields.function(_amount_final, multi='cost', string='Former Cost(Per Unit)', type='float', store=True, digits=0),
'additional_landed_cost': fields.float('Additional Landed Cost', digits_compute=dp.get_precision('Product Price')),
'final_cost': fields.function(_amount_final, multi='cost', string='Final Cost', type='float', digits_compute=dp.get_precision('Account'), store=True),
'final_cost': fields.function(_amount_final, multi='cost', string='Final Cost', type='float', store=True, digits=0),
}
_defaults = {