diff --git a/account_bank_statement_import_camt/__openerp__.py b/account_bank_statement_import_camt/__openerp__.py index a59c096..86ce0c5 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.3.0', + 'version': '8.0.0.4.0', 'license': 'AGPL-3', 'author': 'Odoo Community Association (OCA), Therp BV', 'website': 'https://github.com/OCA/bank-statement-import', diff --git a/account_bank_statement_import_camt/camt.py b/account_bank_statement_import_camt/camt.py index 96e7a51..aed01db 100644 --- a/account_bank_statement_import_camt/camt.py +++ b/account_bank_statement_import_camt/camt.py @@ -69,7 +69,7 @@ class CamtParser(object): './ns:RmtInf/ns:Ustrd', './ns:AddtlTxInf', './ns:AddtlNtryInf', - ], transaction, 'message') + ], transaction, 'message', join_str='\n') # eref self.add_value_from_node( ns, node, [ @@ -137,6 +137,13 @@ class CamtParser(object): if not transaction.message: self.add_value_from_node( ns, node, './ns:AddtlNtryInf', transaction, 'message') + if not transaction.eref: + self.add_value_from_node( + ns, node, [ + './ns:NtryDtls/ns:Btch/ns:PmtInfId', + ], + transaction, 'eref' + ) transaction.data = etree.tostring(node) return transaction 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 1d74d81..4a2a047 100644 --- a/account_bank_statement_import_camt/test_files/test-camt053.xml +++ b/account_bank_statement_import_camt/test_files/test-camt053.xml @@ -2,15 +2,15 @@ TESTBANK/NL/1420561226673 - 2013-01-06T16:20:26.673Z + 2014-01-06T16:20:26.673Z 1234Test/1 2 - 2013-01-06T16:20:26.673Z + 2014-01-06T16:20:26.673Z - 2013-01-05T00:00:00.000Z - 2013-01-05T23:59:59.999Z + 2014-01-05T00:00:00.000Z + 2014-01-05T23:59:59.999Z @@ -32,7 +32,7 @@ 15568.27 CRDT
-
2013-01-05
+
2014-01-05
@@ -44,7 +44,7 @@ 15121.12 CRDT
-
2013-01-05
+
2014-01-05
@@ -52,10 +52,10 @@ DBIT BOOK -
2013-01-05
+
2014-01-05
-
2013-01-05
+
2014-01-05
@@ -104,9 +104,9 @@ - Insurance policy 857239PERIOD 01.01.2013 - 31.12.2013 + Insurance policy 857239PERIOD 01.01.2014 - 31.12.2014 - MKB Insurance 859239PERIOD 01.01.2013 - 31.12.2013 + MKB Insurance 859239PERIOD 01.01.2014 - 31.12.2014
@@ -116,10 +116,10 @@ true BOOK -
2013-01-05
+
2014-01-05
-
2013-01-05
+
2014-01-05
@@ -182,10 +182,10 @@ CRDT BOOK -
2013-01-05
+
2014-01-05
-
2013-01-05
+
2014-01-05
@@ -202,7 +202,7 @@ - INNDNL2U20130105000217200000708 + INNDNL2U20140105000217200000708 115 diff --git a/account_bank_statement_import_camt/test_files/test-camt053.zip b/account_bank_statement_import_camt/test_files/test-camt053.zip new file mode 100644 index 0000000..ccf5b3c Binary files /dev/null and b/account_bank_statement_import_camt/test_files/test-camt053.zip differ 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 8a1694f..d14aca9 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 @@ -31,11 +31,10 @@ class TestImport(TestStatementFile): { 'remote_account': 'NL46ABNA0499998748', 'transferred_amount': -754.25, - 'value_date': '2013-01-05', + 'value_date': '2014-01-05', 'ref': '435005714488-ABNO33052620', }, ] - # statement name is account number + '-' + date of last 62F line: self._test_statement_import( 'account_bank_statement_import_camt', 'test-camt053.xml', '1234Test/1', @@ -43,3 +42,11 @@ class TestImport(TestStatementFile): start_balance=15568.27, end_balance=15121.12, transactions=transactions ) + + def test_zip_import(self): + """Test import of multiple statements from zip file.""" + self._test_statement_import( + 'account_bank_statement_import_camt', 'test-camt053.zip', + '1234Test/2', # Only name of first statement + local_account='NL77ABNA0574908765', + )