[FIX] account: prevent traceback when creating new bank account

When the `account.journal.bank_statement_source` field is validated at that time
it won't be able to find the `file_import` value in the options of this selection
field as they are dynamically generated and the `file_import` value is generated
in the `account_bank_statement_import` module which is not installed.
So, it will cause Error.

Steps to reproduce :
 1. Install only `account` module
 2. Click on Configuration > Add Bank Account.
 3. Fill up the details. The `Journal` field should be left empty.
 4. Click on Create.

closes odoo/odoo#120923

Sentry: - 4042261837
X-original-commit: eda822ce7c3884350ecfb8bbb10accfe7ff5acf4
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
This commit is contained in:
Sanket Brahmbhatt
2023-05-10 06:33:42 +02:00
parent 70648b064d
commit 5ddd39b5b7
+1 -1
View File
@@ -139,7 +139,7 @@ class SetupBarBankConfigWizard(models.TransientModel):
'type': 'bank',
'company_id': company.id,
'bank_account_id': record.res_partner_bank_id.id,
'bank_statements_source': 'file_import',
'bank_statements_source': 'undefined',
})
else:
selected_journal.bank_account_id = record.res_partner_bank_id.id