From 05ef0790c955b1b7fcde85bb66b8451cb687d71b Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 13 Jun 2017 14:35:11 +0200 Subject: [PATCH] [FIX] account_asset: depreciation rate date - Activate multi-currency - Define a rate today (e.g. 2017-06-01) and next month (e.g. 2017-07-01) - Create a deferred revenue on 2017-07-02 in the foreign currency - Post the first line The rate taken is the rate of today, not the rate of next month. opw-745509 --- addons/account_asset/account_asset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index 68bbbb33167..e0865a77981 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -431,7 +431,7 @@ class AccountAssetDepreciationLine(models.Model): depreciation_date = self.env.context.get('depreciation_date') or line.depreciation_date or fields.Date.context_today(self) company_currency = line.asset_id.company_id.currency_id current_currency = line.asset_id.currency_id - amount = current_currency.compute(line.amount, company_currency) + amount = current_currency.with_context(date=depreciation_date).compute(line.amount, company_currency) asset_name = line.asset_id.name + ' (%s/%s)' % (line.sequence, len(line.asset_id.depreciation_line_ids)) reference = line.asset_id.code journal_id = line.asset_id.category_id.journal_id.id