details:   https://code.tryton.org/tryton/commit/b2f6504737eb
branch:    7.8
user:      Cédric Krier <[email protected]>
date:      Wed Feb 04 10:03:48 2026 +0100
description:
        Use the legal notice of tax as tax exemption reason in UBL invoice

        Closes #14572
        (grafted from 3ad051b83ba7f4ed24f64b4814036ac0c6fdc902)
diffstat:

 modules/edocument_ubl/edocument.py              |  6 ++++--
 modules/edocument_ubl/template/2/CreditNote.xml |  2 ++
 modules/edocument_ubl/template/2/Invoice.xml    |  2 ++
 3 files changed, 8 insertions(+), 2 deletions(-)

diffs (60 lines):

diff -r 2a32179514a3 -r b2f6504737eb modules/edocument_ubl/edocument.py
--- a/modules/edocument_ubl/edocument.py        Wed Feb 04 15:26:34 2026 +0100
+++ b/modules/edocument_ubl/edocument.py        Wed Feb 04 10:03:48 2026 +0100
@@ -187,14 +187,16 @@
     def taxes(self):
         class Tax(namedtuple(
                     'Tax',
-                    ('type', 'rate', 'unece_category_code', 'unece_code'))):
+                    ('type', 'rate', 'unece_category_code', 'unece_code',
+                        'legal_notice'))):
             @classmethod
             def from_line(cls, line):
                 return Tax(
                     type=line.tax.type,
                     rate=line.tax.rate,
                     unece_category_code=line.tax.unece_category_code,
-                    unece_code=line.tax.unece_code)
+                    unece_code=line.tax.unece_code,
+                    legal_notice=line.legal_notice or '')
         TaxLine = namedtuple('TaxLine', ('base', 'amount', 'tax'))
         for group, lines in groupby(sorted(
                     self.invoice.taxes,
diff -r 2a32179514a3 -r b2f6504737eb 
modules/edocument_ubl/template/2/CreditNote.xml
--- a/modules/edocument_ubl/template/2/CreditNote.xml   Wed Feb 04 15:26:34 
2026 +0100
+++ b/modules/edocument_ubl/template/2/CreditNote.xml   Wed Feb 04 10:03:48 
2026 +0100
@@ -74,6 +74,7 @@
         <cac:TaxCategory>
             <cbc:ID 
py:if="line.tax.unece_category_code">${line.tax.unece_category_code}</cbc:ID>
             <cbc:Percent py:if="line.tax.type == 
'percentage'">${format((line.tax.rate * 100).normalize(), 'f')}</cbc:Percent>
+            <cbc:TaxExemptionReason 
py:if="line.tax.legal_notice">${line.tax.legal_notice}</cbc:TaxExemptionReason>
             <cac:TaxScheme py:if="line.tax.unece_code">
                 <cbc:ID>${line.tax.unece_code}</cbc:ID>
             </cac:TaxScheme>
@@ -109,6 +110,7 @@
         <cac:ClassifiedTaxCategory py:for="tax_line in line.invoice_taxes">
             <cbc:ID 
py:if="tax_line.tax.unece_category_code">${tax_line.tax.unece_category_code}</cbc:ID>
             <cbc:Percent py:if="tax_line.tax.type == 
'percentage'">${format((tax_line.tax.rate * 100).normalize(), 
'f')}</cbc:Percent>
+            <cbc:TaxExemptionReason 
py:if="tax_line.tax.legal_notice">${tax_line.tax.legal_notice}</cbc:TaxExemptionReason>
             <cac:TaxScheme py:if="tax_line.tax.unece_code">
                 <cbc:ID>${tax_line.tax.unece_code}</cbc:ID>
             </cac:TaxScheme>
diff -r 2a32179514a3 -r b2f6504737eb 
modules/edocument_ubl/template/2/Invoice.xml
--- a/modules/edocument_ubl/template/2/Invoice.xml      Wed Feb 04 15:26:34 
2026 +0100
+++ b/modules/edocument_ubl/template/2/Invoice.xml      Wed Feb 04 10:03:48 
2026 +0100
@@ -74,6 +74,7 @@
         <cac:TaxCategory>
             <cbc:ID 
py:if="line.tax.unece_category_code">${line.tax.unece_category_code}</cbc:ID>
             <cbc:Percent py:if="line.tax.type == 
'percentage'">${format((line.tax.rate * 100).normalize(), 'f')}</cbc:Percent>
+            <cbc:TaxExemptionReason 
py:if="line.tax.legal_notice">${line.tax.legal_notice}</cbc:TaxExemptionReason>
             <cac:TaxScheme py:if="line.tax.unece_code">
                 <cbc:ID>${line.tax.unece_code}</cbc:ID>
             </cac:TaxScheme>
@@ -109,6 +110,7 @@
         <cac:ClassifiedTaxCategory py:for="tax_line in line.invoice_taxes">
             <cbc:ID 
py:if="tax_line.tax.unece_category_code">${tax_line.tax.unece_category_code}</cbc:ID>
             <cbc:Percent py:if="tax_line.tax.type == 
'percentage'">${format((tax_line.tax.rate * 100).normalize(), 
'f')}</cbc:Percent>
+            <cbc:TaxExemptionReason 
py:if="tax_line.tax.legal_notice">${tax_line.tax.legal_notice}</cbc:TaxExemptionReason>
             <cac:TaxScheme py:if="tax_line.tax.unece_code">
                 <cbc:ID>${tax_line.tax.unece_code}</cbc:ID>
             </cac:TaxScheme>

Reply via email to