Merge branch 'main' into 7.0

This commit is contained in:
Frederik Jaeckel 2024-12-05 15:36:40 +01:00
commit 9e7adb6f5d
13 changed files with 61186 additions and 10 deletions

View file

@ -4,13 +4,14 @@
# full copyright notices and license terms.
from trytond.pool import Pool
from .edocument import Invoice
from .edocument import Invoice, FacturX
from .party import PartyConfiguration, Party
def register():
Pool.register(
Invoice,
FacturX,
Party,
PartyConfiguration,
module='edocument_xrechnung', type_='model')

View file

@ -12,6 +12,42 @@ from trytond.modules.edocument_uncefact.edocument import Invoice
from decimal import Decimal
class FacturX(Invoice):
'Factur-X'
__name__ = 'edocument.facturxext.invoice'
def get_list_of_comments(self):
""" comment, to export in <ram:IncludedNote/>
Returns:
_type_: _description_
"""
result = []
if self.invoice.comment:
result.append({
'content': self.invoice.comment,
'subject_code': '',
'content_code': ''})
return result
def _get_template(self, version):
""" load our own template if 'version' is ours
"""
loader = genshi.template.TemplateLoader(
os.path.join(os.path.dirname(__file__), 'template'),
auto_reload=True)
if version == 'Factur-X-1.07.2-extended':
if self.type_code in ['380', '389', '381', '261']:
return loader.load(os.path.join(version, 'invoice.xml'))
else:
raise ValueError('invalid type-code "%s"' % self.type_code)
else:
return super(Invoice, self)._get_template(version)
# end FacturX
class Invoice(Invoice):
'EDocument XRechnung'
__name__ = 'edocument.xrechnung.invoice'
@ -123,16 +159,20 @@ class Invoice(Invoice):
def _get_template(self, version):
""" load our own template if 'version' is ours
"""
if version in ['XRechnung-2.2', 'XRechnung-2.3', 'XRechnung-3.0']:
loader = genshi.template.TemplateLoader(
os.path.join(os.path.dirname(__file__), 'template'),
auto_reload=True)
if self.type_code in ['380', '389']:
return loader.load(os.path.join(
version, 'XRechnung_invoice.xml'))
elif self.type_code in ['381', '261']:
return loader.load(os.path.join(
version, 'XRechnung_credit.xml'))
if version in ['XRechnung-2.2', 'XRechnung-2.3', 'XRechnung-3.0']:
file_name = {
'380': 'XRechnung_invoice.xml',
'389': 'XRechnung_invoice.xml',
'381': 'XRechnung_credit.xml',
'261': 'XRechnung_credit.xml',
}.get(self.type_code)
if file_name:
return loader.load(os.path.join(version, file_name))
else:
raise ValueError('invalid type-code "%s"' % self.type_code)
else:

