[FIX] account_ebics - Number duplicate upload file names before the extension

A duplicate upload name got the counter appended to the previous
candidate and after the extension: pay.xml_1, then pay.xml_1_2,
pay.xml_1_2_3. Keep the extension and number from the original name:
pay_1.xml, pay_2.xml.
This commit is contained in:
Jérémy Didderen committed 2026-10-27 23:14:49 +01:00
1 parent a1fc381121
commit 0c86f79669
2 files changed
+15 -6

No files matched your search

+5 -2
View File
@@ -3,6 +3,7 @@
import base64
import logging
import os
from sys import exc_info
from traceback import format_exception
@@ -578,11 +579,13 @@ class EbicsXfer(models.TransientModel):
fn = ef_vals["name"]
dups = self._check_duplicate_ebics_file(fn, self.format_id)
if dups:
# pay.xml -> pay_1.xml, pay_2.xml, ...
base, ext = os.path.splitext(fn)
n = 1
fn = "_".join([fn, str(n)])
fn = f"{base}_{n}{ext}"
while self._check_duplicate_ebics_file(fn, self.format_id):
n += 1
fn = "_".join([fn, str(n)])
fn = f"{base}_{n}{ext}"
ef_vals["name"] = fn
def _handle_download_data(self, data, file_format):