ebics upload - select default format based upon suffix

This commit is contained in:
Luc De Meyer
2021-01-30 18:55:10 +01:00
parent f71f81227d
commit 17a07582e2
5 changed files with 22 additions and 17 deletions

View File

@@ -123,12 +123,17 @@ class EbicsXfer(models.TransientModel):
@api.onchange('upload_data')
def _onchange_upload_data(self):
self.upload_fname_dummy = self.upload_fname
self.format_id = False
self._detect_upload_format()
upload_formats = self.format_id \
or self.ebics_config_id.ebics_file_format_ids.filtered(
lambda r: r.type == 'up')
if len(upload_formats) == 1:
self.format_id = upload_formats
if not self.format_id:
upload_formats = self.format_id \
or self.ebics_config_id.ebics_file_format_ids.filtered(
lambda r: r.type == 'up')
if len(upload_formats) > 1:
upload_formats = upload_formats.filtered(
lambda r: self.upload_fname.endswith(r.suffix))
if len(upload_formats) == 1:
self.format_id = upload_formats
@api.onchange('format_id')
def _onchange_format_id(self):