Merge pull request #68 from Noviat/16-fix-ebics_download

16 fix ebics download
This commit is contained in:
Luc De Meyer 2023-02-15 08:23:41 +01:00 committed by GitHub
commit a9432774cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 14 deletions

View File

@ -71,7 +71,7 @@ class EbicsFile(models.Model):
) )
note = fields.Text(string="Notes") note = fields.Text(string="Notes")
note_process = fields.Text( note_process = fields.Text(
string="Notes", string="Process Notes",
readonly=True, readonly=True,
) )
company_ids = fields.Many2many( company_ids = fields.Many2many(
@ -90,7 +90,7 @@ class EbicsFile(models.Model):
ff = ebics_file.format_id.download_process_method ff = ebics_file.format_id.download_process_method
if ff in ff_methods: if ff in ff_methods:
if ff_methods[ff].get("unlink"): if ff_methods[ff].get("unlink"):
ff_methods[ff]["unlink"](ebics_file) ff_methods[ff]["unlink"]()
# remove bank statements # remove bank statements
ebics_file.bank_statement_ids.unlink() ebics_file.bank_statement_ids.unlink()
return super().unlink() return super().unlink()
@ -445,8 +445,10 @@ class EbicsFile(models.Model):
) )
if not currency: if not currency:
message = msg_hdr.format(_("Error")) message = msg_hdr.format(_("Error"))
message += _("Currency %(cc) not found.", cc=currency_code) message += _("Currency %(cc)s not found.", cc=currency_code)
res["notifications"] = {"type": "error", "message": message} res["notifications"].append(
{"type": "error", "message": message}
)
continue continue
journal = self.env["account.journal"].search( journal = self.env["account.journal"].search(
[ [
@ -465,7 +467,7 @@ class EbicsFile(models.Model):
message = msg_hdr.format(_("Error")) message = msg_hdr.format(_("Error"))
message += _( message += _(
"No financial journal found for Account Number %(nbr)s, " "No financial journal found for Account Number %(nbr)s, "
"Currency %(cc)", "Currency %(cc)s",
nbr=acc_number, nbr=acc_number,
cc=currency_code, cc=currency_code,
) )

View File

@ -107,7 +107,7 @@ class EbicsUserID(models.Model):
"by means of the SWIFT 3SKey token.", "by means of the SWIFT 3SKey token.",
) )
swift_3skey_certificate = fields.Binary(string="3SKey Certficate") 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 # X.509 Distinguished Name attributes used to
# create self-signed X.509 certificates # create self-signed X.509 certificates
ebics_key_x509 = fields.Boolean( ebics_key_x509 = fields.Boolean(

View File

@ -65,7 +65,7 @@ class EbicsXfer(models.TransientModel):
date_from = fields.Date() date_from = fields.Date()
date_to = fields.Date() date_to = fields.Date()
upload_data = fields.Binary(string="File to Upload") 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( upload_fname_dummy = fields.Char(
related="upload_fname", string="Upload Filename", readonly=True related="upload_fname", string="Upload Filename", readonly=True
) )
@ -233,7 +233,7 @@ class EbicsXfer(models.TransientModel):
self.note += _( self.note += _(
"EBICS Functional Error during download of " "EBICS Functional Error during download of "
"File Format %(name)s (%(order_type)s):", "File Format %(name)s (%(order_type)s):",
name=df.name, name=df.name or df.description,
order_type=df.order_type, order_type=df.order_type,
) )
self.note += "\n" self.note += "\n"
@ -245,7 +245,7 @@ class EbicsXfer(models.TransientModel):
self.note += _( self.note += _(
"EBICS Technical Error during download of " "EBICS Technical Error during download of "
"File Format %(name)s (%(order_type)s):", "File Format %(name)s (%(order_type)s):",
name=df.name, name=df.name or df.description,
order_type=df.order_type, order_type=df.order_type,
) )
self.note += "\n" self.note += "\n"
@ -256,28 +256,29 @@ class EbicsXfer(models.TransientModel):
self.note += _( self.note += _(
"EBICS Verification Error during download of " "EBICS Verification Error during download of "
"File Format %(name)s (%(order_type)s):", "File Format %(name)s (%(order_type)s):",
name=df.name, name=df.name or df.description,
order_type=df.order_type, order_type=df.order_type,
) )
self.note += "\n" self.note += "\n"
self.note += _("The EBICS response could not be verified.") self.note += _("The EBICS response could not be verified.")
except UserError as e: except UserError as e:
err_cnt += 1
self.note += "\n" self.note += "\n"
self.note += _( self.note += _(
"Warning during download of " "Error detected during download of "
"File Format %(name)s (%(order_type)s):", "File Format %(name)s (%(order_type)s):",
name=df.name, name=df.name or df.description,
order_type=df.order_type, order_type=df.order_type,
) )
self.note += "\n" self.note += "\n"
self.note += e.name self.note += " ".join(e.args)
except Exception: except Exception:
err_cnt += 1 err_cnt += 1
self.note += "\n" self.note += "\n"
self.note += _( self.note += _(
"Unknown Error during download of " "Unknown Error during download of "
"File Format %(name)s (%(order_type)s):", "File Format %(name)s (%(order_type)s):",
name=df.name, name=df.name or df.description,
order_type=df.order_type, order_type=df.order_type,
) )
tb = "".join(format_exception(*exc_info())) tb = "".join(format_exception(*exc_info()))