mirror of
https://github.com/brain-tec/account_ebics.git
synced 2024-11-23 20:52:04 +00:00
[IMP][16.0]enhance _split_camt to support C52, C53 and C54
This commit is contained in:
parent
618467d81d
commit
48bdd4eee3
@ -535,7 +535,14 @@ class EbicsFile(models.Model):
|
|||||||
message = _("Invalid XML file.")
|
message = _("Invalid XML file.")
|
||||||
res["notifications"].append({"type": "error", "message": message})
|
res["notifications"].append({"type": "error", "message": message})
|
||||||
ns = {k or "ns": v for k, v in root.nsmap.items()}
|
ns = {k or "ns": v for k, v in root.nsmap.items()}
|
||||||
stmts = root[0].findall("ns:Stmt", ns)
|
camt_variant = ns["ns"].split("camt.")[1][:3]
|
||||||
|
variant_tags = {
|
||||||
|
"052": "Rpt",
|
||||||
|
"053": "Stmt",
|
||||||
|
"054": "Ntfctn",
|
||||||
|
}
|
||||||
|
camt_tag = variant_tags[camt_variant]
|
||||||
|
stmts = root[0].findall("ns:{}".format(camt_tag), ns)
|
||||||
for i, stmt in enumerate(stmts):
|
for i, stmt in enumerate(stmts):
|
||||||
acc_number = sanitize_account_number(
|
acc_number = sanitize_account_number(
|
||||||
stmt.xpath(
|
stmt.xpath(
|
||||||
@ -558,7 +565,7 @@ class EbicsFile(models.Model):
|
|||||||
|
|
||||||
root_new = deepcopy(root)
|
root_new = deepcopy(root)
|
||||||
entries = False
|
entries = False
|
||||||
for j, el in enumerate(root_new[0].findall("ns:Stmt", ns)):
|
for j, el in enumerate(root_new[0].findall("ns:{}".format(camt_tag), ns)):
|
||||||
if j != i:
|
if j != i:
|
||||||
el.getparent().remove(el)
|
el.getparent().remove(el)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user