mirror of
https://github.com/brain-tec/account_ebics.git
synced 2026-11-06 10:00:39 +00:00
[FIX] account_ebics - Report camt statements without account number
The xpath result was indexed before the emptiness check, so a statement without IBAN or other account id raised an IndexError instead of the "No bank account number found." notification.
This commit is contained in:
1 parent
3585c85298
commit
f2d9f1138a
1 file changed
+4
-5
@@ -586,12 +586,11 @@ class EbicsFile(models.Model):
|
||||
camt_tag = variant_tags[camt_variant]
|
||||
stmts = root[0].findall(f"ns:{camt_tag}", ns)
|
||||
for i, stmt in enumerate(stmts):
|
||||
acc_number = sanitize_account_number(
|
||||
stmt.xpath(
|
||||
"ns:Acct/ns:Id/ns:IBAN/text() | ns:Acct/ns:Id/ns:Othr/ns:Id/text()",
|
||||
namespaces=ns,
|
||||
)[0]
|
||||
acc_ids = stmt.xpath(
|
||||
"ns:Acct/ns:Id/ns:IBAN/text() | ns:Acct/ns:Id/ns:Othr/ns:Id/text()",
|
||||
namespaces=ns,
|
||||
)
|
||||
acc_number = acc_ids and sanitize_account_number(acc_ids[0])
|
||||
if not acc_number:
|
||||
message = self.env._("No bank account number found.")
|
||||
res["notifications"].append({"type": "error", "message": message})
|
||||
|
||||
Reference in new issue
Block a user