diff --git a/invoice_logic.py b/invoice_logic.py index 5ddd3c2..146b06b 100644 --- a/invoice_logic.py +++ b/invoice_logic.py @@ -285,6 +285,25 @@ def collect_blockers(data, is_xrechnung): # 0,00 ist zulaessig (kostenlose Position), negativ nicht (BR-27). if _preis < 0: blocker.append(f"Position {_i}: Einzelpreis (BT-146) darf nicht negativ sein.") + # BT-152 je Position: 0 % ist zulaessig (steuerbefreit), ein unlesbarer Wert nicht. + _satz = _item.get("vat_rate_percent") + if _satz not in (None, ""): + try: + float(_satz) + except (TypeError, ValueError): + blocker.append(f"Position {_i}: Umsatzsteuersatz (BT-152) ist unlesbar.") + + # BT-152 Umsatzsteuersatz auf Kopfebene: die XML-Erzeugung liest ihn dort fest aus und + # scheitert sonst mit einer kryptischen Meldung. 0 % ist zulaessig (steuerbefreit). + _vat = data.get("vat_rate_percent") + if _vat in (None, ""): + blocker.append("Umsatzsteuersatz (BT-152) fehlt. Ohne ihn lässt sich die Steuer nicht " + "ausweisen und die Rechnung wird beim Empfänger abgewiesen.") + else: + try: + float(_vat) + except (TypeError, ValueError): + blocker.append("Umsatzsteuersatz (BT-152) ist unlesbar (erwartet wird eine Zahl, z.B. 19).") _pt = str(data.get("payment_term_days") or "").strip() if _pt == "":