From e61aa58a2cee546480ed6f3e34fb58fc6f87a183 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 6 Aug 2020 14:18:21 +0200 Subject: [PATCH] [FIX] account_bank_statement_import_camt_oca: Fix exception case For avoiding collapsing with other importers. --- account_bank_statement_import_camt_oca/__manifest__.py | 2 +- account_bank_statement_import_camt_oca/models/parser.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/account_bank_statement_import_camt_oca/__manifest__.py b/account_bank_statement_import_camt_oca/__manifest__.py index 10ec288d..a6e72748 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 (https://www.gnu.org/licenses/agpl.html). { "name": "CAMT Format Bank Statements Import", - "version": "13.0.1.0.0", + "version": "13.0.1.0.1", "license": "AGPL-3", "author": "Therp BV, Odoo Community Association (OCA)", "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 971b4206..a149b917 100644 --- a/account_bank_statement_import_camt_oca/models/parser.py +++ b/account_bank_statement_import_camt_oca/models/parser.py @@ -242,8 +242,11 @@ class CamtParser(models.AbstractModel): try: root = etree.fromstring(data, parser=etree.XMLParser(recover=True)) except etree.XMLSyntaxError: - # ABNAmro is known to mix up encodings - root = etree.fromstring(data.decode("iso-8859-15").encode("utf-8")) + try: + # ABNAmro is known to mix up encodings + root = etree.fromstring(data.decode("iso-8859-15").encode("utf-8")) + except etree.XMLSyntaxError: + root = None if root is None: raise ValueError("Not a valid xml file, or not an xml file at all.") ns = root.tag[1 : root.tag.index("}")]