mirror of
https://github.com/brain-tec/account_ebics.git
synced 2026-12-01 14:01:15 +00:00
[FIX] account_ebics - Stop camt split on an invalid XML file
The error was noted but processing went on with root.nsmap, raising an AttributeError. Unparseable content now also yields the "Invalid XML file." notification instead of an XMLSyntaxError.
This commit is contained in:
1 parent
f14a02953b
commit
315f690023
2 files changed
+6
-2
No files matched your search
@@ -5,7 +5,7 @@
|
||||
"name": "EBICS Banking Protocol",
|
||||
"summary": "Download bank statements and upload payment "
|
||||
"files directly from Odoo, using the European EBICS standard",
|
||||
"version": "19.0.1.3.2",
|
||||
"version": "19.0.1.3.3",
|
||||
"license": "LGPL-3",
|
||||
"author": "Noviat",
|
||||
"website": "https://www.noviat.com/",
|
||||
|
||||
@@ -565,10 +565,14 @@ class EbicsFile(models.Model):
|
||||
"""
|
||||
datas = []
|
||||
file_data = base64.b64decode(self.data)
|
||||
root = etree.fromstring(file_data, parser=etree.XMLParser(recover=True))
|
||||
try:
|
||||
root = etree.fromstring(file_data, parser=etree.XMLParser(recover=True))
|
||||
except etree.XMLSyntaxError:
|
||||
root = None
|
||||
if root is None:
|
||||
message = self.env._("Invalid XML file.")
|
||||
res["notifications"].append({"type": "error", "message": message})
|
||||
return datas
|
||||
ns = {k or "ns": v for k, v in root.nsmap.items()}
|
||||
camt_variant = ns["ns"].split("camt.")[1][:3]
|
||||
variant_tags = {
|
||||
|
||||
Reference in new issue
Block a user