mirror of
https://github.com/OCA/bank-statement-import.git
synced 2025-01-20 12:37:43 +02:00
[FIX] account_bank_statement_import_camt_oca: Fix exception case
For avoiding collapsing with other importers.
This commit is contained in:
committed by
Iryna Vyshnevska
parent
bea747b95b
commit
f81407666e
@@ -2,7 +2,7 @@
|
|||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||||
{
|
{
|
||||||
"name": "CAMT Format Bank Statements Import",
|
"name": "CAMT Format Bank Statements Import",
|
||||||
"version": "13.0.1.0.0",
|
"version": "13.0.1.0.1",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"author": "Therp BV, Odoo Community Association (OCA)",
|
"author": "Therp BV, Odoo Community Association (OCA)",
|
||||||
"website": "https://github.com/OCA/bank-statement-import",
|
"website": "https://github.com/OCA/bank-statement-import",
|
||||||
|
|||||||
@@ -242,8 +242,11 @@ class CamtParser(models.AbstractModel):
|
|||||||
try:
|
try:
|
||||||
root = etree.fromstring(data, parser=etree.XMLParser(recover=True))
|
root = etree.fromstring(data, parser=etree.XMLParser(recover=True))
|
||||||
except etree.XMLSyntaxError:
|
except etree.XMLSyntaxError:
|
||||||
# ABNAmro is known to mix up encodings
|
try:
|
||||||
root = etree.fromstring(data.decode("iso-8859-15").encode("utf-8"))
|
# 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:
|
if root is None:
|
||||||
raise ValueError("Not a valid xml file, or not an xml file at all.")
|
raise ValueError("Not a valid xml file, or not an xml file at all.")
|
||||||
ns = root.tag[1 : root.tag.index("}")]
|
ns = root.tag[1 : root.tag.index("}")]
|
||||||
|
|||||||
Reference in New Issue
Block a user