From 8b9539656e16b95e385e1214026d57f66219753c Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Mon, 13 Feb 2023 20:55:34 +0100 Subject: [PATCH 1/3] ebics download - improved error handling --- account_ebics/wizards/ebics_xfer.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index 12eb03c..3694a61 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -233,7 +233,7 @@ class EbicsXfer(models.TransientModel): self.note += _( "EBICS Functional Error during download of " "File Format %(name)s (%(order_type)s):", - name=df.name, + name=df.name or df.description, order_type=df.order_type, ) self.note += "\n" @@ -245,7 +245,7 @@ class EbicsXfer(models.TransientModel): self.note += _( "EBICS Technical Error during download of " "File Format %(name)s (%(order_type)s):", - name=df.name, + name=df.name or df.description, order_type=df.order_type, ) self.note += "\n" @@ -256,28 +256,29 @@ class EbicsXfer(models.TransientModel): self.note += _( "EBICS Verification Error during download of " "File Format %(name)s (%(order_type)s):", - name=df.name, + name=df.name or df.description, order_type=df.order_type, ) self.note += "\n" self.note += _("The EBICS response could not be verified.") except UserError as e: + err_cnt += 1 self.note += "\n" self.note += _( - "Warning during download of " + "Error detected during download of " "File Format %(name)s (%(order_type)s):", - name=df.name, + name=df.name or df.description, order_type=df.order_type, ) self.note += "\n" - self.note += e.name + self.note += " ".join(e.args) except Exception: err_cnt += 1 self.note += "\n" self.note += _( "Unknown Error during download of " "File Format %(name)s (%(order_type)s):", - name=df.name, + name=df.name or df.description, order_type=df.order_type, ) tb = "".join(format_exception(*exc_info())) From dc4b95ad3586a6b66f07ce0ce49cbf3cc270a4bc Mon Sep 17 00:00:00 2001 From: dsolanki Date: Mon, 13 Feb 2023 12:33:07 +0530 Subject: [PATCH 2/3] [FIX] account_ebics: Warning two fields have same label --- account_ebics/models/ebics_file.py | 2 +- account_ebics/models/ebics_userid.py | 2 +- account_ebics/wizards/ebics_xfer.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index 7f960a3..2d98e55 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -71,7 +71,7 @@ class EbicsFile(models.Model): ) note = fields.Text(string="Notes") note_process = fields.Text( - string="Notes", + string="Process Notes", readonly=True, ) company_ids = fields.Many2many( diff --git a/account_ebics/models/ebics_userid.py b/account_ebics/models/ebics_userid.py index 6a863a9..9d541e5 100644 --- a/account_ebics/models/ebics_userid.py +++ b/account_ebics/models/ebics_userid.py @@ -107,7 +107,7 @@ class EbicsUserID(models.Model): "by means of the SWIFT 3SKey token.", ) swift_3skey_certificate = fields.Binary(string="3SKey Certficate") - swift_3skey_certificate_fn = fields.Char(string="EBICS Public Bank Keys Filename") + swift_3skey_certificate_fn = fields.Char(string="EBICS certificate name") # X.509 Distinguished Name attributes used to # create self-signed X.509 certificates ebics_key_x509 = fields.Boolean( diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index 3694a61..506ec48 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -65,7 +65,7 @@ class EbicsXfer(models.TransientModel): date_from = fields.Date() date_to = fields.Date() upload_data = fields.Binary(string="File to Upload") - upload_fname = fields.Char(string="Upload Filename", default="") + upload_fname = fields.Char(default="") upload_fname_dummy = fields.Char( related="upload_fname", string="Upload Filename", readonly=True ) From 2382d066ae5122de44dff5ac4c2157d141a033ee Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Wed, 15 Feb 2023 08:07:45 +0100 Subject: [PATCH 3/3] bugfix --- account_ebics/models/ebics_file.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/account_ebics/models/ebics_file.py b/account_ebics/models/ebics_file.py index 2d98e55..ace6636 100644 --- a/account_ebics/models/ebics_file.py +++ b/account_ebics/models/ebics_file.py @@ -90,7 +90,7 @@ class EbicsFile(models.Model): ff = ebics_file.format_id.download_process_method if ff in ff_methods: if ff_methods[ff].get("unlink"): - ff_methods[ff]["unlink"](ebics_file) + ff_methods[ff]["unlink"]() # remove bank statements ebics_file.bank_statement_ids.unlink() return super().unlink() @@ -445,8 +445,10 @@ class EbicsFile(models.Model): ) if not currency: message = msg_hdr.format(_("Error")) - message += _("Currency %(cc) not found.", cc=currency_code) - res["notifications"] = {"type": "error", "message": message} + message += _("Currency %(cc)s not found.", cc=currency_code) + res["notifications"].append( + {"type": "error", "message": message} + ) continue journal = self.env["account.journal"].search( [ @@ -465,7 +467,7 @@ class EbicsFile(models.Model): message = msg_hdr.format(_("Error")) message += _( "No financial journal found for Account Number %(nbr)s, " - "Currency %(cc)", + "Currency %(cc)s", nbr=acc_number, cc=currency_code, )