fix(validator): accept zero quantity on text-only line items
A line with quantity 0 was always reported as a missing required field. Real invoices carry text-only positions (e.g. a delivery note reference) with quantity 0 and line total 0. Quantity 0 is now an error only when the line bills an amount. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -88,7 +88,10 @@ def validate_pflichtfelder(xml_data: XmlData) -> list[ErrorDetail]:
|
||||
if not item.description or not item.description.strip():
|
||||
add_error(f"{field_prefix}.description", "critical")
|
||||
|
||||
if item.quantity == 0:
|
||||
# Quantity 0 is legitimate on text-only positions (e.g. a delivery
|
||||
# note reference) that carry no amount; it is only a defect when
|
||||
# the line bills something.
|
||||
if item.quantity == 0 and item.line_total != 0:
|
||||
add_error(f"{field_prefix}.quantity", "critical")
|
||||
|
||||
if item.unit_price is None:
|
||||
|
||||
Reference in New Issue
Block a user