[FIX] account_asset: wrong currency to compute the residual amount of an asset
The result of the residual amount of an asset is : asset.purchase_value - amount - asset.salvage_value where purchase_value and asset.salvage_value are in the currency of the asset. Amount is the difference between debit and credit of an account move line expressed in the currency of the company. This is why the amount must be convert in the currency of the asset.
This commit is contained in:
parent
373b560511
commit
e2ccc5709b
|
@ -212,7 +212,10 @@ class account_asset_asset(osv.osv):
|
|||
l.asset_id IN %s GROUP BY l.asset_id """, (tuple(ids),))
|
||||
res=dict(cr.fetchall())
|
||||
for asset in self.browse(cr, uid, ids, context):
|
||||
res[asset.id] = asset.purchase_value - res.get(asset.id, 0.0) - asset.salvage_value
|
||||
company_currency = asset.company_id.currency_id.id
|
||||
current_currency = asset.currency_id.id
|
||||
amount = self.pool['res.currency'].compute(cr, uid, company_currency, current_currency, res.get(asset.id, 0.0), context=context)
|
||||
res[asset.id] = asset.purchase_value - amount - asset.salvage_value
|
||||
for id in ids:
|
||||
res.setdefault(id, 0.0)
|
||||
return res
|
||||
|
|
Loading…
Reference in New Issue