diff --git a/account_bank_statement_import_camt_oca/__manifest__.py b/account_bank_statement_import_camt_oca/__manifest__.py index f2ca11a..64b4978 100644 --- a/account_bank_statement_import_camt_oca/__manifest__.py +++ b/account_bank_statement_import_camt_oca/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'CAMT Format Bank Statements Import', - 'version': '11.0.1.0.0', + 'version': '11.0.1.0.1', '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_oca/models/parser.py b/account_bank_statement_import_camt_oca/models/parser.py index 0668422..1176c79 100644 --- a/account_bank_statement_import_camt_oca/models/parser.py +++ b/account_bank_statement_import_camt_oca/models/parser.py @@ -181,10 +181,12 @@ class CamtParser(models.AbstractModel): for entry_node in entry_nodes: transactions.extend(self.parse_entry(ns, entry_node)) result['transactions'] = transactions - result['date'] = sorted(transactions, - key=lambda x: x['date'], - reverse=True - )[0]['date'] + result['date'] = None + if transactions: + result['date'] = sorted(transactions, + key=lambda x: x['date'], + reverse=True + )[0]['date'] return result def check_version(self, ns, root): diff --git a/account_bank_statement_import_camt_oca/test_files/golden-camt053-no-ntry.pydata b/account_bank_statement_import_camt_oca/test_files/golden-camt053-no-ntry.pydata new file mode 100644 index 0000000..ca89faa --- /dev/null +++ b/account_bank_statement_import_camt_oca/test_files/golden-camt053-no-ntry.pydata @@ -0,0 +1 @@ +(None, None, []) diff --git a/account_bank_statement_import_camt_oca/test_files/test-camt053-no-ntry b/account_bank_statement_import_camt_oca/test_files/test-camt053-no-ntry new file mode 100644 index 0000000..03f8f62 --- /dev/null +++ b/account_bank_statement_import_camt_oca/test_files/test-camt053-no-ntry @@ -0,0 +1,52 @@ + + + + TESTBANK/NL/1420561226673 + 2014-01-06T16:20:26.673Z + + + 1234Test/1 + 2 + 2014-01-06T16:20:26.673Z + + 2014-01-05T00:00:00.000Z + 2014-01-05T23:59:59.999Z + + + + NL77ABNA0574908765 + + Example company + + + ABNANL2A + + + + + + + OPBD + + + 1520.76 + CRDT +
+
2014-01-05
+ +
+ + + + CLBD + + + 1520.76 + CRDT +
+
2014-01-05
+ +
+
+
+
diff --git a/account_bank_statement_import_camt_oca/tests/test_import_bank_statement.py b/account_bank_statement_import_camt_oca/tests/test_import_bank_statement.py index d96b051..5235f35 100644 --- a/account_bank_statement_import_camt_oca/tests/test_import_bank_statement.py +++ b/account_bank_statement_import_camt_oca/tests/test_import_bank_statement.py @@ -57,6 +57,11 @@ class TestParser(TransactionCase): 'test-camt053-txdtls', 'golden-camt053-txdtls.pydata') + def test_parse_no_ntry(self): + self._do_parse_test( + 'test-camt053-no-ntry', + 'golden-camt053-no-ntry.pydata') + class TestImport(TransactionCase): """Run test to import camt import."""