Ronald Portier (Therp BV)
10 years ago
10 changed files with 199 additions and 19 deletions
-
43account_bank_statement_import/account_bank_statement_import.py
-
4account_bank_statement_import/tests/test_import_bank_statement.py
-
2bank_statement_parse/parserlib.py
-
2bank_statement_parse_mt940/mt940.py
-
3bank_statement_parse_nl_ing_mt940/__openerp__.py
-
26bank_statement_parse_nl_ing_mt940/demo/demo_data.xml
-
3bank_statement_parse_nl_ing_mt940/tests/test_import_bank_statement.py
-
29bank_statement_parse_nl_rabo_mt940/test_files/test-rabo.swi
-
25bank_statement_parse_nl_rabo_mt940/tests/__init__.py
-
81bank_statement_parse_nl_rabo_mt940/tests/test_import_bank_statement.py
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
|
|||
<record id="mt940_ing_bank_journal" model="account.journal"> |
|||
<field name="name">Bank Journal - (test mt940 ING)</field> |
|||
<field name="code">TBNKMT940ING</field> |
|||
<field name="type">bank</field> |
|||
<field name="sequence_id" ref="account.sequence_bank_journal"/> |
|||
<field name="default_debit_account_id" ref="account.bnk"/> |
|||
<field name="default_credit_account_id" ref="account.bnk"/> |
|||
<field name="user_id" ref="base.user_root"/> |
|||
</record> |
|||
|
|||
<record id="mt940_ing_company_bank" model="res.partner.bank"> |
|||
<field name="owner_name">Your Company</field> |
|||
<field name="acc_number">NL77ABNA0574908765</field> |
|||
<field name="partner_id" ref="base.partner_root"></field> |
|||
<field name="company_id" ref="base.main_company"></field> |
|||
<field name="journal_id" ref="mt940_ing_bank_journal"></field> |
|||
<field name="state">bank</field> |
|||
<field name="bank" ref="base.res_bank_1"/> |
|||
</record> |
|||
</data> |
|||
|
|||
</openerp> |
@ -0,0 +1,29 @@ |
|||
:940: |
|||
:20:940S140102 |
|||
:25:NL34RABO0142623393 EUR |
|||
:28C:0 |
|||
:60F:C131231EUR000000004433,52 |
|||
:61:140102C000000000400,00N541NONREF |
|||
NL66RABO0160878799 |
|||
:86:/ORDP//NAME/R. SMITH/ADDR/Green market 74 3311BE Sheepcity Nederl |
|||
and NL/REMI/Test money paid by other partner: |
|||
/ISDT/2014-01-02 |
|||
:62F:C140102EUR000000004833,52 |
|||
:20:940S140103 |
|||
:25:NL34RABO0142623393 EUR |
|||
:28C:0 |
|||
:60F:C140102EUR000000004833,52 |
|||
:62F:C140103EUR000000004833,52 |
|||
:20:940S140106 |
|||
:25:NL34RABO0142623393 EUR |
|||
:28C:0 |
|||
:60F:C140103EUR000000004833,52 |
|||
:61:140101D000000000034,61N093NONREF |
|||
:86:/BENM//NAME/Kosten/REMI/Periode 01-10-2013 t/m 31-12-2013/ISDT/20 |
|||
14-01-01 |
|||
:62F:C140106EUR000000004798,91 |
|||
:20:940S140107 |
|||
:25:NL34RABO0142623393 EUR |
|||
:28C:0 |
|||
:60F:C140106EUR000000004798,91 |
|||
:62F:C140107EUR000000004798,91 |
@ -0,0 +1,25 @@ |
|||
# -*- encoding: utf-8 -*- |
|||
"""Test import of bank statement for MT940 ING.""" |
|||
############################################################################## |
|||
# |
|||
# Copyright (C) 2015 Therp BV <http://therp.nl>. |
|||
# |
|||
# All other contributions are (C) by their respective contributors |
|||
# |
|||
# All Rights Reserved |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from . import test_import_bank_statement |
@ -0,0 +1,81 @@ |
|||
# -*- coding: utf-8 -*- |
|||
"""Run test to import MT940 IBAN RABO import.""" |
|||
############################################################################## |
|||
# |
|||
# Copyright (C) 2015 Therp BV <http://therp.nl>. |
|||
# |
|||
# All other contributions are (C) by their respective contributors |
|||
# |
|||
# All Rights Reserved |
|||
# |
|||
# This program is free software: you can redistribute it and/or modify |
|||
# it under the terms of the GNU Affero General Public License as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU Affero General Public License for more details. |
|||
# |
|||
# You should have received a copy of the GNU Affero General Public License |
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from openerp.tests.common import TransactionCase |
|||
from openerp.modules.module import get_module_resource |
|||
|
|||
|
|||
class TestStatementFile(TransactionCase): |
|||
"""Run test to import MT940 RABO import.""" |
|||
|
|||
def test_statement_import(self): |
|||
"""Test correct creation of single statement. |
|||
|
|||
For this test there is NOT an existing bank-account. Therefore a |
|||
bank account should automatically be created in the main company. |
|||
""" |
|||
partner_bank_model = self.env['res.partner.bank'] |
|||
import_model = self.registry('account.bank.statement.import') |
|||
statement_model = self.registry('account.bank.statement') |
|||
cr, uid = self.cr, self.uid |
|||
statement_path = get_module_resource( |
|||
'bank_statement_parse_nl_rabo_mt940', |
|||
'test_files', |
|||
'test-rabo.swi' |
|||
) |
|||
statement_file = open( |
|||
statement_path, 'rb').read().encode('base64') |
|||
bank_statement_id = import_model.create( |
|||
cr, uid, |
|||
dict( |
|||
data_file=statement_file, |
|||
) |
|||
) |
|||
import_model.import_file(cr, uid, [bank_statement_id]) |
|||
# Check wether bank account has been created: |
|||
vals = partner_bank_model.search( |
|||
[('acc_number', '=', 'NL34RABO0142623393')]) |
|||
self.assertEquals( |
|||
1, len(vals), |
|||
'Bank account not created from statement' |
|||
) |
|||
# statement name is account number + '-' + date of last 62F line: |
|||
ids = statement_model.search( |
|||
cr, uid, [('name', '=', 'NL34RABO0142623393-2014-01-07')]) |
|||
self.assertTrue(ids, 'Statement not found after parse.') |
|||
statement_id = ids[0] |
|||
statement_obj = statement_model.browse( |
|||
cr, uid, statement_id) |
|||
self.assertTrue( |
|||
abs(statement_obj.balance_start - 4433.52) < 0.00001, |
|||
'Start balance %f not equal to 4433.52' % |
|||
statement_obj.balance_start |
|||
) |
|||
self.assertTrue( |
|||
abs(statement_obj.balance_end_real - 4798.91) < 0.00001, |
|||
'Real end balance %f not equal to 4798.91' % |
|||
statement_obj.balance_end_real |
|||
) |
|||
|
|||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
Write
Preview
Loading…
Cancel
Save
Reference in new issue