fix: extract tax number, price basis quantity, spaced VAT IDs and contact email

- supplier/buyer: extract FC tax registration (BT-32/BT-49) into new
  tax_number field; previously only VA (USt-IdNr.) was read
- pflichtfelder: critical error only when neither vat_id nor tax_number
  is present (EN 16931 BR-CO-26)
- ustid: tolerate formatting whitespace inside VAT IDs (e.g. 'DE 140 978 617')
- line items: normalize unit price by basis quantity (BT-149), so a
  price per 100 units no longer inflates line totals by factor 100
- supplier email: also look in DefinedTradeContact (BT-42)
- rewrite xrechnung fallback test to assert only our own behavior,
  independent of factur-x version specifics
This commit is contained in:
m3ta-chiron
2026-09-11 16:05:41 +02:00
parent e2e1d8c046
commit 7fcb3ff21d
7 changed files with 294 additions and 21 deletions
+5
View File
@@ -40,6 +40,7 @@ class TestSupplier:
assert supplier.name == "ACME GmbH"
assert supplier.street is None
assert supplier.vat_id is None
assert supplier.tax_number is None
def test_full_supplier(self):
"""Test Supplier with all fields."""
@@ -52,6 +53,7 @@ class TestSupplier:
city="Musterstadt",
country="DE",
vat_id="DE123456789",
tax_number="2281410000697",
email="info@acme.de",
)
assert supplier.name == "ACME GmbH"
@@ -60,6 +62,7 @@ class TestSupplier:
assert supplier.city == "Musterstadt"
assert supplier.country == "DE"
assert supplier.vat_id == "DE123456789"
assert supplier.tax_number == "2281410000697"
assert supplier.email == "info@acme.de"
@@ -85,10 +88,12 @@ class TestBuyer:
city="Kundenstadt",
country="DE",
vat_id="DE987654321",
tax_number="1234567890",
)
assert buyer.name == "Customer AG"
assert buyer.street == "Kundenweg 7"
assert buyer.vat_id == "DE987654321"
assert buyer.tax_number == "1234567890"
class TestVatBreakdown: