details:   https://code.tryton.org/tryton/commit/dd98790370ed
branch:    default
user:      Cédric Krier <[email protected]>
date:      Thu Mar 05 11:48:32 2026 +0100
description:
        Add fields that calculate if the invoice is sent via Peppol

        Closes #14651
diffstat:

 modules/edocument_peppol/account.py |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r ef17378de8c9 -r dd98790370ed modules/edocument_peppol/account.py
--- a/modules/edocument_peppol/account.py       Thu Mar 05 10:46:50 2026 +0100
+++ b/modules/edocument_peppol/account.py       Thu Mar 05 11:48:32 2026 +0100
@@ -17,6 +17,17 @@
         states={
             'invisible': ~Eval('peppol', []),
             })
+    send_via_peppol = fields.Function(
+        fields.Boolean("Send via Peppol"),
+        'get_send_via_peppol')
+
+    def get_send_via_peppol(self, name):
+        if not self.peppol:
+            peppol_types = self.party.get_multivalue(
+                'peppol_types', company=self.company.id)
+            return peppol_types and 'bis-billing-3' in peppol_types
+        else:
+            return bool(self.peppol)
 
     @property
     def peppol_required(self):
@@ -44,9 +55,7 @@
         for invoice in posted_invoices:
             if invoice.type != 'out':
                 continue
-            peppol_types = invoice.party.get_multivalue(
-                'peppol_types', company=invoice.company.id)
-            if peppol_types and 'bis-billing-3' in peppol_types:
+            if invoice.send_via_peppol:
                 invoice.check_peppol()
                 peppol.append(Peppol(
                         direction='out',

Reply via email to