Do not set twice the extension in the attachment name for the UBL documents

Closes #14982
(grafted from a7bc04a0430d1c0ee7503b1148c611c65659a633)

--HG--
branch : 8.0
This commit is contained in:
Cédric Krier
2026-08-01 10:49:03 +02:00
parent fcb95aa409
commit f3f7f0c2cb
+5 -2
View File
@@ -1323,13 +1323,16 @@ class Invoice(Model):
) 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(