Use the legal notice of tax as tax exemption reason in UBL invoice

Closes #14572
This commit is contained in:
Cédric Krier committed 2026-02-04 10:03:48 +01:00
1 parent 14c2a4435c
commit c260313c23
2 files changed
+5 -2

No files matched your search

+4 -2
View File
@@ -190,14 +190,16 @@ class Invoice(Model):
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,
@@ -84,6 +84,7 @@ this repository contains the full copyright notices and license terms. -->
<py:def function="TaxCategory(tax)">
<cbc:ID py:if="tax.unece_category_code">${tax.unece_category_code}</cbc:ID>
<cbc:Percent py:if="tax.type == 'percentage'">${format((tax.rate * 100).normalize(), 'f')}</cbc:Percent>
<cbc:TaxExemptionReason py:if="tax.legal_notice">${tax.legal_notice}</cbc:TaxExemptionReason>
<cac:TaxScheme py:if="tax.unece_code">
<cbc:ID>${tax.unece_code}</cbc:ID>
</cac:TaxScheme>