Skip to content

Commit

Permalink
[FIX] Enhance check for journal_id.
Browse files Browse the repository at this point in the history
As we now only consider bank accounts linked to a company for searching company bank accounts,
we will no longer find accounts just having an account number. The check for journal id is
only valid now for bank accounts that have a company id, but no journal_id.
  • Loading branch information
NL66278 committed Jul 2, 2017
1 parent 0c003cb commit 85e3f24
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions account_bank_statement_import/tests/test_import_bank_statement.py
Expand Up @@ -65,16 +65,23 @@ def test_import_preconditions(self):
* no bank account found for the account_number
* no account_journal found on the bank_account
"""
import_model = self.env['account.bank.statement.import']
stmt_vals = {
'currency_code': 'EUR',
'account_number': '123456789'}
'account_number': '123456789',
}
with self.assertRaises(UserError) as e:
self.statement_import_model._import_statement(stmt_vals.copy())
self.assertEqual(e.exception.message,
'Can not find the account number 123456789.')
self.statement_import_model._create_bank_account('123456789')
import_model._import_statement(stmt_vals.copy())
self.assertEqual(
e.exception.message,
'Can not find the account number 123456789.'
)
new_bank = import_model._create_bank_account('123456789')
# Need company_id on bank, otherwise we will not even reach
# the check for the journal_id:
new_bank.write({'company_id': self.env.user.company_id.id})
with self.assertRaises(UserError) as e:
self.statement_import_model._import_statement(stmt_vals.copy())
import_model._import_statement(stmt_vals.copy())
self.assertEqual(
e.exception.message[:25], 'Can not determine journal'
)
Expand Down

0 comments on commit 85e3f24

Please sign in to comment.