From 0565805d5bfad160c2b7f4a8de95291b06a8486b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 6 Aug 2026 15:59:39 +0200 Subject: [PATCH] Raise PeppolServiceError when missing sender or recipient for Peppyrus submission Closes #14999 (grafted from 53f956b55465ca2c1d0c60445ba2b65c359b1da1) --HG-- branch : 8.0 --- modules/edocument_peppol_peppyrus/edocument.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/edocument_peppol_peppyrus/edocument.py b/modules/edocument_peppol_peppyrus/edocument.py index 4981f3975a..afc462030d 100644 --- a/modules/edocument_peppol_peppyrus/edocument.py +++ b/modules/edocument_peppol_peppyrus/edocument.py @@ -138,11 +138,15 @@ class PeppolService(metaclass=PoolMeta): @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': (