diff --git a/addons/account_bank_statement_import/account_bank_statement_import.py b/addons/account_bank_statement_import/account_bank_statement_import.py index 2d45a95612d..48789440432 100644 --- a/addons/account_bank_statement_import/account_bank_statement_import.py +++ b/addons/account_bank_statement_import/account_bank_statement_import.py @@ -43,6 +43,8 @@ class AccountBankStatementImport(models.TransientModel): if not journal: # The active_id is passed in context so the wizard can call import_file again once the journal is created return self.with_context(active_id=self.ids[0])._journal_creation_wizard(currency, account_number) + if not journal.default_debit_account_id or not journal.default_credit_account_id: + raise UserError(_('You have to set a Default Debit Account and a Default Credit Account for the journal: %s') % (journal.name,)) # Prepare statement data to be used for bank statements creation stmts_vals = self._complete_stmts_vals(stmts_vals, journal, account_number) # Create the bank statements diff --git a/addons/account_bank_statement_import/i18n/account_bank_statement_import.pot b/addons/account_bank_statement_import/i18n/account_bank_statement_import.pot index 45c656b4c02..00f7ec6740e 100644 --- a/addons/account_bank_statement_import/i18n/account_bank_statement_import.pot +++ b/addons/account_bank_statement_import/i18n/account_bank_statement_import.pot @@ -482,6 +482,12 @@ msgstr "" msgid "You have already imported that file." msgstr "" +#. module: account_bank_statement_import +#: code:addons/account_bank_statement_import/account_bank_statement_import.py:47 +#, python-format +msgid "You have to set a Default Debit Account and a Default Credit Account for the journal: %s" +msgstr "" + #. module: account_bank_statement_import #: model:ir.ui.view,arch_db:account_bank_statement_import.account_bank_statement_import_view msgid "_Import"