View file

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<rsm:CrossIndustryInvoice
xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<py:def function="DateTime(value)">
<udt:DateTimeString format="102">${value.strftime('%Y%m%d')}</udt:DateTimeString>
</py:def>
<py:def function="TradeParty(party, address=None, tax_identifier=None)">
<ram:Name>${party.name}</ram:Name>
<ram:SpecifiedLegalOrganization>
<py:for each="id, attrs in this.party_legal_ids(party, address)">
<ram:ID py:attrs="attrs">${id}</ram:ID>
</py:for>
</ram:SpecifiedLegalOrganization>
<ram:PostalTradeAddress py:if="address">${TradeAddress(address)}</ram:PostalTradeAddress>
<ram:SpecifiedTaxRegistration py:if="tax_identifier and tax_identifier.type == 'eu_vat'">
<ram:ID schemeID='VA'>${tax_identifier.code}</ram:ID>
</ram:SpecifiedTaxRegistration>
</py:def>
<py:def function="TradeAddress(address)">
<ram:PostcodeCode py:if="address.postal_code">${address.postal_code}</ram:PostcodeCode>
<py:with vars="lines = (address.street or '').splitlines()">
<ram:LineOne py:if="len(lines) > 0">${lines[0]}</ram:LineOne>
<ram:LineTwo py:if="len(lines) > 1">${lines[1]}</ram:LineTwo>
<ram:LineThree py:if="len(lines) > 2">${lines[2]}</ram:LineThree>
</py:with>
<ram:CityName py:if="address.city">${address.city}</ram:CityName>
<ram:CountryID py:if="address.country">${address.country.code}</ram:CountryID>
<ram:CountrySubDivisionName py:if="address.subdivision">${address.subdivision.name}</ram:CountrySubDivisionName>
</py:def>
<py:def function="TradeTax(tax, amount=None, base=None)">
<ram:ApplicableTradeTax>
<ram:CalculatedAmount py:if="amount" py:attrs="{'currencyID': this.invoice.currency.code}">${amount * this.type_sign}</ram:CalculatedAmount>
<ram:TypeCode py:if="tax.unece_code">${tax.unece_code}</ram:TypeCode>
<ram:ExemptionReason py:if="tax.legal_notice">${tax.legal_notice}</ram:ExemptionReason>
<ram:BasisAmount py:if="base">${base * this.type_sign}</ram:BasisAmount>
<ram:CategoryCode py:if="tax.unece_category_code">${tax.unece_category_code}</ram:CategoryCode>
<ram:RateApplicablePercent py:if="tax.type == 'percentage'">${tax.rate * 100}</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
</py:def>
<rsm:ExchangedDocumentContext>
<ram:GuidelineSpecifiedDocumentContextParameter>
<ram:ID>urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended</ram:ID>
</ram:GuidelineSpecifiedDocumentContextParameter>
</rsm:ExchangedDocumentContext>
<rsm:ExchangedDocument>
<ram:ID>${this.invoice.number}</ram:ID>
<ram:Name py:if="this.invoice.description">${this.invoice.description}</ram:Name>
<ram:TypeCode>${this.type_code}</ram:TypeCode>
<ram:IssueDateTime>
${DateTime(this.invoice.invoice_date)}
</ram:IssueDateTime>
<py:for each="comment_line in this.get_list_of_comments()">
<ram:IncludedNote>
<ram:ContentCode py:if="comment_line.get('content_code')">${comment_line['content_code']}</ram:ContentCode>
<ram:Content py:if="comment_line.get('content')">${comment_line['content']}</ram:Content>
<ram:SubjectCode py:if="comment_line.get('subject_content')">${comment_line['subject_content']}</ram:SubjectCode>
</ram:IncludedNote>
</py:for>
</rsm:ExchangedDocument>
<rsm:SupplyChainTradeTransaction>
<ram:IncludedSupplyChainTradeLineItem py:for="line_id, line in enumerate(this.lines, 1)">
<ram:AssociatedDocumentLineDocument>
<ram:LineID>${line_id}</ram:LineID>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct py:if="line.product">
<ram:ID py:if="line.product.code">${line.product.code}</ram:ID>
<ram:Name>${line.product.name}</ram:Name>
<ram:Description py:if="line.description">${line.description}</ram:Description>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.currency.round(line.unit_price)}</ram:ChargeAmount>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity py:attrs="{'unitCode': line.unit.unece_code} if line.unit and line.unit.unece_code else {}">${line.quantity * this.type_sign}</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<py:for each="tax in line.invoice_taxes">
${TradeTax(tax.tax)}
</py:for>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount py:attrs="{'currencyID': this.invoice.currency.code}">${line.amount}</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:ApplicableHeaderTradeAgreement>
<ram:SellerTradeParty>
${TradeParty(this.seller_trade_party, this.seller_trade_address, this.seller_trade_tax_identifier)}
</ram:SellerTradeParty>
<ram:BuyerTradeParty>
${TradeParty(this.buyer_trade_party, this.buyer_trade_address, this.buyer_trade_tax_identifier)}
</ram:BuyerTradeParty>
<ram:SellerOrderReferencedDocument py:if="this.invoice.type == 'in'">
<ram:IssuerAssignedID>${this.invoice.reference}</ram:IssuerAssignedID>
</ram:SellerOrderReferencedDocument>
<ram:BuyerOrderReferencedDocument py:if="this.invoice.type == 'out'">
<ram:IssuerAssignedID>${this.invoice.reference}</ram:IssuerAssignedID>
</ram:BuyerOrderReferencedDocument>
</ram:ApplicableHeaderTradeAgreement>
<ram:ApplicableHeaderTradeDelivery>
<ram:ShipToTradeParty py:if="this.ship_to_trade_party">
${TradeParty(this.ship_to_trade_party, this.ship_to_trade_address)}
</ram:ShipToTradeParty>
<ram:ShipFromTradeParty py:if="this.ship_from_trade_party">
${TradeParty(this.ship_from_trade_party, this.ship_from_trade_address)}
</ram:ShipFromTradeParty>
</ram:ApplicableHeaderTradeDelivery>
<ram:ApplicableHeaderTradeSettlement>
<ram:PaymentReference>${this.payment_reference}</ram:PaymentReference>
<ram:InvoiceCurrencyCode>${this.invoice.currency.code}</ram:InvoiceCurrencyCode>
<ram:SpecifiedTradeSettlementPaymentMeans>
<ram:TypeCode>1</ram:TypeCode> <!-- Instrument not defined -->
</ram:SpecifiedTradeSettlementPaymentMeans>
<py:for each="tax in this.invoice.taxes">
${TradeTax(tax.tax, tax.amount, tax.base)}
</py:for>
<ram:SpecifiedTradePaymentTerms py:for="line in this.invoice.lines_to_pay">
<ram:Description py:if="this.invoice.payment_term and this.invoice.payment_term.description">${this.invoice.payment_term.description}</ram:Description>
<ram:DueDateDateTime>
${DateTime(line.maturity_date)}
</ram:DueDateDateTime>
<ram:PartialPaymentAmount py:attrs="{'currencyID': this.invoice.currency.code}">${(line.amount_second_currency or (line.debit - line.credit)) * this.type_sign}</ram:PartialPaymentAmount>
</ram:SpecifiedTradePaymentTerms>
<ram:SpecifiedTradeSettlementHeaderMonetarySummation>
<ram:LineTotalAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.untaxed_amount * this.type_sign}</ram:LineTotalAmount>
<ram:TaxBasisTotalAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.untaxed_amount * this.type_sign}</ram:TaxBasisTotalAmount>
<ram:TaxTotalAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.tax_amount * this.type_sign}</ram:TaxTotalAmount>
<ram:GrandTotalAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.total_amount * this.type_sign}</ram:GrandTotalAmount>
<ram:DuePayableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.amount_to_pay * this.type_sign}</ram:DuePayableAmount>
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
</ram:ApplicableHeaderTradeSettlement>
</rsm:SupplyChainTradeTransaction>
</rsm:CrossIndustryInvoice>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="Factur-X_1.07.2_EXTENDED_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" schemaLocation="Factur-X_1.07.2_EXTENDED_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="Factur-X_1.07.2_EXTENDED_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:element name="CrossIndustryInvoice" type="rsm:CrossIndustryInvoiceType"/>
<xs:complexType name="CrossIndustryInvoiceType">
<xs:sequence>
<xs:element name="ExchangedDocumentContext" type="ram:ExchangedDocumentContextType"/>
<xs:element name="ExchangedDocument" type="ram:ExchangedDocumentType"/>
<xs:element name="SupplyChainTradeTransaction" type="ram:SupplyChainTradeTransactionType"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
elementFormDefault="qualified">
<xs:simpleType name="AccountingAccountTypeCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="AccountingAccountTypeCodeType">
<xs:simpleContent>
<xs:extension base="qdt:AccountingAccountTypeCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="AllowanceChargeReasonCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="AllowanceChargeReasonCodeType">
<xs:simpleContent>
<xs:extension base="qdt:AllowanceChargeReasonCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="ContactTypeCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="ContactTypeCodeType">
<xs:simpleContent>
<xs:extension base="qdt:ContactTypeCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="CountryIDContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="CountryIDType">
<xs:simpleContent>
<xs:extension base="qdt:CountryIDContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="CurrencyCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="CurrencyCodeType">
<xs:simpleContent>
<xs:extension base="qdt:CurrencyCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="DeliveryTermsCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="DeliveryTermsCodeType">
<xs:simpleContent>
<xs:extension base="qdt:DeliveryTermsCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="DocumentCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="DocumentCodeType">
<xs:simpleContent>
<xs:extension base="qdt:DocumentCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="FormattedDateTimeFormatContentType">
<xs:restriction base="xs:string"/>
</xs:simpleType>
<xs:complexType name="FormattedDateTimeType">
<xs:sequence>
<xs:element name="DateTimeString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="qdt:FormattedDateTimeFormatContentType" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="LineStatusCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="LineStatusCodeType">
<xs:simpleContent>
<xs:extension base="qdt:LineStatusCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="PartyRoleCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="PartyRoleCodeType">
<xs:simpleContent>
<xs:extension base="qdt:PartyRoleCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="PaymentMeansCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="PaymentMeansCodeType">
<xs:simpleContent>
<xs:extension base="qdt:PaymentMeansCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="ReferenceCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="ReferenceCodeType">
<xs:simpleContent>
<xs:extension base="qdt:ReferenceCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TaxCategoryCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="TaxCategoryCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TaxCategoryCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TaxTypeCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="TaxTypeCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TaxTypeCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TimeReferenceCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="TimeReferenceCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TimeReferenceCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="TransportModeCodeContentType">
<xs:restriction base="xs:token"/>
</xs:simpleType>
<xs:complexType name="TransportModeCodeType">
<xs:simpleContent>
<xs:extension base="qdt:TransportModeCodeContentType"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

