details:   https://code.tryton.org/tryton/commit/b030003ca20a
branch:    8.0
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
        (grafted from 53f956b55465ca2c1d0c60445ba2b65c359b1da1)
diffstat:

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

diffs (21 lines):

diff -r 41f2e386dc03 -r b030003ca20a 
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