From 75617a8a1ec9c9626793d2e1d0a323c8cfab8d7a Mon Sep 17 00:00:00 2001 From: Marko Luther Date: Fri, 19 Jan 2024 16:53:23 +0100 Subject: [PATCH] Fix country_subdivision field (#25) * fixes PostalTradeAddress - corrects order of elements - makes country_id required - downgrades country_subdivision to profile BASIC * black formatting --- drafthorse/models/party.py | 4 ++-- tests/test_mininal.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) 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" -- 2.47.3