View file

@ -0,0 +1,465 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
targetNamespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" schemaLocation="Factur-X_1.07.2_EXTENDED_urn_un_unece_uncefact_data_standard_QualifiedDataType_100.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" schemaLocation="Factur-X_1.07.2_EXTENDED_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_100.xsd"/>
<xs:complexType name="AdvancePaymentType">
<xs:sequence>
<xs:element name="PaidAmount" type="udt:AmountType"/>
<xs:element name="FormattedReceivedDateTime" type="qdt:FormattedDateTimeType" minOccurs="0"/>
<xs:element name="IncludedTradeTax" type="ram:TradeTaxType" maxOccurs="unbounded"/>
<xs:element name="InvoiceSpecifiedReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CreditorFinancialAccountType">
<xs:sequence>
<xs:element name="IBANID" type="udt:IDType" minOccurs="0"/>
<xs:element name="AccountName" type="udt:TextType" minOccurs="0"/>
<xs:element name="ProprietaryID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="CreditorFinancialInstitutionType">
<xs:sequence>
<xs:element name="BICID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DebtorFinancialAccountType">
<xs:sequence>
<xs:element name="IBANID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentContextParameterType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DocumentLineDocumentType">
<xs:sequence>
<xs:element name="LineID" type="udt:IDType"/>
<xs:element name="ParentLineID" type="udt:IDType" minOccurs="0"/>
<xs:element name="LineStatusCode" type="qdt:LineStatusCodeType" minOccurs="0"/>
<xs:element name="LineStatusReasonCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="IncludedNote" type="ram:NoteType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentContextType">
<xs:sequence>
<xs:element name="TestIndicator" type="udt:IndicatorType" minOccurs="0"/>
<xs:element name="BusinessProcessSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType" minOccurs="0"/>
<xs:element name="GuidelineSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ExchangedDocumentType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
<xs:element name="TypeCode" type="qdt:DocumentCodeType"/>
<xs:element name="IssueDateTime" type="udt:DateTimeType"/>
<xs:element name="CopyIndicator" type="udt:IndicatorType" minOccurs="0"/>
<xs:element name="LanguageID" type="udt:IDType" minOccurs="0"/>
<xs:element name="IncludedNote" type="ram:NoteType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="EffectiveSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeAgreementType">
<xs:sequence>
<xs:element name="BuyerReference" type="udt:TextType" minOccurs="0"/>
<xs:element name="SellerTradeParty" type="ram:TradePartyType"/>
<xs:element name="BuyerTradeParty" type="ram:TradePartyType"/>
<xs:element name="SalesAgentTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="BuyerTaxRepresentativeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="SellerTaxRepresentativeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ProductEndUserTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ApplicableTradeDeliveryTerms" type="ram:TradeDeliveryTermsType" minOccurs="0"/>
<xs:element name="SellerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="BuyerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="QuotationReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ContractReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="AdditionalReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="BuyerAgentTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="SpecifiedProcuringProject" type="ram:ProcuringProjectType" minOccurs="0"/>
<xs:element name="UltimateCustomerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeDeliveryType">
<xs:sequence>
<xs:element name="RelatedSupplyChainConsignment" type="ram:SupplyChainConsignmentType" minOccurs="0"/>
<xs:element name="ShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="UltimateShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ShipFromTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ActualDeliverySupplyChainEvent" type="ram:SupplyChainEventType" minOccurs="0"/>
<xs:element name="DespatchAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ReceivingAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="DeliveryNoteReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="HeaderTradeSettlementType">
<xs:sequence>
<xs:element name="CreditorReferenceID" type="udt:IDType" minOccurs="0"/>
<xs:element name="PaymentReference" type="udt:TextType" minOccurs="0"/>
<xs:element name="TaxCurrencyCode" type="qdt:CurrencyCodeType" minOccurs="0"/>
<xs:element name="InvoiceCurrencyCode" type="qdt:CurrencyCodeType"/>
<xs:element name="InvoiceIssuerReference" type="udt:TextType" minOccurs="0"/>
<xs:element name="InvoicerTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="InvoiceeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="PayeeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="PayerTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="TaxApplicableTradeCurrencyExchange" type="ram:TradeCurrencyExchangeType" minOccurs="0"/>
<xs:element name="SpecifiedTradeSettlementPaymentMeans" type="ram:TradeSettlementPaymentMeansType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableTradeTax" type="ram:TradeTaxType" maxOccurs="unbounded"/>
<xs:element name="BillingSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"/>
<xs:element name="SpecifiedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedLogisticsServiceCharge" type="ram:LogisticsServiceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradePaymentTerms" type="ram:TradePaymentTermsType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeSettlementHeaderMonetarySummation" type="ram:TradeSettlementHeaderMonetarySummationType"/>
<xs:element name="InvoiceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ReceivableSpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedAdvancePayment" type="ram:AdvancePaymentType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LegalOrganizationType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
<xs:element name="TradingBusinessName" type="udt:TextType" minOccurs="0"/>
<xs:element name="PostalTradeAddress" type="ram:TradeAddressType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LineTradeAgreementType">
<xs:sequence>
<xs:element name="SellerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="BuyerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="QuotationReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ContractReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="AdditionalReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="GrossPriceProductTradePrice" type="ram:TradePriceType" minOccurs="0"/>
<xs:element name="NetPriceProductTradePrice" type="ram:TradePriceType"/>
<xs:element name="UltimateCustomerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LineTradeDeliveryType">
<xs:sequence>
<xs:element name="BilledQuantity" type="udt:QuantityType"/>
<xs:element name="ChargeFreeQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="PackageQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="ShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="UltimateShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ActualDeliverySupplyChainEvent" type="ram:SupplyChainEventType" minOccurs="0"/>
<xs:element name="DespatchAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ReceivingAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="DeliveryNoteReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LineTradeSettlementType">
<xs:sequence>
<xs:element name="ApplicableTradeTax" type="ram:TradeTaxType" maxOccurs="unbounded"/>
<xs:element name="BillingSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"/>
<xs:element name="SpecifiedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeSettlementLineMonetarySummation" type="ram:TradeSettlementLineMonetarySummationType"/>
<xs:element name="InvoiceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="AdditionalReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ReceivableSpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LogisticsServiceChargeType">
<xs:sequence>
<xs:element name="Description" type="udt:TextType"/>
<xs:element name="AppliedAmount" type="udt:AmountType"/>
<xs:element name="AppliedTradeTax" type="ram:TradeTaxType" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="LogisticsTransportMovementType">
<xs:sequence>
<xs:element name="ModeCode" type="qdt:TransportModeCodeType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="NoteType">
<xs:sequence>
<xs:element name="ContentCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="Content" type="udt:TextType" minOccurs="0"/>
<xs:element name="SubjectCode" type="udt:CodeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProcuringProjectType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="Name" type="udt:TextType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProductCharacteristicType">
<xs:sequence>
<xs:element name="TypeCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="Description" type="udt:TextType"/>
<xs:element name="ValueMeasure" type="udt:MeasureType" minOccurs="0"/>
<xs:element name="Value" type="udt:TextType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProductClassificationType">
<xs:sequence>
<xs:element name="ClassCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="ClassName" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReferencedDocumentType">
<xs:sequence>
<xs:element name="IssuerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="URIID" type="udt:IDType" minOccurs="0"/>
<xs:element name="LineID" type="udt:IDType" minOccurs="0"/>
<xs:element name="TypeCode" type="qdt:DocumentCodeType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
<xs:element name="AttachmentBinaryObject" type="udt:BinaryObjectType" minOccurs="0"/>
<xs:element name="ReferenceTypeCode" type="qdt:ReferenceCodeType" minOccurs="0"/>
<xs:element name="FormattedIssueDateTime" type="qdt:FormattedDateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReferencedProductType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SellerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="BuyerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="IndustryAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType"/>
<xs:element name="Description" type="udt:TextType" minOccurs="0"/>
<xs:element name="UnitQuantity" type="udt:QuantityType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SpecifiedPeriodType">
<xs:sequence>
<xs:element name="Description" type="udt:TextType" minOccurs="0"/>
<xs:element name="StartDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="EndDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="CompleteDateTime" type="udt:DateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainConsignmentType">
<xs:sequence>
<xs:element name="SpecifiedLogisticsTransportMovement" type="ram:LogisticsTransportMovementType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainEventType">
<xs:sequence>
<xs:element name="OccurrenceDateTime" type="udt:DateTimeType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeLineItemType">
<xs:sequence>
<xs:element name="AssociatedDocumentLineDocument" type="ram:DocumentLineDocumentType"/>
<xs:element name="SpecifiedTradeProduct" type="ram:TradeProductType"/>
<xs:element name="SpecifiedLineTradeAgreement" type="ram:LineTradeAgreementType"/>
<xs:element name="SpecifiedLineTradeDelivery" type="ram:LineTradeDeliveryType"/>
<xs:element name="SpecifiedLineTradeSettlement" type="ram:LineTradeSettlementType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="SupplyChainTradeTransactionType">
<xs:sequence>
<xs:element name="IncludedSupplyChainTradeLineItem" type="ram:SupplyChainTradeLineItemType" maxOccurs="unbounded"/>
<xs:element name="ApplicableHeaderTradeAgreement" type="ram:HeaderTradeAgreementType"/>
<xs:element name="ApplicableHeaderTradeDelivery" type="ram:HeaderTradeDeliveryType"/>
<xs:element name="ApplicableHeaderTradeSettlement" type="ram:HeaderTradeSettlementType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TaxRegistrationType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAccountingAccountType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="TypeCode" type="qdt:AccountingAccountTypeCodeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAddressType">
<xs:sequence>
<xs:element name="PostcodeCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="LineOne" type="udt:TextType" minOccurs="0"/>
<xs:element name="LineTwo" type="udt:TextType" minOccurs="0"/>
<xs:element name="LineThree" type="udt:TextType" minOccurs="0"/>
<xs:element name="CityName" type="udt:TextType" minOccurs="0"/>
<xs:element name="CountryID" type="qdt:CountryIDType"/>
<xs:element name="CountrySubDivisionName" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeAllowanceChargeType">
<xs:sequence>
<xs:element name="ChargeIndicator" type="udt:IndicatorType"/>
<xs:element name="SequenceNumeric" type="udt:NumericType" minOccurs="0"/>
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="BasisQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="ActualAmount" type="udt:AmountType"/>
<xs:element name="ReasonCode" type="qdt:AllowanceChargeReasonCodeType" minOccurs="0"/>
<xs:element name="Reason" type="udt:TextType" minOccurs="0"/>
<xs:element name="CategoryTradeTax" type="ram:TradeTaxType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeContactType">
<xs:sequence>
<xs:element name="PersonName" type="udt:TextType" minOccurs="0"/>
<xs:element name="DepartmentName" type="udt:TextType" minOccurs="0"/>
<xs:element name="TypeCode" type="qdt:ContactTypeCodeType" minOccurs="0"/>
<xs:element name="TelephoneUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
<xs:element name="FaxUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
<xs:element name="EmailURIUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeCountryType">
<xs:sequence>
<xs:element name="ID" type="qdt:CountryIDType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeCurrencyExchangeType">
<xs:sequence>
<xs:element name="SourceCurrencyCode" type="qdt:CurrencyCodeType"/>
<xs:element name="TargetCurrencyCode" type="qdt:CurrencyCodeType"/>
<xs:element name="ConversionRate" type="udt:RateType"/>
<xs:element name="ConversionRateDateTime" type="udt:DateTimeType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeDeliveryTermsType">
<xs:sequence>
<xs:element name="DeliveryTypeCode" type="qdt:DeliveryTermsCodeType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePartyType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0"/>
<xs:element name="RoleCode" type="qdt:PartyRoleCodeType" minOccurs="0"/>
<xs:element name="Description" type="udt:TextType" minOccurs="0"/>
<xs:element name="SpecifiedLegalOrganization" type="ram:LegalOrganizationType" minOccurs="0"/>
<xs:element name="DefinedTradeContact" type="ram:TradeContactType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="PostalTradeAddress" type="ram:TradeAddressType" minOccurs="0"/>
<xs:element name="URIUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
<xs:element name="SpecifiedTaxRegistration" type="ram:TaxRegistrationType" minOccurs="0" maxOccurs="2"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePaymentDiscountTermsType">
<xs:sequence>
<xs:element name="BasisDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="BasisPeriodMeasure" type="udt:MeasureType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
<xs:element name="ActualDiscountAmount" type="udt:AmountType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePaymentPenaltyTermsType">
<xs:sequence>
<xs:element name="BasisDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="BasisPeriodMeasure" type="udt:MeasureType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="CalculationPercent" type="udt:PercentType" minOccurs="0"/>
<xs:element name="ActualPenaltyAmount" type="udt:AmountType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePaymentTermsType">
<xs:sequence>
<xs:element name="Description" type="udt:TextType" minOccurs="0"/>
<xs:element name="DueDateDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="DirectDebitMandateID" type="udt:IDType" minOccurs="0"/>
<xs:element name="PartialPaymentAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="ApplicableTradePaymentPenaltyTerms" type="ram:TradePaymentPenaltyTermsType" minOccurs="0"/>
<xs:element name="ApplicableTradePaymentDiscountTerms" type="ram:TradePaymentDiscountTermsType" minOccurs="0"/>
<xs:element name="PayeeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradePriceType">
<xs:sequence>
<xs:element name="ChargeAmount" type="udt:AmountType"/>
<xs:element name="BasisQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="AppliedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="IncludedTradeTax" type="ram:TradeTaxType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeProductInstanceType">
<xs:sequence>
<xs:element name="BatchID" type="udt:IDType" minOccurs="0"/>
<xs:element name="SupplierAssignedSerialID" type="udt:IDType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeProductType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType" minOccurs="0"/>
<xs:element name="GlobalID" type="udt:IDType" minOccurs="0"/>
<xs:element name="SellerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="BuyerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="IndustryAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="ModelID" type="udt:IDType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType"/>
<xs:element name="Description" type="udt:TextType" minOccurs="0"/>
<xs:element name="BatchID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="BrandName" type="udt:TextType" minOccurs="0"/>
<xs:element name="ModelName" type="udt:TextType" minOccurs="0"/>
<xs:element name="ApplicableProductCharacteristic" type="ram:ProductCharacteristicType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DesignatedProductClassification" type="ram:ProductClassificationType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="IndividualTradeProductInstance" type="ram:TradeProductInstanceType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="OriginTradeCountry" type="ram:TradeCountryType" minOccurs="0"/>
<xs:element name="IncludedReferencedProduct" type="ram:ReferencedProductType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementFinancialCardType">
<xs:sequence>
<xs:element name="ID" type="udt:IDType"/>
<xs:element name="CardholderName" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementHeaderMonetarySummationType">
<xs:sequence>
<xs:element name="LineTotalAmount" type="udt:AmountType"/>
<xs:element name="ChargeTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="AllowanceTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="TaxBasisTotalAmount" type="udt:AmountType"/>
<xs:element name="TaxTotalAmount" type="udt:AmountType" minOccurs="0" maxOccurs="2"/>
<xs:element name="RoundingAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="GrandTotalAmount" type="udt:AmountType"/>
<xs:element name="TotalPrepaidAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="DuePayableAmount" type="udt:AmountType"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementLineMonetarySummationType">
<xs:sequence>
<xs:element name="LineTotalAmount" type="udt:AmountType"/>
<xs:element name="ChargeTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="AllowanceTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="TaxTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="GrandTotalAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="TotalAllowanceChargeAmount" type="udt:AmountType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeSettlementPaymentMeansType">
<xs:sequence>
<xs:element name="TypeCode" type="qdt:PaymentMeansCodeType"/>
<xs:element name="Information" type="udt:TextType" minOccurs="0"/>
<xs:element name="ApplicableTradeSettlementFinancialCard" type="ram:TradeSettlementFinancialCardType" minOccurs="0"/>
<xs:element name="PayerPartyDebtorFinancialAccount" type="ram:DebtorFinancialAccountType" minOccurs="0"/>
<xs:element name="PayeePartyCreditorFinancialAccount" type="ram:CreditorFinancialAccountType" minOccurs="0"/>
<xs:element name="PayeeSpecifiedCreditorFinancialInstitution" type="ram:CreditorFinancialInstitutionType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="TradeTaxType">
<xs:sequence>
<xs:element name="CalculatedAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="TypeCode" type="qdt:TaxTypeCodeType"/>
<xs:element name="ExemptionReason" type="udt:TextType" minOccurs="0"/>
<xs:element name="BasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="LineTotalBasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="AllowanceChargeBasisAmount" type="udt:AmountType" minOccurs="0"/>
<xs:element name="CategoryCode" type="qdt:TaxCategoryCodeType"/>
<xs:element name="ExemptionReasonCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="TaxPointDate" type="udt:DateType" minOccurs="0"/>
<xs:element name="DueDateTypeCode" type="qdt:TimeReferenceCodeType" minOccurs="0"/>
<xs:element name="RateApplicablePercent" type="udt:PercentType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="UniversalCommunicationType">
<xs:sequence>
<xs:element name="URIID" type="udt:IDType" minOccurs="0"/>
<xs:element name="CompleteNumber" type="udt:TextType" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>

