Skip to content

Commit

Permalink
Merge 6fd7db8 into 6b60101
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Oct 29, 2014
2 parents 6b60101 + 6fd7db8 commit 807e178
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
7 changes: 4 additions & 3 deletions account_statement_coda_import/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
bank statement completion framework of the bank-statement-reconcile
OCA project (https://github.com/OCA/bank-statement-reconcile)
This module allows you to import your bank transactions with a standard **CODA**
file (you'll find samples in the 'data' folder). It respects the chosen profile
(model provided by the account_statement_ext module) to generate the entries.
This module allows you to import your bank transactions with a standard
**CODA** file (you'll find samples in the 'data' folder). It respects the
chosen profile (model provided by the account_statement_ext module) to
generate the entries.
.. important::
The module requires the python library
Expand Down
6 changes: 3 additions & 3 deletions account_statement_coda_import/parser/coda_file_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ def get_st_vals(self):
def get_st_line_vals(self, line, *args, **kwargs):
"""
This method must return a dict of vals that can be passed to create
method of statement line in order to record it. It is the responsibility
of every parser to give this dict of vals, so each one can implement his
own way of recording the lines.
method of statement line in order to record it. It is the
responsibility of every parser to give this dict of vals,
so each one can implement his own way of recording the lines.
:param: line: a dict of vals that represent a line of
result_row_list
:return: dict of values to give to the create method of
Expand Down
3 changes: 2 additions & 1 deletion account_statement_coda_import/statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,5 @@ def prepare_statement_vals(self, cr, uid, profile_id, result_row_list,
L10NBECodaFileParser.parser_name]:
self.validate_statement(cr, uid, profile_id, parser, context)
args = (cr, uid, profile_id, result_row_list, parser, context)
return super(AccountStatementProfil, self).prepare_statement_vals(*args)
return super(AccountStatementProfil, self)\
.prepare_statement_vals(*args)
18 changes: 12 additions & 6 deletions account_statement_coda_import/tests/test_coda_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def test_statement_validation(self):
"""
statement_acc_number = 'BE86407051416150'
partner_id = self.ref('base.main_partner')
file_name = self._to_abs_filename('Coda_iban_v2_3_single_statement.txt')
file_name = self._to_abs_filename(
'Coda_iban_v2_3_single_statement.txt')
# try to import a Coda file with a statement bank account not defined
# in the system
with self.assertRaisesRegexp(except_osv,
Expand All @@ -121,7 +122,8 @@ def test_statement_validation(self):
'partner_id': partner_id})
with self.assertRaisesRegexp(except_osv,
"(u'Not supported CODA file', u\"No "
"Account Journal defined for bank account "
"Account Journal defined for "
"bank account "
"named \'test\' for account number "
"\'BE86407051416150\'\")"):
self._import_coda_file(file_name)
Expand All @@ -133,7 +135,8 @@ def test_statement_validation(self):
res_bank_id,
{'journal_id': self.ref('account.cash_journal')})
with self.assertRaisesRegexp(except_osv,
"(u'Not supported CODA file', u\"The journ"
"(u'Not supported CODA file', "
"u\"The journ"
"al \'Cash Journal - \(test\) \(EUR\)\' "
"on the Bank Account \'test\' doesn\'t "
"match the journal \'Bank Journal - "
Expand All @@ -142,7 +145,8 @@ def test_statement_validation(self):

def test_signle_statement_import(self):
self._add_res_bank('BE86407051416150')
file_name = self._to_abs_filename('Coda_iban_v2_3_single_statement.txt')
file_name = self._to_abs_filename(
'Coda_iban_v2_3_single_statement.txt')
statements = self._import_coda_file(file_name)
self.assertEqual(1, len(statements))
statement = statements[0]
Expand All @@ -157,7 +161,8 @@ def test_signle_statement_import(self):
# common infos
self.assertEqual(st_line_obj['name'],
'OVERBOEKING NAAR CENTRALE '
'REKENING\nOVERBOEKING NAAR CENTRALE REKENING')
'REKENING\nOVERBOEKING NAAR '
'CENTRALE REKENING')
self.assertEqual(st_line_obj['amount'], -15.0)
# additional info provided by CODA
# check that the bank information are correctly filled
Expand All @@ -169,7 +174,8 @@ def test_signle_statement_import(self):

def test_multi_statements_import(self):
self._add_res_bank('BE13001676096039')
file_name = self._to_abs_filename('Coda_iban_v2_3_multi_statements.txt')
file_name = self._to_abs_filename(
'Coda_iban_v2_3_multi_statements.txt')
statements = self._import_coda_file(file_name)
self.assertEqual(2, len(statements))
if statements[0].name == '2014/037':
Expand Down

0 comments on commit 807e178

Please sign in to comment.