diff --git a/account_bank_statement_import_camt/__openerp__.py b/account_bank_statement_import_camt/__openerp__.py index dd2195a..3189cc8 100644 --- a/account_bank_statement_import_camt/__openerp__.py +++ b/account_bank_statement_import_camt/__openerp__.py @@ -19,7 +19,7 @@ ############################################################################## { 'name': 'CAMT Format Bank Statements Import', - 'version': '8.0.0.4.0', + 'version': '8.0.0.4.1', 'summary': 'Module to import SEPA CAMT.053 Format bank statement files', 'license': 'AGPL-3', 'author': 'Odoo Community Association (OCA), Therp BV', diff --git a/account_bank_statement_import_camt/models/parser.py b/account_bank_statement_import_camt/models/parser.py index b7fe26b..6c4e188 100644 --- a/account_bank_statement_import_camt/models/parser.py +++ b/account_bank_statement_import_camt/models/parser.py @@ -44,9 +44,15 @@ class CamtParser(models.AbstractModel): sign = 1 amount = 0.0 sign_node = node.xpath('ns:CdtDbtInd', namespaces={'ns': ns}) + if not sign_node: + sign_node = node.xpath( + '../../ns:CdtDbtInd', namespaces={'ns': ns}) if sign_node and sign_node[0].text == 'DBIT': sign = -1 amount_node = node.xpath('ns:Amt', namespaces={'ns': ns}) + if not amount_node: + amount_node = node.xpath( + './ns:AmtDtls/ns:TxAmt/ns:Amt', namespaces={'ns': ns}) if amount_node: amount = sign * float(amount_node[0].text) return amount diff --git a/account_bank_statement_import_camt/test_files/test-camt053.xml b/account_bank_statement_import_camt/test_files/test-camt053.xml index 4a2a047..1f15c84 100644 --- a/account_bank_statement_import_camt/test_files/test-camt053.xml +++ b/account_bank_statement_import_camt/test_files/test-camt053.xml @@ -111,7 +111,7 @@ - 594.05 + 664.05 DBIT true BOOK @@ -134,6 +134,13 @@ + + 2014/125 + 2018/125-20141229-NORM + 2 + 664.05 + DBIT + TESTBANK/NL/20141229/01206408 @@ -175,6 +182,47 @@ Direct debit S14 0410 AC07 Rek.nummer blokkade TESTBANK/NL/20141229/01206408 + + + TESTBANK/NL/20141229/01206407 + TESTBANK/NL/20141229/01206407 + NL22ZZZ524885430000-C0125.2 + + + + 100.00 + + + + + Test Customer + + NL + + + + + NL46ABNA0499998748 + + + + + + + ABNANL2A + + + + + Direct Debit S14 0410 + + + + AC06 + + + Direct debit S14 0410 AC07 Rek.nummer blokkade TESTBANK/NL/20141229/01206408 + diff --git a/account_bank_statement_import_camt/tests/test_import_bank_statement.py b/account_bank_statement_import_camt/tests/test_import_bank_statement.py index 42e83d2..5eccc5f 100644 --- a/account_bank_statement_import_camt/tests/test_import_bank_statement.py +++ b/account_bank_statement_import_camt/tests/test_import_bank_statement.py @@ -34,6 +34,24 @@ class TestImport(TestStatementFile): 'value_date': '2014-01-05', 'ref': '435005714488-ABNO33052620', }, + { + 'remote_account': 'NL46ABNA0499998748', + 'transferred_amount': -564.05, + 'value_date': '2014-01-05', + 'ref': 'TESTBANK/NL/20141229/01206408', + }, + { + 'remote_account': 'NL46ABNA0499998748', + 'transferred_amount': -100.0, + 'value_date': '2014-01-05', + 'ref': 'TESTBANK/NL/20141229/01206407', + }, + { + 'remote_account': 'NL69ABNA0522123643', + 'transferred_amount': 1405.31, + 'value_date': '2014-01-05', + 'ref': '115', + }, ] self._test_statement_import( 'account_bank_statement_import_camt', 'test-camt053.xml',