From e00e2c66677eb48de47294d35827f30d7f601267 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Wed, 8 Feb 2023 19:22:07 +0100 Subject: [PATCH] suffix no longer required --- account_ebics/models/ebics_file_format.py | 1 - account_ebics/wizards/ebics_xfer.py | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/account_ebics/models/ebics_file_format.py b/account_ebics/models/ebics_file_format.py index d2ab636..48d3d47 100644 --- a/account_ebics/models/ebics_file_format.py +++ b/account_ebics/models/ebics_file_format.py @@ -56,7 +56,6 @@ class EbicsFileFormat(models.Model): ) description = fields.Char() suffix = fields.Char( - required=True, help="Specify the filename suffix for this File Format.\nE.g. c53.xml", ) # EBICS 3.0 BTF diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index 703ac47..b7db435 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -374,7 +374,7 @@ class EbicsXfer(models.TransientModel): ef_note += "\n" + _("Origin: %s") % self._context["origin"] suffix = self.format_id.suffix fn = self.upload_fname - if not fn.endswith(suffix): + if suffix and not fn.endswith(suffix): fn = ".".join([fn, suffix]) ef_vals = { "name": self.upload_fname, @@ -554,7 +554,10 @@ class EbicsXfer(models.TransientModel): if file_format.name in ff_methods: data = ff_methods[file_format.name](data) - fn = ".".join([base_fn, file_format.suffix]) + fn = base_fn + suffix = file_format.suffix + if suffix and not fn.endswith(suffix): + fn = ".".join([fn, suffix]) dups = self._check_duplicate_ebics_file(fn, file_format) if dups: raise UserError(