]> git.ipfire.org Git - thirdparty/python-drafthorse.git/commitdiff
Fixed IncludedNote.content field type (#69)
authorRobin Gohmert <ayuto@web.de>
Tue, 2 Sep 2025 12:36:50 +0000 (14:36 +0200)
committerGitHub <noreply@github.com>
Tue, 2 Sep 2025 12:36:50 +0000 (14:36 +0200)
* Fixed IncludedNote.content field type

* Fixed formatting and tests

drafthorse/models/note.py
tests/conftest.py

index b8df3b3b48ff53152a56c6fdb11ca10b31e543c6..4e51a1f7f1607cc4ad496d1be03922d10a4be766 100644 (file)
@@ -1,15 +1,16 @@
-from .container import StringContainer
 from . import BASIC, COMFORT, EXTENDED, NS_RAM
 from .elements import Element
-from .fields import MultiStringField, StringField
+from .fields import StringField
 
 
 class IncludedNote(Element):
-    content_code = StringField(NS_RAM, "ContentCode", required=False, profile=EXTENDED)
-    content: StringContainer = MultiStringField(
-        NS_RAM, "Content", required=False, profile=BASIC
+    content_code: StringField = StringField(
+        NS_RAM, "ContentCode", required=False, profile=EXTENDED
+    )
+    content: StringField = StringField(NS_RAM, "Content", required=False, profile=BASIC)
+    subject_code: StringField = StringField(
+        NS_RAM, "SubjectCode", required=False, profile=COMFORT
     )
-    subject_code = StringField(NS_RAM, "SubjectCode", required=False, profile=COMFORT)
 
     class Meta:
         namespace = NS_RAM
index b3d092d05d87f7932723779a95dff5cfee6810bb..5238a6f7fd245d6abad5d61ca040c565679e05b3 100644 (file)
@@ -22,9 +22,7 @@ def invoice_document(request):
     doc.header.issue_date_time = date.today()
     doc.header.languages.add("de")
 
-    note = IncludedNote()
-    note.content.add("Test Node 1")
-    doc.header.notes.add(note)
+    doc.header.notes.add(IncludedNote(content="Test Node 1"))
 
     doc.trade.agreement.seller.name = "Lieferant GmbH"
     doc.trade.settlement.payee.name = "Lieferant GmbH"