diff --git a/drafthorse/models/accounting.py b/drafthorse/models/accounting.py index 0d2aa56..421a6f3 100644 --- a/drafthorse/models/accounting.py +++ b/drafthorse/models/accounting.py @@ -1,3 +1,4 @@ +from .container import CurrencyContainer, Container from . import BASIC, COMFORT, EXTENDED, NS_RAM from .elements import Element from .fields import ( @@ -148,7 +149,7 @@ class MonetarySummation(Element): tax_total = CurrencyField( NS_RAM, "TaxTotalAmount", required=True, profile=BASIC, _d="Steuergesamtbetrag" ) - tax_total_other_currency = MultiCurrencyField( + tax_total_other_currency: CurrencyContainer = MultiCurrencyField( NS_RAM, "TaxTotalAmount", profile=EXTENDED, _d="Steuergesamtbetrag" ) rounding_amount = DecimalField( @@ -239,7 +240,7 @@ class TradeAllowanceCharge(Element): ) reason_code = StringField(NS_RAM, "ReasonCode", required=False, profile=COMFORT) reason = StringField(NS_RAM, "Reason", required=False, profile=COMFORT) - trade_tax = MultiField(CategoryTradeTax, required=False, profile=COMFORT) + trade_tax: Container = MultiField(CategoryTradeTax, required=False, profile=COMFORT) class Meta: namespace = NS_RAM diff --git a/drafthorse/models/delivery.py b/drafthorse/models/delivery.py index e568b08..c51ab96 100644 --- a/drafthorse/models/delivery.py +++ b/drafthorse/models/delivery.py @@ -35,7 +35,9 @@ class Meta: class SupplyChainConsignment(Element): # TODO: Deprecated? - movement = Field(LogisticsTransportMovement, required=False, profile=EXTENDED) + movement: LogisticsTransportMovement = Field( + LogisticsTransportMovement, required=False, profile=EXTENDED + ) class Meta: namespace = NS_RAM @@ -43,20 +45,26 @@ class Meta: class TradeDelivery(Element): - consignment = Field( + consignment: SupplyChainConsignment = Field( SupplyChainConsignment, default=False, required=False, _d="Detailinformationen zur Konsignation oder Sendung", ) - ship_to = Field(ShipToTradeParty, required=False, profile=EXTENDED) - ultimate_ship_to = Field(UltimateShipToTradeParty, required=False, profile=EXTENDED) - ship_from = Field(ShipFromTradeParty, required=False, profile=EXTENDED) - event = Field(SupplyChainEvent, required=False, profile=BASIC) - despatch_advice = Field( + ship_to: ShipToTradeParty = Field( + ShipToTradeParty, required=False, profile=EXTENDED + ) + ultimate_ship_to: UltimateShipToTradeParty = Field( + UltimateShipToTradeParty, required=False, profile=EXTENDED + ) + ship_from: ShipFromTradeParty = Field( + ShipFromTradeParty, required=False, profile=EXTENDED + ) + event: SupplyChainEvent = Field(SupplyChainEvent, required=False, profile=BASIC) + despatch_advice: DespatchAdviceReferencedDocument = Field( DespatchAdviceReferencedDocument, required=False, profile=EXTENDED ) - delivery_note = Field( + delivery_note: DeliveryNoteReferencedDocument = Field( DeliveryNoteReferencedDocument, required=False, profile=EXTENDED ) diff --git a/drafthorse/models/document.py b/drafthorse/models/document.py index 4b0e923..67a7920 100644 --- a/drafthorse/models/document.py +++ b/drafthorse/models/document.py @@ -1,6 +1,7 @@ import xml.etree.cElementTree as ET -from drafthorse.models.note import IncludedNote +from .container import StringContainer, Container +from .note import IncludedNote from . import BASIC, EXTENDED, NS_A, NS_QDT, NS_RAM, NS_RSM, NS_UDT from .elements import Element @@ -35,13 +36,13 @@ class DocumentContext(Element): test_indicator = IndicatorField( NS_RAM, "TestIndicator", required=False, profile=EXTENDED, _d="Testkennzeichen" ) - business_parameter = Field( + business_parameter: BusinessDocumentContextParameter = Field( BusinessDocumentContextParameter, required=False, profile=EXTENDED, _d="Geschäftsprozess, Wert", ) - guideline_parameter = Field( + guideline_parameter: GuidelineDocumentContextParameter = Field( GuidelineDocumentContextParameter, required=True, profile=BASIC, @@ -79,8 +80,10 @@ class Header(Element): profile=EXTENDED, _d="Indikator Original/Kopie", ) - languages = MultiStringField(NS_RAM, "LanguageID", required=False, profile=EXTENDED) - notes = MultiField(IncludedNote) + languages: StringContainer = MultiStringField( + NS_RAM, "LanguageID", required=False, profile=EXTENDED + ) + notes: Container = MultiField(IncludedNote) effective_period = Field( EffectivePeriod, required=False, @@ -94,9 +97,9 @@ class Meta: class Document(Element): - context = Field(DocumentContext, required=True) - header = Field(Header, required=True) - trade = Field(TradeTransaction, required=True) + context: DocumentContext = Field(DocumentContext, required=True) + header: Header = Field(Header, required=True) + trade: TradeTransaction = Field(TradeTransaction, required=True) def __init__(self): super().__init__() diff --git a/drafthorse/models/note.py b/drafthorse/models/note.py index 9cd5b5f..b8df3b3 100644 --- a/drafthorse/models/note.py +++ b/drafthorse/models/note.py @@ -1,3 +1,4 @@ +from .container import StringContainer from . import BASIC, COMFORT, EXTENDED, NS_RAM from .elements import Element from .fields import MultiStringField, StringField @@ -5,7 +6,9 @@ class IncludedNote(Element): content_code = StringField(NS_RAM, "ContentCode", required=False, profile=EXTENDED) - content = MultiStringField(NS_RAM, "Content", required=False, profile=BASIC) + content: StringContainer = MultiStringField( + NS_RAM, "Content", required=False, profile=BASIC + ) subject_code = StringField(NS_RAM, "SubjectCode", required=False, profile=COMFORT) class Meta: diff --git a/drafthorse/models/party.py b/drafthorse/models/party.py index c6ae5a7..54adfa5 100644 --- a/drafthorse/models/party.py +++ b/drafthorse/models/party.py @@ -1,5 +1,6 @@ from . import BASIC, COMFORT, EXTENDED, NS_RAM from .elements import Element +from .container import Container, IDContainer from .fields import Field, IDField, MultiField, MultiIDField, StringField @@ -68,7 +69,9 @@ class LegalOrganization(Element): profile=BASIC, _d="Firmenname, sofern abweichend vom Namen", ) - trade_address = Field(PostalTradeAddress, required=False, profile=EXTENDED) + trade_address: PostalTradeAddress = Field( + PostalTradeAddress, required=False, profile=EXTENDED + ) class Meta: namespace = NS_RAM @@ -80,9 +83,9 @@ class TradeContact(Element): department_name = StringField( NS_RAM, "DepartmentName", required=False, profile=EXTENDED ) - telephone = Field(PhoneNumber, required=False, profile=EXTENDED) - fax = Field(FaxNumber, required=False, profile=EXTENDED) - email = Field(EmailURI, required=False, profile=EXTENDED) + telephone: PhoneNumber = Field(PhoneNumber, required=False, profile=EXTENDED) + fax: FaxNumber = Field(FaxNumber, required=False, profile=EXTENDED) + email: EmailURI = Field(EmailURI, required=False, profile=EXTENDED) class Meta: namespace = NS_RAM @@ -93,7 +96,7 @@ class TradeParty(Element): id = StringField( NS_RAM, "ID", required=False, profile=COMFORT, _d="Kennung des Handelspartners" ) - global_id = MultiIDField( + global_id: IDContainer = MultiIDField( NS_RAM, "GlobalID", required=False, @@ -108,28 +111,30 @@ class TradeParty(Element): profile=COMFORT, _d="Zusätzliche rechliche Informationen des Handelspartners", ) - legal_organization = Field( + legal_organization: LegalOrganization = Field( LegalOrganization, required=False, profile=BASIC, _d="Handelsinformationen des Handelspartners", ) - contact = Field( + contact: TradeContact = Field( TradeContact, required=False, profile=EXTENDED, _d="Ansprechpartner des Handelspartners", ) - address = Field( + address: PostalTradeAddress = Field( PostalTradeAddress, required=False, profile=BASIC, _d="Anschrift des Handelspartners", ) - electronic_address = MultiField( + electronic_address: Container = MultiField( URIUniversalCommunication, required=False, profile=BASIC ) - tax_registrations = MultiField(TaxRegistration, required=False, profile=BASIC) + tax_registrations: Container = MultiField( + TaxRegistration, required=False, profile=BASIC + ) class SellerTaxRepresentativeTradeParty(TradeParty): diff --git a/drafthorse/models/payment.py b/drafthorse/models/payment.py index 613fc99..71f3b59 100644 --- a/drafthorse/models/payment.py +++ b/drafthorse/models/payment.py @@ -1,5 +1,6 @@ from . import BASIC, COMFORT, EXTENDED, NS_RAM from .elements import Element +from .container import StringContainer, CurrencyContainer from .fields import ( DateTimeField, DecimalField, @@ -48,13 +49,13 @@ class Meta: class PaymentMeans(Element): type_code = StringField(NS_RAM, "TypeCode", required=True, profile=COMFORT) - information = MultiStringField( + information: StringContainer = MultiStringField( NS_RAM, "Information", required=False, profile=COMFORT ) - financial_card = Field(FinancialCard) - payer_account = Field(PayerFinancialAccount) - payee_account = Field(PayeeFinancialAccount) - payee_institution = Field(PayeeFinancialInstitution) + financial_card: FinancialCard = Field(FinancialCard) + payer_account: PayerFinancialAccount = Field(PayerFinancialAccount) + payee_account: PayeeFinancialAccount = Field(PayeeFinancialAccount) + payee_institution: PayeeFinancialInstitution = Field(PayeeFinancialInstitution) class Meta: namespace = NS_RAM @@ -182,20 +183,20 @@ class PaymentTerms(Element): debit_mandate_id = StringField( NS_RAM, "DirectDebitMandateID", required=False, profile=BASIC ) - partial_amount = MultiCurrencyField( + partial_amount: CurrencyContainer = MultiCurrencyField( NS_RAM, "PartialPaymentAmount", profile=EXTENDED, required=False, _d="Betrag der Teilzahlung", ) - penalty_terms = Field( + penalty_terms: PaymentPenaltyTerms = Field( PaymentPenaltyTerms, required=False, profile=EXTENDED, _d="Detailinformationen zu Zahlungszuschlägen", ) - discount_terms = Field( + discount_terms: PaymentDiscountTerms = Field( PaymentDiscountTerms, required=False, profile=EXTENDED, diff --git a/drafthorse/models/product.py b/drafthorse/models/product.py index 9a49cd5..61dbbf0 100644 --- a/drafthorse/models/product.py +++ b/drafthorse/models/product.py @@ -1,4 +1,5 @@ from . import COMFORT, EXTENDED, NS_RAM +from .container import Container from .elements import Element from .fields import ( ClassificationField, @@ -94,11 +95,17 @@ class TradeProduct(Element): ) name = StringField(NS_RAM, "Name", required=False) description = StringField(NS_RAM, "Description", required=False, profile=COMFORT) - characteristics = MultiField(ProductCharacteristic, required=False, profile=COMFORT) - classifications = MultiField(ProductClassification, required=False, profile=COMFORT) - instance = MultiField(ProductInstance, required=False, profile=EXTENDED) - origins = MultiField(OriginCountry, required=False, profile=COMFORT) - included_products = MultiField(ReferencedProduct, required=False, profile=EXTENDED) + characteristics: Container = MultiField( + ProductCharacteristic, required=False, profile=COMFORT + ) + classifications: Container = MultiField( + ProductClassification, required=False, profile=COMFORT + ) + instance: Container = MultiField(ProductInstance, required=False, profile=EXTENDED) + origins: Container = MultiField(OriginCountry, required=False, profile=COMFORT) + included_products: Container = MultiField( + ReferencedProduct, required=False, profile=EXTENDED + ) class Meta: namespace = NS_RAM diff --git a/drafthorse/models/trade.py b/drafthorse/models/trade.py index 99c9302..bc62796 100644 --- a/drafthorse/models/trade.py +++ b/drafthorse/models/trade.py @@ -8,6 +8,7 @@ TradeAllowanceCharge, ) from .delivery import TradeDelivery +from .container import Container from .elements import Element from .fields import DateTimeField, DecimalField, Field, MultiField, StringField from .party import ( @@ -59,28 +60,38 @@ class TradeAgreement(Element): profile=COMFORT, _d="Referenz des Käufers", ) - seller = Field( + seller: SellerTradeParty = Field( SellerTradeParty, required=True, _d="Detailinformationen zum Verkäufer" ) - buyer = Field(BuyerTradeParty, required=True) - end_user = Field( + buyer: BuyerTradeParty = Field(BuyerTradeParty, required=True) + end_user: EndUserTradeParty = Field( EndUserTradeParty, required=False, _d="Abweichender Endverbraucher" ) - delivery_terms = Field(DeliveryTerms, required=False, profile=EXTENDED) - seller_order = Field(SellerOrderReferencedDocument, required=False, profile=COMFORT) - buyer_order = Field(BuyerOrderReferencedDocument, required=False) - customer_order = Field( + delivery_terms: DeliveryTerms = Field( + DeliveryTerms, required=False, profile=EXTENDED + ) + seller_order: SellerOrderReferencedDocument = Field( + SellerOrderReferencedDocument, required=False, profile=COMFORT + ) + buyer_order: BuyerOrderReferencedDocument = Field( + BuyerOrderReferencedDocument, required=False + ) + customer_order: UltimateCustomerOrderReferencedDocument = Field( UltimateCustomerOrderReferencedDocument, required=False, profile=COMFORT ) - contract = Field(ContractReferencedDocument, required=False, profile=COMFORT) - additional_references = MultiField( + contract: ContractReferencedDocument = Field( + ContractReferencedDocument, required=False, profile=COMFORT + ) + additional_references: Container = MultiField( AdditionalReferencedDocument, required=False, profile=COMFORT ) description = StringField(NS_RAM, "Description", required=False, profile=COMFORT) - seller_tax_representative_party = Field( + seller_tax_representative_party: SellerTaxRepresentativeTradeParty = Field( SellerTaxRepresentativeTradeParty, required=False ) - procuring_project_type = Field(ProcuringProjectType, required=False) + procuring_project_type: ProcuringProjectType = Field( + ProcuringProjectType, required=False + ) class Meta: namespace = NS_RAM @@ -102,7 +113,7 @@ class LogisticsServiceCharge(Element): profile=COMFORT, _d="Betrag der Servicegebühr", ) - trade_tax = MultiField(AppliedTradeTax, required=False, profile=COMFORT) + trade_tax: Container = MultiField(AppliedTradeTax, required=False, profile=COMFORT) class Meta: namespace = NS_RAM @@ -151,7 +162,7 @@ class AdvancePayment(Element): received_date = DateTimeField( NS_RAM, "FormattedReceivedDateTime", date_time_namespace=NS_QDT ) - included_trade_tax = MultiField(IncludedTradeTax) + included_trade_tax: Container = MultiField(IncludedTradeTax) class Meta: namespace = NS_RAM @@ -166,48 +177,54 @@ class TradeSettlement(Element): ) currency_code = StringField(NS_RAM, "InvoiceCurrencyCode") issuer_reference = StringField(NS_RAM, "InvoiceIssuerReference", profile=EXTENDED) - invoicer = Field( + invoicer: InvoicerTradeParty = Field( InvoicerTradeParty, required=False, profile=EXTENDED, _d="Rechnungsaussteller" ) - invoicee = Field( + invoicee: InvoiceeTradeParty = Field( InvoiceeTradeParty, required=False, profile=EXTENDED, _d="Rechnungsempfänger" ) - payee = Field( + payee: PayeeTradeParty = Field( PayeeTradeParty, required=False, profile=BASIC, _d="Zahlungsempfänger" ) - payer = Field( + payer: PayerTradeParty = Field( PayerTradeParty, required=False, profile=EXTENDED, _d="Zahlungspflichtiger" ) - invoice_currency = Field(TaxApplicableTradeCurrencyExchange, profile=EXTENDED) - payment_means = Field(PaymentMeans) - trade_tax = MultiField(ApplicableTradeTax) - period = Field(BillingSpecifiedPeriod, required=False, profile=BASIC) - allowance_charge = MultiField( + invoice_currency: TaxApplicableTradeCurrencyExchange = Field( + TaxApplicableTradeCurrencyExchange, profile=EXTENDED + ) + payment_means: PaymentMeans = Field(PaymentMeans) + trade_tax: Container = MultiField(ApplicableTradeTax) + period: BillingSpecifiedPeriod = Field( + BillingSpecifiedPeriod, required=False, profile=BASIC + ) + allowance_charge: Container = MultiField( TradeAllowanceCharge, required=False, profile=BASIC, _d="Schalter für Zu-/Abschlag", ) - service_charge = MultiField( + service_charge: Container = MultiField( LogisticsServiceCharge, required=False, profile=EXTENDED ) - terms = MultiField(PaymentTerms, required=False, profile=BASIC) - monetary_summation = Field( + terms: Container = MultiField(PaymentTerms, required=False, profile=BASIC) + monetary_summation: MonetarySummation = Field( MonetarySummation, required=True, profile=BASIC, _d="Detailinformation zu Belegsummen", ) - invoice_referenced_document = Field( + invoice_referenced_document: InvoiceReferencedDocument = Field( InvoiceReferencedDocument, required=False, profile=BASIC ) - accounting_account = Field( + accounting_account: ReceivableAccountingAccount = Field( ReceivableAccountingAccount, required=False, profile=BASIC, _d="Detailinformationen zur Buchungsreferenz", ) - advance_payment = MultiField(AdvancePayment, required=False, profile=EXTENDED) + advance_payment: Container = MultiField( + AdvancePayment, required=False, profile=EXTENDED + ) class Meta: namespace = NS_RAM @@ -215,10 +232,10 @@ class Meta: class TradeTransaction(Element): - items = MultiField(LineItem, required=True) - agreement = Field(TradeAgreement, required=True) - delivery = Field(TradeDelivery, required=True) - settlement = Field(TradeSettlement, required=True) + items: Container = MultiField(LineItem, required=True) + agreement: TradeAgreement = Field(TradeAgreement, required=True) + delivery: TradeDelivery = Field(TradeDelivery, required=True) + settlement: TradeSettlement = Field(TradeSettlement, required=True) class Meta: namespace = NS_RSM diff --git a/drafthorse/models/tradelines.py b/drafthorse/models/tradelines.py index 9b43c9a..e399383 100644 --- a/drafthorse/models/tradelines.py +++ b/drafthorse/models/tradelines.py @@ -5,6 +5,7 @@ ReceivableAccountingAccount, TradeAllowanceCharge, ) +from .container import Container from .delivery import SupplyChainEvent from .elements import Element from .fields import ( @@ -42,7 +43,7 @@ class GrossPrice(Element): basis_quantity = QuantityField( NS_RAM, "BasisQuantity", required=False, profile=COMFORT, _d="Preisbasismenge" ) - charge = MultiField(AllowanceCharge, required=False, profile=COMFORT) + charge: Container = MultiField(AllowanceCharge, required=False, profile=COMFORT) class Meta: namespace = NS_RAM @@ -65,7 +66,7 @@ class LineDocument(Element): line_id = StringField(NS_RAM, "LineID") line_status_code = StringField(NS_RAM, "LineStatusCode") line_status_reason_code = StringField(NS_RAM, "LineStatusReasonCode") - notes = MultiField(IncludedNote) + notes: Container = MultiField(IncludedNote) class Meta: namespace = NS_RAM @@ -73,18 +74,20 @@ class Meta: class LineAgreement(Element): - buyer_order = Field( + buyer_order: LineBuyerOrderReferencedDocument = Field( LineBuyerOrderReferencedDocument, required=False, profile=EXTENDED ) - contract = Field(LineContractReferencedDocument, required=False, profile=EXTENDED) - customer_order = Field( + contract: LineContractReferencedDocument = Field( + LineContractReferencedDocument, required=False, profile=EXTENDED + ) + customer_order: LineUltimateCustomerOrderReferencedDocument = Field( LineUltimateCustomerOrderReferencedDocument, required=False, profile=EXTENDED ) - additional_references = MultiField( + additional_references: Container = MultiField( LineAdditionalReferencedDocument, required=False, profile=COMFORT ) - gross = Field(GrossPrice, required=False, profile=COMFORT) - net = Field(NetPrice) + gross: GrossPrice = Field(GrossPrice, required=False, profile=COMFORT) + net: NetPrice = Field(NetPrice) class Meta: namespace = NS_RAM @@ -109,21 +112,25 @@ class LineDelivery(Element): profile=EXTENDED, _d="Anzahl Packstücke", ) - ship_to = Field(ShipToTradeParty, required=False, profile=EXTENDED) - ultimate_ship_to = Field(UltimateShipToTradeParty, required=False, profile=EXTENDED) - event = Field( + ship_to: ShipToTradeParty = Field( + ShipToTradeParty, required=False, profile=EXTENDED + ) + ultimate_ship_to: UltimateShipToTradeParty = Field( + UltimateShipToTradeParty, required=False, profile=EXTENDED + ) + event: SupplyChainEvent = Field( SupplyChainEvent, required=False, profile=EXTENDED, _d="Detailinformationen zur tatsächlichen Lieferung", ) - despatch_advice = Field( + despatch_advice: LineDespatchAdviceReferencedDocument = Field( LineDespatchAdviceReferencedDocument, required=False, profile=EXTENDED ) - receiving_advice = Field( + receiving_advice: LineReceivingAdviceReferencedDocument = Field( LineReceivingAdviceReferencedDocument, required=False, profile=EXTENDED ) - delivery_note = Field( + delivery_note: LineDeliveryNoteReferencedDocument = Field( LineDeliveryNoteReferencedDocument, required=False, profile=EXTENDED ) @@ -150,21 +157,23 @@ class Meta: class LineSettlement(Element): - trade_tax = Field(ApplicableTradeTax, required=False) - period = Field(BillingSpecifiedPeriod, required=False) - allowance_charge = MultiField( + trade_tax: ApplicableTradeTax = Field(ApplicableTradeTax, required=False) + period: BillingSpecifiedPeriod = Field(BillingSpecifiedPeriod, required=False) + allowance_charge: Container = MultiField( TradeAllowanceCharge, required=False, _d="Schalter für Zu-/Abschlag", ) - monetary_summation = Field(LineSummation, required=False, profile=BASIC) - invoice_referenced_document = Field( + monetary_summation: LineSummation = Field( + LineSummation, required=False, profile=BASIC + ) + invoice_referenced_document: InvoiceReferencedDocument = Field( InvoiceReferencedDocument, required=False, profile=EXTENDED ) - additional_referenced_document = Field( + additional_referenced_document: LineAdditionalReferencedDocument = Field( LineAdditionalReferencedDocument, required=False, profile=COMFORT ) - accounting_account = Field( + accounting_account: ReceivableAccountingAccount = Field( ReceivableAccountingAccount, required=False, profile=COMFORT, @@ -177,11 +186,11 @@ class Meta: class LineItem(Element): - document = Field(LineDocument, required=True) - product = Field(TradeProduct) - agreement = Field(LineAgreement) - delivery = Field(LineDelivery) - settlement = Field(LineSettlement, required=True) + document: LineDocument = Field(LineDocument, required=True) + product: TradeProduct = Field(TradeProduct) + agreement: LineAgreement = Field(LineAgreement) + delivery: LineDelivery = Field(LineDelivery) + settlement: LineSettlement = Field(LineSettlement, required=True) class Meta: namespace = NS_RAM