fix(erpsetup): state the permanent discount when it is a negative line
The Vertragsbedingungen block (#95) only stated the permanent discount for a document-level discount (total - net_total). The K-00001 Pilotrabatt is a negative line item, by design, because eu_einvoice cannot carry a document-level discount, so the sentence never rendered and the Rabattdauer (one of the reviewer's required terms) was missing from the PDF. Count negative lines (rate < 0) as well, and say the discount is already contained in the stated net amount. Keep the block on one page (page-break-inside: avoid); it split across pages 1-2. Rendered against mocks: line-item discount, document-level discount and no discount all produce the expected text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KYcAAeTw22GE9QPzDM8yc4
This commit is contained in:
1 parent
d14f381164
commit
01a1b5b8fd
1 file changed
+9
-2
@@ -283,17 +283,24 @@ var documentHTML = brand.Replace(`{%- set is_inv = doc.doctype == "Sales Invoice
|
||||
<p>Nicht im Inland steuerbare Leistung.</p>
|
||||
{%- endif %}
|
||||
{%- if doc.doctype == "Quotation" %}
|
||||
{#- The Pilotrabatt is a negative line item (eu_einvoice cannot carry a
|
||||
document-level discount), so count negative lines as well as the
|
||||
document discount. -#}
|
||||
{%- set line_discount = 0 - (doc.items | selectattr("rate", "lt", 0) | sum(attribute="amount")) if doc.items else 0 -%}
|
||||
{%- set total_discount = net_discount + line_discount -%}
|
||||
<div style="page-break-inside:avoid;">
|
||||
<p class="sepa-head"><b>Vertragsbedingungen</b></p>
|
||||
<table class="meta" style="margin-top:2px;">
|
||||
<table class="meta" style="margin-top:2px;page-break-inside:avoid;">
|
||||
<tr><td class="k">Vertragsart</td><td>Monatlich wiederkehrende SaaS- und Hosting-Leistungen (Abonnement).</td></tr>
|
||||
<tr><td class="k">Vertragsbeginn</td><td>{{ doc.get("contract_start") or "Mit Bereitstellung der gebuchten Dienste gemäß Auftragsbestätigung." }}</td></tr>
|
||||
<tr><td class="k">Laufzeit / Kündigung</td><td>Keine Mindestlaufzeit; der Vertrag läuft auf unbestimmte Zeit. Monatlich kündbar mit einer Frist von einem Monat zum Monatsende.</td></tr>
|
||||
<tr><td class="k">Abrechnung</td><td>Monatlich, jeweils zu Beginn des Leistungszeitraums.</td></tr>
|
||||
<tr><td class="k">{% if interval == "monatlich" %}Monatliche Vergütung{% else %}Vergütung{% endif %}</td><td>{{ doc.get_formatted("net_total") }} netto zzgl. gesetzlicher Umsatzsteuer.{% if net_discount > 0.005 %} Der monatliche Nachlass von {{ frappe.utils.fmt_money(net_discount, currency=doc.currency) }} gilt dauerhaft, einschließlich etwaiger Verlängerungen.{% endif %}</td></tr>
|
||||
<tr><td class="k">{% if interval == "monatlich" %}Monatliche Vergütung{% else %}Vergütung{% endif %}</td><td>{{ doc.get_formatted("net_total") }} netto zzgl. gesetzlicher Umsatzsteuer.{% if total_discount > 0.005 %} Der darin enthaltene monatliche Nachlass von {{ frappe.utils.fmt_money(total_discount, currency=doc.currency) }} gilt dauerhaft, einschließlich etwaiger Verlängerungen.{% endif %}</td></tr>
|
||||
<tr><td class="k">Mehrverbrauch</td><td>Über das gebuchte Kontingent hinausgehende Prüfungen werden je zusätzlicher Prüfung gesondert berechnet.</td></tr>
|
||||
<tr><td class="k">Vertragsgrundlagen</td><td>{{ doc.get("vertragsgrundlage") or "Es gelten die SaaS-Vertragsbedingungen, die Leistungsbeschreibungen, das SLA und die AVV (Art. 28 DSGVO) in der jeweils vereinbarten Fassung; die Versionsstände sind in der Anlage bezeichnet." }}</td></tr>
|
||||
<tr><td class="k">Annahme</td><td>Durch schriftliche oder elektronische Annahme dieses Angebots{% if doc.valid_till %} bis zum {{ frappe.utils.formatdate(doc.valid_till) }}{% endif %}.</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
{%- endif %}
|
||||
{%- if is_inv and not doc.is_return %}
|
||||
{%- if sepa and has_mandate %}
|
||||
|
||||
Reference in new issue
Block a user