From cc3f1a48b7f6b1de1ccf38141776ef4f5193ded3 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Sun, 8 Oct 2023 22:19:22 +0200 Subject: [PATCH] [15.0]account_ebics_oe_statement_import - fix handling of notifications --- account_ebics/__manifest__.py | 2 +- account_ebics/models/ebics_file.py | 12 ++++++++---- account_ebics_oe_statement_import/__manifest__.py | 4 ++-- .../wizards/account_bank_statement_import.py | 11 ++++++++--- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/account_ebics/__manifest__.py b/account_ebics/__manifest__.py index deecbf2..b4f0181 100644 --- a/account_ebics/__manifest__.py +++ b/account_ebics/__manifest__.py @@ -3,7 +3,7 @@ { "name": "EBICS banking protocol", - "version": "15.0.1.1.3", + "version": "15.0.1.1.4", "license": "LGPL-3", "author": "Noviat", "website": "https://www.noviat.com/", diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index 6751502..220533d 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -169,7 +169,7 @@ class EbicsFile(models.Model): return False return True - def _process_result_action(self, res_action): + def _process_result_action(self, res_action): # noqa: C901 notifications = [] st_line_ids = [] statement_ids = [] @@ -219,9 +219,13 @@ class EbicsFile(models.Model): error_cnt += 1 elif notif["type"] == "warning": warning_cnt += 1 - parts = [ - notif[k] for k in notif if k in ("message", "details") and notif[k] - ] + parts = [] + if notif.get("message"): + parts.append(notif["message"]) + if notif.get("details"): + for k in ("name", "model", "ids"): + if notif["details"][k]: + parts.append(str(notif["details"][k])) self.note_process += "\n".join(parts) self.note_process += "\n\n" if error_cnt: diff --git a/account_ebics_oe_statement_import/__manifest__.py b/account_ebics_oe_statement_import/__manifest__.py index 4030df1..9292b45 100644 --- a/account_ebics_oe_statement_import/__manifest__.py +++ b/account_ebics_oe_statement_import/__manifest__.py @@ -1,10 +1,10 @@ -# Copyright 2020-2022 Noviat. +# Copyright 2020-2023 Noviat. # License LGPL-3 or later (http://www.gnu.org/licenses/lpgl). { "name": "account_ebics with Odoo Enterprise Bank Statement Import", "summary": "Use Odoo Enterprise Bank Statement Import with account_ebics", - "version": "15.0.1.0.0", + "version": "15.0.1.0.1", "author": "Noviat", "website": "https://www.noviat.com/", "category": "Hidden", diff --git a/account_ebics_oe_statement_import/wizards/account_bank_statement_import.py b/account_ebics_oe_statement_import/wizards/account_bank_statement_import.py index 03324a6..97b7496 100644 --- a/account_ebics_oe_statement_import/wizards/account_bank_statement_import.py +++ b/account_ebics_oe_statement_import/wizards/account_bank_statement_import.py @@ -1,4 +1,4 @@ -# Copyright 2009-2020 Noviat. +# Copyright 2009-2023 Noviat. # License LGPL-3 or later (http://www.gnu.org/licenses/lpgl). import logging @@ -53,8 +53,13 @@ class AccountBankStatementImport(models.TransientModel): break if not transactions: message = _("This file doesn't contain any transaction.") + st_ids = [] st_line_ids = [] - notifications = {"type": "warning", "message": message, "details": ""} - return st_line_ids, [notifications] + notifications = { + "type": "warning", + "message": message, + "details": {"name": "", "model": "", "ids": []}, + } + return st_ids, st_line_ids, [notifications] return super()._create_bank_statements(stmts_vals)