[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
This commit is contained in:
Laurent Smet
2021-02-11 17:16:35 +00:00
parent 51658de601
commit ff9129eabc
+3 -2
View File
@@ -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: