[FIX] account_statement_import_online_gocardless: Fallback to journal company

If the bank account is shared across multiple companies (no assigned company_id),
we can't launch the "Select Bank Account Identifier" wizard, so we fallback
to the journal company for getting the country.

TT43849
This commit is contained in:
Pedro M. Baeza
2023-12-26 11:41:17 +01:00
committed by Nicolas JEUDY
parent 1c06355727
commit 4faed3e1c5

View File

@@ -101,7 +101,9 @@ class OnlineBankStatementProvider(models.Model):
_("To continue configure bank account on journal %s")
% (self.journal_id.display_name)
)
country = self.journal_id.bank_account_id.company_id.country_id
country = (
self.journal_id.bank_account_id.company_id or self.journal_id.company_id
).country_id
response = requests.get(
f"{GOCARDLESS_ENDPOINT}/institutions/",
params={"country": country.code},