From 4019506f3e086fc078787c45e1ec2fb7c208a32b Mon Sep 17 00:00:00 2001 From: Marko Luther Date: Fri, 19 Jan 2024 18:12:14 +0100 Subject: [PATCH] Corrects the attribute order of ApplicableTradeTax (#19) * aligns the attribute order of the ApplicableTradeTax class to the TradeTaxType in FACTUR-X_EXTENDED_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_100.xsd to fix https://github.com/pretix/python-drafthorse/issues/18 * adds test case * fix formatting * sync readme with test_minimal --- README.rst | 3 ++- drafthorse/models/accounting.py | 14 +++++++------- tests/test_mininal.py | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index 4666ec5..357809d 100644 --- a/README.rst +++ b/README.rst @@ -84,7 +84,8 @@ Generating:: trade_tax.calculated_amount = Decimal("0.00") trade_tax.basis_amount = Decimal("999.00") trade_tax.type_code = "VAT" - trade_tax.category_code = "E" + trade_tax.category_code = "AE" + trade_tax.exemption_reason_code = 'VATEX-EU-AE' trade_tax.rate_applicable_percent = Decimal("0.00") doc.trade.settlement.trade_tax.add(trade_tax) diff --git a/drafthorse/models/accounting.py b/drafthorse/models/accounting.py index f5d2865..0bae75d 100644 --- a/drafthorse/models/accounting.py +++ b/drafthorse/models/accounting.py @@ -83,13 +83,6 @@ class ApplicableTradeTax(Element): profile=COMFORT, _d="Grund der Steuerbefreiung (Freitext)", ) - exemption_reason_code = StringField( - NS_RAM, - "ExemptionReasonCode", - required=False, - profile=EXTENDED, - _d="Grund der Steuerbefreiung (Code)", - ) tax_point_date = DateTimeField( NS_RAM, "TaxPointDate", required=False, profile=COMFORT ) @@ -127,6 +120,13 @@ class ApplicableTradeTax(Element): profile=COMFORT, _d="Steuerkategorie (Wert)", ) + exemption_reason_code = StringField( + NS_RAM, + "ExemptionReasonCode", + required=False, + profile=EXTENDED, + _d="Grund der Steuerbefreiung (Code)", + ) rate_applicable_percent = DecimalField( NS_RAM, "RateApplicablePercent", required=True, profile=BASIC ) diff --git a/tests/test_mininal.py b/tests/test_mininal.py index a0da38f..0bd7f53 100644 --- a/tests/test_mininal.py +++ b/tests/test_mininal.py @@ -54,7 +54,8 @@ def test_readme_construction_example(): trade_tax.calculated_amount = Decimal("0.00") trade_tax.basis_amount = Decimal("999.00") trade_tax.type_code = "VAT" - trade_tax.category_code = "E" + trade_tax.category_code = "AE" + trade_tax.exemption_reason_code = "VATEX-EU-AE" trade_tax.rate_applicable_percent = Decimal("0.00") doc.trade.settlement.trade_tax.add(trade_tax) -- 2.47.3