mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[FIX] Better message for not determined journal. (#86)
* [FIX] Better message for not determined journal. * [FIX] Only check first (and constant) part of message in text. Test on import bank statement checked exception message for wrong journal. Part of message has become variable, so test had to be adapted.
This commit is contained in:
committed by
Stefan Rijnhart (Opener)
parent
3d2dc86056
commit
f1900c6a33
@@ -150,7 +150,11 @@ class AccountBankStatementImport(models.TransientModel):
|
||||
journal_id = self._get_journal(currency_id, bank_account_id)
|
||||
# By now journal and account_number must be known
|
||||
if not journal_id:
|
||||
raise UserError(_('Can not determine journal for import.'))
|
||||
raise UserError(
|
||||
_('Can not determine journal for import'
|
||||
' for account number %s and currency %s.') %
|
||||
(account_number, currency_code)
|
||||
)
|
||||
# Prepare statement data to be used for bank statements creation
|
||||
stmt_vals = self._complete_statement(
|
||||
stmt_vals, journal_id, account_number)
|
||||
|
||||
@@ -75,8 +75,9 @@ class TestAccountBankStatementImport(TransactionCase):
|
||||
self.statement_import_model._create_bank_account('123456789')
|
||||
with self.assertRaises(UserError) as e:
|
||||
self.statement_import_model._import_statement(stmt_vals.copy())
|
||||
self.assertEqual(e.exception.message,
|
||||
'Can not determine journal for import.')
|
||||
self.assertEqual(
|
||||
e.exception.message[:25], 'Can not determine journal'
|
||||
)
|
||||
|
||||
def test_create_bank_account(self):
|
||||
"""Checks that the bank_account created by the import belongs to the
|
||||
|
||||
Reference in New Issue
Block a user