From e2ccc5709b1b4909eb857d77ebb2e21c9a5c7fb9 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 16 Mar 2015 09:49:41 +0100 Subject: [PATCH] [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. --- addons/account_asset/account_asset.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index 59a3bdc825b..ffa0b75dc8c 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -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