From 8a098df7e6a9867d25faeee4e7ae4e29a9b9a613 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 23 Feb 2016 15:14:58 +0100 Subject: [PATCH] [FIX] account_asset: can't adapt browse record to id During the conversion of the module `account_asset` to the new API, in revision 6120bab, the variables `current_currency` & `company_currency` have been changed from identifier integers to browse records. The currency passed in the `create` method values must therefore be adapted according to this change. This prevented the correct use of the assets when the currency of the assets was not the same as the currency of the company. opw-669571 --- addons/account_asset/account_asset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index eebbd041083..35d4228c71c 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -380,7 +380,7 @@ class AccountAssetDepreciationLine(models.Model): 'period_id': periods.id or False, 'journal_id': journal_id, 'partner_id': partner_id, - 'currency_id': company_currency != current_currency and current_currency or False, + 'currency_id': company_currency != current_currency and current_currency.id or False, 'amount_currency': company_currency != current_currency and - sign * line.amount or 0.0, 'analytic_account_id': line.asset_id.category_id.account_analytic_id.id if categ_type == 'sale' else False, 'date': depreciation_date, @@ -396,7 +396,7 @@ class AccountAssetDepreciationLine(models.Model): 'period_id': periods.id or False, 'journal_id': journal_id, 'partner_id': partner_id, - 'currency_id': company_currency != current_currency and current_currency or False, + 'currency_id': company_currency != current_currency and current_currency.id or False, 'amount_currency': company_currency != current_currency and sign * line.amount or 0.0, 'analytic_account_id': line.asset_id.category_id.account_analytic_id.id if categ_type == 'purchase' else False, 'date': depreciation_date,