[FIX] account_bank_statement_import: journal without default credit/debit account

A traceback was raised when importing a statement for a journal without default credit/debit account.

opw:742196
This commit is contained in:
Goffin Simon
2017-05-18 09:21:26 +02:00
parent e7da75dd3c
commit 64eb5ce48e
2 changed files with 8 additions and 0 deletions
@@ -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
@@ -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"