details:   https://code.tryton.org/tryton/commit/53f956b55465
branch:    default
user:      Cédric Krier <[email protected]>
date:      Thu Aug 06 15:59:39 2026 +0200
description:
        Raise PeppolServiceError when missing sender or recipient for Peppyrus 
submission

        Closes #14999
diffstat:

 modules/edocument_peppol_peppyrus/edocument.py |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 27108e7beebf -r 53f956b55465 
modules/edocument_peppol_peppyrus/edocument.py
--- a/modules/edocument_peppol_peppyrus/edocument.py    Thu Aug 06 15:55:46 
2026 +0200
+++ b/modules/edocument_peppol_peppyrus/edocument.py    Thu Aug 06 15:59:39 
2026 +0200
@@ -138,11 +138,15 @@
     @peppyrus_api
     def _post_peppyrus(self, document):
         tree = etree.parse(BytesIO(document.data))
+        if not (sender := self._peppyrus_sender(document.type, tree)):
+            raise PeppolServiceError("Missing sender")
+        if not (recipient := self._peppyrus_recipient(document.type, tree)):
+            raise PeppolServiceError("Missing recipient")
         response = requests.post(
             urljoin(URLS[self.peppyrus_server], 'message'),
             json={
-                'sender': self._peppyrus_sender(document.type, tree),
-                'recipient': self._peppyrus_recipient(document.type, tree),
+                'sender': sender,
+                'recipient': recipient,
                 'processType': (
                     self._peppyrus_process_type(document.type, tree)),
                 'documentType': (

Reply via email to