From: Marko Luther Date: Fri, 19 Jan 2024 15:53:23 +0000 (+0100) Subject: Fix country_subdivision field (#25) X-Git-Tag: 2.4.0~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=75617a8a1ec9c9626793d2e1d0a323c8cfab8d7a;p=thirdparty%2Fpython-drafthorse.git Fix country_subdivision field (#25) * fixes PostalTradeAddress - corrects order of elements - makes country_id required - downgrades country_subdivision to profile BASIC * black formatting --- diff --git a/drafthorse/models/party.py b/drafthorse/models/party.py index 9290f82..415cbac 100644 --- a/drafthorse/models/party.py +++ b/drafthorse/models/party.py @@ -9,10 +9,10 @@ class PostalTradeAddress(Element): line_two = StringField(NS_RAM, "LineTwo", required=False, profile=BASIC) line_three = StringField(NS_RAM, "LineThree", required=False, profile=BASIC) city_name = StringField(NS_RAM, "CityName", required=False, profile=BASIC) + country_id = StringField(NS_RAM, "CountryID", required=True, profile=BASIC) country_subdivision = StringField( - NS_RAM, "CountrySubDivisionName", required=False, profile=EXTENDED + NS_RAM, "CountrySubDivisionName", required=False, profile=BASIC ) - country_id = StringField(NS_RAM, "CountryID", required=False, profile=BASIC) class Meta: namespace = NS_RAM diff --git a/tests/test_mininal.py b/tests/test_mininal.py index 7c399a9..a0da38f 100644 --- a/tests/test_mininal.py +++ b/tests/test_mininal.py @@ -33,6 +33,9 @@ def test_readme_construction_example(): doc.trade.settlement.currency_code = "EUR" doc.trade.settlement.payment_means.type_code = "ZZZ" + doc.trade.agreement.seller.address.country_id = "DE" + doc.trade.agreement.seller.address.country_subdivision = "Bayern" + li = LineItem() li.document.line_id = "1" li.product.name = "Rainbow"