From 6eacd9036b4a661bcd5f10322f2a6c4b72257c22 Mon Sep 17 00:00:00 2001 From: Luc De Meyer Date: Sat, 30 Jan 2021 18:55:10 +0100 Subject: [PATCH] ebics upload - select default format based upon suffix --- account_ebics/__manifest__.py | 2 +- account_ebics/data/ebics_file_format.xml | 22 ++++++++++++++------- account_ebics/static/description/index.html | 2 +- account_ebics/wizards/ebics_xfer.py | 15 +++++++++----- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/account_ebics/__manifest__.py b/account_ebics/__manifest__.py index 9ce48bf..50cbd7a 100644 --- a/account_ebics/__manifest__.py +++ b/account_ebics/__manifest__.py @@ -1,4 +1,4 @@ -# Copyright 2009-2020 Noviat. +# Copyright 2009-2021 Noviat. # License LGPL-3 or later (http://www.gnu.org/licenses/lpgl). { diff --git a/account_ebics/data/ebics_file_format.xml b/account_ebics/data/ebics_file_format.xml index 59fceab..e720900 100644 --- a/account_ebics/data/ebics_file_format.xml +++ b/account_ebics/data/ebics_file_format.xml @@ -86,12 +86,20 @@ + + pain.xxx.cfonb160.dco + up + FUL + Remises de LCR + txt + + pain.001.001.03 up CCT Payment Order in format pain.001.001.03 - cct.xml + xml @@ -99,7 +107,7 @@ up XE2 Payment Order in format pain.001.001.03 - cct.xml + xml @@ -107,7 +115,7 @@ up CDD Sepa Core Direct Debit Order in format pain.008.001.02 - sdd.xml + xml @@ -115,7 +123,7 @@ up XE3 Sepa Core Direct Debit Order in format pain.008.001.02 - sdd.xml + xml @@ -123,7 +131,7 @@ up CDB Sepa Direct Debit (B2B) Order in format pain.008.001.02 - sbb.xml + xml @@ -131,7 +139,7 @@ up XE4 Sepa Direct Debit (B2B) Order in format pain.008.001.02 - sbb.xml + xml @@ -139,7 +147,7 @@ up FUL Payment Order in format pain.001.001.02 - cct.xml + xml diff --git a/account_ebics/static/description/index.html b/account_ebics/static/description/index.html index 42b8115..a2861eb 100644 --- a/account_ebics/static/description/index.html +++ b/account_ebics/static/description/index.html @@ -411,7 +411,7 @@ ul.auto-toc {
  • account_bank_statement_import_helper

    Required if you are processing bank statements with local bank account numbers (e.g. french CFONB files).

    The import helper will match the local bank account number with the IBAN number specified on the Odoo Financial journal.

    -

    Cf. https://github.com/noviat-apps

    +

    Cf. https://github.com/Noviat/noviat-apps

  • diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index b0fed84..3c23413 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -120,12 +120,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):