details: https://code.tryton.org/tryton/commit/4c14d150d82c
branch: 8.0
user: Cédric Krier <[email protected]>
date: Sat Aug 01 10:49:03 2026 +0200
description:
Do not set twice the extension in the attachment name for the UBL
documents
Closes #14982
(grafted from a7bc04a0430d1c0ee7503b1148c611c65659a633)
diffstat:
modules/edocument_ubl/edocument.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (22 lines):
diff -r d56ce0708e75 -r 4c14d150d82c modules/edocument_ubl/edocument.py
--- a/modules/edocument_ubl/edocument.py Sat Aug 01 00:57:28 2026 +0200
+++ b/modules/edocument_ubl/edocument.py Sat Aug 01 10:49:03 2026 +0200
@@ -1323,13 +1323,16 @@
) is not None:
mime_code = (
data.get('mimeCode') or 'application/octet-stream')
- name += mimetypes.guess_extension(mime_code) or ''
+ if extension := mimetypes.guess_extension(mime_code):
+ if not name.lower().endswith(extension):
+ name += extension
attachment.type = 'data'
data = b64decode(data.text)
attachment.data = data
elif data := document.findtext(
'./{*}Attachment/{*}EmbeddedDocument'):
- name += '.txt'
+ if not name.lower().endswith('.txt'):
+ name += '.txt'
attachment.type = 'data'
attachment.data = data
elif url := document.findtext(