View file

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"
elementFormDefault="qualified">
<xs:complexType name="AmountType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="currencyID" type="xs:token" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="BinaryObjectType">
<xs:simpleContent>
<xs:extension base="xs:base64Binary">
<xs:attribute name="mimeCode" type="xs:token" use="required"/>
<xs:attribute name="filename" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="CodeType">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="listID" type="xs:token" use="optional"/>
<xs:attribute name="listVersionID" type="xs:token"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="DateTimeType">
<xs:choice>
<xs:element name="DateTimeString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="DateType">
<xs:choice>
<xs:element name="DateString">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="format" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:complexType name="IDType">
<xs:simpleContent>
<xs:extension base="xs:token">
<xs:attribute name="schemeID" type="xs:token"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="IndicatorType">
<xs:choice>
<xs:element name="Indicator" type="xs:boolean"/>
</xs:choice>
</xs:complexType>
<xs:complexType name="MeasureType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="unitCode" type="xs:token"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="NumericType">
<xs:simpleContent>
<xs:extension base="xs:decimal"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="PercentType">
<xs:simpleContent>
<xs:extension base="xs:decimal"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="QuantityType">
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="unitCode" type="xs:token"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="RateType">
<xs:simpleContent>
<xs:extension base="xs:decimal"/>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="TextType">
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:schema>

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -46,6 +46,52 @@ class EdocTestCase(ModuleTestCase):
{'identifiers': [('delete', [party.identifiers[0].id])]}]
)
@with_transaction()
def test_xrechn_export_facturx(self):
""" run export - factur-x
"""
pool = Pool()
Template = pool.get('edocument.facturxext.invoice')
Identifier = pool.get('party.identifier')
Party = pool.get('party.party')
Bank = pool.get('bank')
BankAccount = pool.get('bank.account')
BankNumber = pool.get('bank.account.number')
invoice = get_invoice()
invoice.payment_term_date = date.today()
invoice.party.get_xrechnung_route_id = Mock(
return_value='xrechn-route-id-123')
invoice.company.party.bank_accounts = [
Mock(
spec=BankAccount,
currency=invoice.currency,
bank=Mock(spec=Bank, party=Mock(spec=Party, name='Bank')),
owners=[invoice.company.party],
numbers=[Mock(spec=BankNumber, type='other', number='123456')],
)]
invoice.description = 'description of invoice'
invoice.comment = 'note line 1\nnote line 2'
invoice.taxes[0].tax.rate = Decimal('0.1')
invoice.identifiers = [
Mock(
spec=Identifier,
type='edoc_route_id',
code='xrechn-route-id-123')
]
template = Template(invoice)
schema_file = os.path.join(
os.path.dirname(__file__),
'Factur-X_1.07.2_EXTENDED',
'Factur-X_1.07.2_EXTENDED.xsd')
invoice_string = template.render('Factur-X-1.07.2-extended')
invoice_xml = etree.fromstring(invoice_string)
schema = etree.XMLSchema(etree.parse(schema_file))
schema.assertValid(invoice_xml)
@with_transaction()
def test_xrechn_export_xml_invoice(self):
""" run export - invoice

21
tests/validate_xml.py Normal file
View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# This file is part of the edocument-module for Tryton from m-ds.de.
# The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms.
from lxml import etree
import os
file_name = 'file-to-check.xml'
schema_file = os.path.join(
os.path.dirname(__file__),
'Factur-X_1.07.2_EXTENDED',
'Factur-X_1.07.2_EXTENDED.xsd')
with open(file_name, 'r') as fhdl:
f_content = fhdl.read()
f_content = f_content.encode('utf8')
invoice_xml = etree.fromstring(f_content)
schema = etree.XMLSchema(etree.parse(schema_file))
print('Result:', schema.assertValid(invoice_xml))