]> git.ipfire.org Git - thirdparty/python-drafthorse.git/commitdiff
Fix country_subdivision field (#25)
authorMarko Luther <marko.luther@gmx.net>
Fri, 19 Jan 2024 15:53:23 +0000 (16:53 +0100)
committerGitHub <noreply@github.com>
Fri, 19 Jan 2024 15:53:23 +0000 (16:53 +0100)
* fixes PostalTradeAddress
- corrects order of elements
- makes country_id required
- downgrades country_subdivision to profile BASIC

* black formatting

drafthorse/models/party.py
tests/test_mininal.py

index 9290f8223477bbe3b1ba314f60e51b900123917e..415cbac9899085c6df29827dd045e5a3689dc664 100644 (file)
@@ -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
index 7c399a996b56cdd1a73293a11814d86655687e88..a0da38ff446d4b1670b0556713ba372e40cbb3d3 100644 (file)
@@ -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"