diff --git a/modules/edocument_ubl/CHANGELOG b/modules/edocument_ubl/CHANGELOG
index eafa21c685..f55ea67c83 100644
--- a/modules/edocument_ubl/CHANGELOG
+++ b/modules/edocument_ubl/CHANGELOG
@@ -1,3 +1,4 @@
+* Filter the MIME type of the additional documents allowed by the specification
* Use VATEX as tax exemption reason code
* Add support for Python 3.14
* Remove support for Python 3.9
diff --git a/modules/edocument_ubl/edocument.py b/modules/edocument_ubl/edocument.py
index 221ac19d28..3d9beaaca2 100644
--- a/modules/edocument_ubl/edocument.py
+++ b/modules/edocument_ubl/edocument.py
@@ -119,6 +119,26 @@ class Invoice(Model):
else:
return '389'
+ def allowed_additional_documents(self, specification=None):
+ allowed_mimetypes = self._allowed_addition_document_mimetypes(
+ specification)
+ for document in self.additional_documents:
+ if (document.get('code') != '130'
+ and allowed_mimetypes
+ and document.get('mimetype', '') not in allowed_mimetypes):
+ continue
+ yield document
+
+ @classmethod
+ def _allowed_addition_document_mimetypes(cls, specification=None):
+ if specification and specification.startswith('peppol'):
+ return {'application/pdf', 'image/png', 'image/jpeg', 'text/csv',
+ 'application/'
+ 'vnd.openxmlformats-officedocument.spreadsheetml.sheet',
+ 'application/vnd.oasis.opendocument.spreadsheet'}
+ else:
+ return {}
+
@property
def additional_documents(self):
pool = Pool()
diff --git a/modules/edocument_ubl/template/2/CreditNote.xml b/modules/edocument_ubl/template/2/CreditNote.xml
index 606c0deea4..bdf1a9a423 100644
--- a/modules/edocument_ubl/template/2/CreditNote.xml
+++ b/modules/edocument_ubl/template/2/CreditNote.xml
@@ -30,7 +30,7 @@ this repository contains the full copyright notices and license terms. -->
${origin_invoice.invoice_date}
-
+
${document['id']}
${document['code']}
${document['description']}
diff --git a/modules/edocument_ubl/template/2/Invoice.xml b/modules/edocument_ubl/template/2/Invoice.xml
index dea4fa5825..be9cc7ddba 100644
--- a/modules/edocument_ubl/template/2/Invoice.xml
+++ b/modules/edocument_ubl/template/2/Invoice.xml
@@ -30,7 +30,7 @@ this repository contains the full copyright notices and license terms. -->
${origin_invoice.invoice_date}
-
+
${document['id']}
${document['code']}
${document['description']}