details: https://code.tryton.org/tryton/commit/f98c416aca68
branch: 7.8
user: Cédric Krier <[email protected]>
date: Mon Dec 29 17:28:36 2025 +0100
description:
Set only one payment term for Peppol UBL and only if the description is
not empty
Closes #14454
(grafted from 21a2332d37a69925f660d0cd72891d020b9f746c)
diffstat:
modules/edocument_ubl/template/2/CreditNote.xml | 19 ++++++++++++++-----
modules/edocument_ubl/template/2/Invoice.xml | 19 ++++++++++++++-----
2 files changed, 28 insertions(+), 10 deletions(-)
diffs (58 lines):
diff -r 9f50c53201a8 -r f98c416aca68
modules/edocument_ubl/template/2/CreditNote.xml
--- a/modules/edocument_ubl/template/2/CreditNote.xml Mon Dec 29 15:50:58
2025 +0100
+++ b/modules/edocument_ubl/template/2/CreditNote.xml Mon Dec 29 17:28:36
2025 +0100
@@ -51,11 +51,20 @@
<cac:AccountingCustomerParty>
${Party(this.accounting_customer_party, this.accounting_customer_address,
this.accounting_customer_tax_identifier,
identifications=[this.accounting_customer_party.identifier_iso6523] if
(specification or '').startswith('peppol') else None,
specification=specification)}
</cac:AccountingCustomerParty>
-<cac:PaymentTerms py:for="line in this.invoice.lines_to_pay">
- <cbc:Note py:if="this.invoice.payment_term and
this.invoice.payment_term.description">${this.invoice.payment_term.description}</cbc:Note>
- <cbc:Amount py:if="not (specification or '').startswith('peppol')"
py:attrs="{'currencyID':
this.invoice.currency.code}">${line.amount}</cbc:Amount>
- <cbc:PaymentDueDate py:if="not (specification or
'').startswith('peppol')">${line.maturity_date}</cbc:PaymentDueDate>
-</cac:PaymentTerms>
+<py:choose test="(specification or '').startswith('peppol')">
+ <py:when test="True">
+ <cac:PaymentTerms py:if="this.invoice.payment_term and
this.invoice.payment_term.description">
+ <cbc:Note>${this.invoice.payment_term.description}</cbc:Note>
+ </cac:PaymentTerms>
+ </py:when>
+ <py:otherwise>
+ <cac:PaymentTerms py:for="line in this.invoice.lines_to_pay">
+ <cbc:Note py:if="this.invoice.payment_term and
this.invoice.payment_term.description">${this.invoice.payment_term.description}</cbc:Note>
+ <cbc:Amount py:attrs="{'currencyID':
this.invoice.currency.code}">${line.amount}</cbc:Amount>
+ <cbc:PaymentDueDate>${line.maturity_date}</cbc:PaymentDueDate>
+ </cac:PaymentTerms>
+ </py:otherwise>
+</py:choose>
<cac:TaxTotal py:for="group, lines, amount in this.taxes">
<cbc:TaxAmount py:attrs="{'currencyID':
this.invoice.currency.code}">${-amount}</cbc:TaxAmount>
<cac:TaxSubtotal py:for="line in lines">
diff -r 9f50c53201a8 -r f98c416aca68
modules/edocument_ubl/template/2/Invoice.xml
--- a/modules/edocument_ubl/template/2/Invoice.xml Mon Dec 29 15:50:58
2025 +0100
+++ b/modules/edocument_ubl/template/2/Invoice.xml Mon Dec 29 17:28:36
2025 +0100
@@ -51,11 +51,20 @@
<cac:AccountingCustomerParty>
${Party(this.accounting_customer_party, this.accounting_customer_address,
this.accounting_customer_tax_identifier,
identifications=[this.accounting_customer_party.identifier_iso6523] if
(specification or '').startswith('peppol') else None,
specification=specification)}
</cac:AccountingCustomerParty>
-<cac:PaymentTerms py:for="line in this.invoice.lines_to_pay">
- <cbc:Note py:if="this.invoice.payment_term and
this.invoice.payment_term.description">${this.invoice.payment_term.description}</cbc:Note>
- <cbc:Amount py:if="not (specification or '').startswith('peppol')"
py:attrs="{'currencyID':
this.invoice.currency.code}">${line.amount}</cbc:Amount>
- <cbc:PaymentDueDate py:if="not (specification or
'').startswith('peppol')">${line.maturity_date}</cbc:PaymentDueDate>
-</cac:PaymentTerms>
+<py:choose test="(specification or '').startswith('peppol')">
+ <py:when test="True">
+ <cac:PaymentTerms py:if="this.invoice.payment_term and
this.invoice.payment_term.description">
+ <cbc:Note>${this.invoice.payment_term.description}</cbc:Note>
+ </cac:PaymentTerms>
+ </py:when>
+ <py:otherwise>
+ <cac:PaymentTerms py:for="line in this.invoice.lines_to_pay">
+ <cbc:Note py:if="this.invoice.payment_term and
this.invoice.payment_term.description">${this.invoice.payment_term.description}</cbc:Note>
+ <cbc:Amount py:attrs="{'currencyID':
this.invoice.currency.code}">${line.amount}</cbc:Amount>
+ <cbc:PaymentDueDate>${line.maturity_date}</cbc:PaymentDueDate>
+ </cac:PaymentTerms>
+ </py:otherwise>
+</py:choose>
<cac:TaxTotal py:for="group, lines, amount in this.taxes">
<cbc:TaxAmount py:attrs="{'currencyID':
this.invoice.currency.code}">${amount}</cbc:TaxAmount>
<cac:TaxSubtotal py:for="line in lines">