fix(erpsetup): VAT after discount on documents; SEPA days on offers #80

Merged
sharang merged 1 commits from fix/print-discount-totals into main 2026-10-19 20:51:34 +00:00
Owner

Problem

On a document with a discount, ERPNext lowers net_total but leaves tax_amount on each tax row at the pre-discount value. The template printed that value next to the gross discount, so the totals didn't add up and the VAT shown was too high.

Example from the first live offer: printed Summe netto 1.008,40, Rabatt −131,61, USt 212,61, Gesamtbetrag 1.200,00. Correct is USt 191,60. The same template is used for Sales Invoices, where a wrong tax amount is a § 14 UStG problem.

Change

  • Totals are now Zwischensumme (total), Rabatt (net: total − net_total), Summe netto, tax rows from tax_amount_after_discount_amount, Gesamtbetrag. Without a discount it looks as before.
  • Offers and order confirmations name the debit term from the payment term, e.g. "Zahlungsart: SEPA-Lastschrift, Einzug 21 Tage nach Rechnungsdatum, nach Erteilung eines gültigen SEPA-Lastschriftmandats."
  • New test TestTotalsPrintTheTaxAfterDiscount.

Rollout

After the merge, run erpsetup against the live ERP. It updates the Print Format, then reprint the offer. That's a live ERP change and needs a go.

🤖 Generated with Claude Code

## Problem On a document with a discount, ERPNext lowers `net_total` but leaves `tax_amount` on each tax row at the pre-discount value. The template printed that value next to the gross discount, so the totals didn't add up and the VAT shown was too high. Example from the first live offer: printed Summe netto 1.008,40, Rabatt −131,61, USt 212,61, Gesamtbetrag 1.200,00. Correct is USt 191,60. The same template is used for Sales Invoices, where a wrong tax amount is a § 14 UStG problem. ## Change - Totals are now Zwischensumme (`total`), Rabatt (net: `total − net_total`), Summe netto, tax rows from `tax_amount_after_discount_amount`, Gesamtbetrag. Without a discount it looks as before. - Offers and order confirmations name the debit term from the payment term, e.g. "Zahlungsart: SEPA-Lastschrift, Einzug 21 Tage nach Rechnungsdatum, nach Erteilung eines gültigen SEPA-Lastschriftmandats." - New test `TestTotalsPrintTheTaxAfterDiscount`. ## Rollout After the merge, run `erpsetup` against the live ERP. It updates the Print Format, then reprint the offer. That's a live ERP change and needs a go. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sharang added 1 commit 2026-10-19 20:25:25 +00:00
fix(erpsetup): print the VAT after discount; SEPA days on offers
ci / shared (pull_request) Successful in 13s
ci / test (pull_request) Successful in 25m50s
ci / image (pull_request) Skipped
997b500767
With a discount, ERPNext lowers net_total but keeps each tax row's
tax_amount at the pre-discount value. The document template printed
that value next to the gross discount, so the lines did not add up and
the VAT shown was too high (offer SAL-QTN-2026-00001: 212.61 printed,
191.60 charged). The totals now read Zwischensumme, Rabatt (net),
Summe netto, tax after discount, Gesamtbetrag.

Offers and order confirmations also name the debit term from the
payment term ("Einzug 21 Tage nach Rechnungsdatum").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang merged commit b4c184c26f into main 2026-10-19 20:51:34 +00:00
Sign in to join this conversation.