From 0d16f0d87aaec495f726c2d2519a6615eb5c3048 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Tue, 26 Dec 2023 11:41:17 +0100 Subject: [PATCH] [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 --- .../models/online_bank_statement_provider.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/account_statement_import_online_gocardless/models/online_bank_statement_provider.py b/account_statement_import_online_gocardless/models/online_bank_statement_provider.py index 1b8ef2b5..bc63ac4f 100644 --- a/account_statement_import_online_gocardless/models/online_bank_statement_provider.py +++ b/account_statement_import_online_gocardless/models/online_bank_statement_provider.py @@ -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},