From d9a32af55ad3100c6d3c972cd7cca7e020764aef Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Fri, 5 Sep 2025 16:57:23 +0200 Subject: [PATCH] [FIX] stack trace when OE camt parser discards a transaction line The Odoo Enterprise CAMT parser may drop transactions during import e.g. in case of duplicates or when a 0.00 amount transaction is added to give some banking information via the CAMT file. This PR fixes a stack trace that occurs when that happens. --- account_ebics/models/ebics_file.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index 882092d..4bc82dc 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -256,14 +256,18 @@ class EbicsFile(models.Model): errors = [] warnings = [] for notif in notifications: - if isinstance(notif, dict) and notif["type"] == "error": - error_cnt += 1 - parts = [notif[k] for k in notif if k in ("message", "details")] - errors.append("\n".join(parts)) - elif isinstance(notif, dict) and notif["type"] == "warning": - warning_cnt += 1 - parts = [notif[k] for k in notif if k in ("message", "details")] - warnings.append("\n".join(parts)) + if isinstance(notif, dict): + if notif.get("type") == "error": + error_cnt += 1 + parts = [notif[k] for k in notif if k in ("message", "details")] + errors.append("\n".join(parts) + "\n") + elif notif.get("type") == "warning": + warning_cnt += 1 + parts = [notif[k] for k in notif if k in ("message", "details")] + warnings.append("\n".join(parts) + "\n") + else: + warning_cnt += 1 + warnings.append(": ".join([*next(iter(notif.items()))]) + "\n") elif isinstance(notif, str): warning_cnt += 1 warnings.append(notif + "\n")