[FIX] account_bank_statement_import: fix crash when there's no import format available
When you run the setup wizard to add a bank from the setup bar, it will write 'file_import' on the field 'bank_statements_source'. But in the module 'account_bank_statement_import', the possible values of the field 'bank_statements_source' was updated with 'file_import' ONLY if additionnal account_bank_statement_import_xxx modules are installed. So, prior this fix, if you only had the module 'account_bank_statement_import' and no additionnal bank statement import modules, you were getting a traceback. Fixes #27423 closes odoo/odoo#27672
This commit is contained in:
@@ -10,5 +10,6 @@ class SetupBarBankConfigWizard(models.TransientModel):
|
||||
""" Default the bank statement source of new bank journals as 'file_import'
|
||||
"""
|
||||
super(SetupBarBankConfigWizard, self).validate()
|
||||
if self.create_or_link_option == 'new' or self.linked_journal_id.bank_statements_source == 'undefined':
|
||||
if self.create_or_link_option == 'new' or self.linked_journal_id.bank_statements_source == 'undefined' \
|
||||
and self.env['account.journal']._get_bank_statements_available_import_formats():
|
||||
self.linked_journal_id.bank_statements_source = 'file_import'
|
||||
|
||||
Reference in New Issue
Block a user