From ff9129eabc8d3840484375e13426f674c9a9522c Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Mon, 8 Feb 2021 13:48:11 +0000 Subject: [PATCH] [FIX] account: Don't write currency on journal's accounts everytime The currency is not always consistent between the journal and their accounts when coming from migrations. It leads to some traceback when installing l10n_us_nacha or account_sepa writing a payment method at the installation of the module in case of the journal has a foreign currency but not the account. X-original-commit: 426d5f429d85e42a31052f618a9a179148f501c4 --- addons/account/models/account_journal.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_journal.py b/addons/account/models/account_journal.py index 4bc3e09a360..bcbbba2934a 100644 --- a/addons/account/models/account_journal.py +++ b/addons/account/models/account_journal.py @@ -436,8 +436,9 @@ class AccountJournal(models.Model): result = super(AccountJournal, self).write(vals) # Ensure the liquidity accounts are sharing the same foreign currency. - for journal in self.filtered(lambda journal: journal.type in ('bank', 'cash')): - journal.default_account_id.currency_id = journal.currency_id + if 'currency_id' in vals: + for journal in self.filtered(lambda journal: journal.type in ('bank', 'cash')): + journal.default_account_id.currency_id = journal.currency_id # Create the bank_account_id if necessary if 'bank_acc_number' in vals: