first commit
This commit is contained in:
409
modules/edocument_ubl/tests/UBL-CreditNote-2.1-Example.xml
Normal file
409
modules/edocument_ubl/tests/UBL-CreditNote-2.1-Example.xml
Normal file
@@ -0,0 +1,409 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CreditNote xmlns="urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
|
||||
<cbc:UBLVersionID>2.1</cbc:UBLVersionID>
|
||||
<cbc:ID>TOSL108</cbc:ID>
|
||||
<cbc:IssueDate>2009-12-15</cbc:IssueDate>
|
||||
<cbc:Note languageID="en">Ordered in our booth at the convention.</cbc:Note>
|
||||
<cbc:DocumentCurrencyCode listID="ISO 4217 Alpha" listAgencyID="6">EUR</cbc:DocumentCurrencyCode>
|
||||
<cbc:AccountingCost>Project cost code 123</cbc:AccountingCost>
|
||||
<cac:InvoicePeriod>
|
||||
<cbc:StartDate>2009-11-01</cbc:StartDate>
|
||||
<cbc:EndDate>2009-11-30</cbc:EndDate>
|
||||
</cac:InvoicePeriod>
|
||||
<cac:OrderReference>
|
||||
<cbc:ID>123</cbc:ID>
|
||||
</cac:OrderReference>
|
||||
<cac:ContractDocumentReference>
|
||||
<cbc:ID>Contract321</cbc:ID>
|
||||
<cbc:DocumentType>Framework agreement</cbc:DocumentType>
|
||||
</cac:ContractDocumentReference>
|
||||
<cac:AdditionalDocumentReference>
|
||||
<cbc:ID>Doc1</cbc:ID>
|
||||
<cbc:DocumentType>Timesheet</cbc:DocumentType>
|
||||
<cac:Attachment>
|
||||
<cac:ExternalReference>
|
||||
<cbc:URI>http://www.suppliersite.eu/sheet001.html</cbc:URI>
|
||||
</cac:ExternalReference>
|
||||
</cac:Attachment>
|
||||
</cac:AdditionalDocumentReference>
|
||||
<cac:AdditionalDocumentReference>
|
||||
<cbc:ID>Doc2</cbc:ID>
|
||||
<cbc:DocumentType>Drawing</cbc:DocumentType>
|
||||
<cac:Attachment>
|
||||
<cbc:EmbeddedDocumentBinaryObject mimeCode="application/pdf">UjBsR09EbGhjZ0dTQUxNQUFBUUNBRU1tQ1p0dU1GUXhEUzhi</cbc:EmbeddedDocumentBinaryObject>
|
||||
</cac:Attachment>
|
||||
</cac:AdditionalDocumentReference>
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cbc:EndpointID schemeID="GLN" schemeAgencyID="9">1234567890123</cbc:EndpointID>
|
||||
<cac:PartyIdentification>
|
||||
<cbc:ID schemeID="ZZZ">Supp123</cbc:ID>
|
||||
</cac:PartyIdentification>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Salescompany ltd.</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:ID schemeID="GLN" schemeAgencyID="9">1231412341324</cbc:ID>
|
||||
<cbc:Postbox>5467</cbc:Postbox>
|
||||
<cbc:StreetName>Main street</cbc:StreetName>
|
||||
<cbc:AdditionalStreetName>Suite 123</cbc:AdditionalStreetName>
|
||||
<cbc:BuildingNumber>1</cbc:BuildingNumber>
|
||||
<cbc:Department>Revenue department</cbc:Department>
|
||||
<cbc:CityName>Big city</cbc:CityName>
|
||||
<cbc:PostalZone>54321</cbc:PostalZone>
|
||||
<cbc:CountrySubentityCode>RegionA</cbc:CountrySubentityCode>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode listID="ISO3166-1" listAgencyID="6">DK</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID schemeID="DKVAT" schemeAgencyID="ZZZ">DK12345</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
<cbc:RegistrationName>The Sellercompany Incorporated</cbc:RegistrationName>
|
||||
<cbc:CompanyID schemeID="CVR" schemeAgencyID="ZZZ">5402697509</cbc:CompanyID>
|
||||
<cac:RegistrationAddress>
|
||||
<cbc:CityName>Big city</cbc:CityName>
|
||||
<cbc:CountrySubentity>RegionA</cbc:CountrySubentity>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DK</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:RegistrationAddress>
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
<cbc:Telephone>4621230</cbc:Telephone>
|
||||
<cbc:Telefax>4621231</cbc:Telefax>
|
||||
<cbc:ElectronicMail>antonio@salescompany.dk</cbc:ElectronicMail>
|
||||
</cac:Contact>
|
||||
<cac:Person>
|
||||
<cbc:FirstName>Antonio</cbc:FirstName>
|
||||
<cbc:FamilyName>M</cbc:FamilyName>
|
||||
<cbc:MiddleName>Salemacher</cbc:MiddleName>
|
||||
<cbc:JobTitle>Sales manager</cbc:JobTitle>
|
||||
</cac:Person>
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cbc:EndpointID schemeID="GLN" schemeAgencyID="9">1234567987654</cbc:EndpointID>
|
||||
<cac:PartyIdentification>
|
||||
<cbc:ID schemeID="ZZZ">345KS5324</cbc:ID>
|
||||
</cac:PartyIdentification>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Buyercompany ltd</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:ID schemeID="GLN" schemeAgencyID="9">1238764941386</cbc:ID>
|
||||
<cbc:Postbox>123</cbc:Postbox>
|
||||
<cbc:StreetName>Anystreet</cbc:StreetName>
|
||||
<cbc:AdditionalStreetName>Back door</cbc:AdditionalStreetName>
|
||||
<cbc:BuildingNumber>8</cbc:BuildingNumber>
|
||||
<cbc:Department>Accounting department</cbc:Department>
|
||||
<cbc:CityName>Anytown</cbc:CityName>
|
||||
<cbc:PostalZone>101</cbc:PostalZone>
|
||||
<cbc:CountrySubentity>RegionB</cbc:CountrySubentity>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode listID="ISO3166-1" listAgencyID="6">BE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID schemeID="BEVAT" schemeAgencyID="ZZZ">BE54321</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
<cbc:RegistrationName>The buyercompany inc.</cbc:RegistrationName>
|
||||
<cbc:CompanyID schemeAgencyID="ZZZ" schemeID="ZZZ">5645342123</cbc:CompanyID>
|
||||
<cac:RegistrationAddress>
|
||||
<cbc:CityName>Mainplace</cbc:CityName>
|
||||
<cbc:CountrySubentity>RegionB</cbc:CountrySubentity>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>BE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:RegistrationAddress>
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
<cbc:Telephone>5121230</cbc:Telephone>
|
||||
<cbc:Telefax>5121231</cbc:Telefax>
|
||||
<cbc:ElectronicMail>john@buyercompany.eu</cbc:ElectronicMail>
|
||||
</cac:Contact>
|
||||
<cac:Person>
|
||||
<cbc:FirstName>John</cbc:FirstName>
|
||||
<cbc:FamilyName>X</cbc:FamilyName>
|
||||
<cbc:MiddleName>Doe</cbc:MiddleName>
|
||||
<cbc:JobTitle>Purchasing manager</cbc:JobTitle>
|
||||
</cac:Person>
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
<cac:PayeeParty>
|
||||
<cac:PartyIdentification>
|
||||
<cbc:ID schemeID="GLN" schemeAgencyID="9">098740918237</cbc:ID>
|
||||
</cac:PartyIdentification>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Ebeneser Scrooge Inc.</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PartyLegalEntity>
|
||||
<cbc:CompanyID schemeID="UK:CH" schemeAgencyID="ZZZ">6411982340</cbc:CompanyID>
|
||||
</cac:PartyLegalEntity>
|
||||
</cac:PayeeParty>
|
||||
<cac:AllowanceCharge>
|
||||
<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Packing cost</cbc:AllowanceChargeReason>
|
||||
<cbc:Amount currencyID="EUR">100</cbc:Amount>
|
||||
</cac:AllowanceCharge>
|
||||
<cac:AllowanceCharge>
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Promotion discount</cbc:AllowanceChargeReason>
|
||||
<cbc:Amount currencyID="EUR">100</cbc:Amount>
|
||||
</cac:AllowanceCharge>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">292.20</cbc:TaxAmount>
|
||||
<cac:TaxSubtotal>
|
||||
<cbc:TaxableAmount currencyID="EUR">1460.5</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount currencyID="EUR">292.1</cbc:TaxAmount>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
|
||||
<cbc:Percent>20</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
<cac:TaxSubtotal>
|
||||
<cbc:TaxableAmount currencyID="EUR">1</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount currencyID="EUR">0.1</cbc:TaxAmount>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">AA</cbc:ID>
|
||||
<cbc:Percent>10</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
<cac:TaxSubtotal>
|
||||
<cbc:TaxableAmount currencyID="EUR">-25</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount currencyID="EUR">0</cbc:TaxAmount>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">E</cbc:ID>
|
||||
<cbc:Percent>0</cbc:Percent>
|
||||
<cbc:TaxExemptionReasonCode listID="CWA 15577" listAgencyID="ZZZ">AAM</cbc:TaxExemptionReasonCode>
|
||||
<cbc:TaxExemptionReason>Exempt New Means of Transport</cbc:TaxExemptionReason>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
</cac:TaxTotal>
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">1436.5</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount currencyID="EUR">1436.5</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount currencyID="EUR">1729</cbc:TaxInclusiveAmount>
|
||||
<cbc:AllowanceTotalAmount currencyID="EUR">100</cbc:AllowanceTotalAmount>
|
||||
<cbc:ChargeTotalAmount currencyID="EUR">100</cbc:ChargeTotalAmount>
|
||||
<cbc:PrepaidAmount currencyID="EUR">1000</cbc:PrepaidAmount>
|
||||
<cbc:PayableRoundingAmount currencyID="EUR">0.30</cbc:PayableRoundingAmount>
|
||||
<cbc:PayableAmount currencyID="EUR">729</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
<cac:CreditNoteLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:Note>Scratch on box</cbc:Note>
|
||||
<cbc:CreditedQuantity unitCode="C62">1</cbc:CreditedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">1273</cbc:LineExtensionAmount>
|
||||
<cbc:AccountingCost>BookingCode001</cbc:AccountingCost>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">254.6</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
<cac:Item>
|
||||
<cbc:Description languageID="EN">Processor: Intel Core 2 Duo SU9400 LV (1.4GHz). RAM:
|
||||
3MB. Screen 1440x900</cbc:Description>
|
||||
<cbc:Name>Labtop computer</cbc:Name>
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>JB007</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:StandardItemIdentification>
|
||||
<cbc:ID schemeID="GTIN" schemeAgencyID="9">1234567890124</cbc:ID>
|
||||
</cac:StandardItemIdentification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="113" listID="UNSPSC">12344321</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="2" listID="CPV">65434568</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<ClassifiedTaxCategory xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
|
||||
<cbc:Percent>20</cbc:Percent>
|
||||
<TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</TaxScheme>
|
||||
</ClassifiedTaxCategory>
|
||||
<cac:AdditionalItemProperty>
|
||||
<cbc:Name>Color</cbc:Name>
|
||||
<cbc:Value>black</cbc:Value>
|
||||
</cac:AdditionalItemProperty>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">1273</cbc:PriceAmount>
|
||||
<cbc:BaseQuantity unitCode="C62">1</cbc:BaseQuantity>
|
||||
<cac:AllowanceCharge>
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Contract</cbc:AllowanceChargeReason>
|
||||
<cbc:MultiplierFactorNumeric>0.15</cbc:MultiplierFactorNumeric>
|
||||
<cbc:Amount currencyID="EUR">225</cbc:Amount>
|
||||
<cbc:BaseAmount currencyID="EUR">1500</cbc:BaseAmount>
|
||||
</cac:AllowanceCharge>
|
||||
</cac:Price>
|
||||
</cac:CreditNoteLine>
|
||||
<cac:CreditNoteLine>
|
||||
<cbc:ID>2</cbc:ID>
|
||||
<cbc:Note>Cover is slightly damaged.</cbc:Note>
|
||||
<cbc:CreditedQuantity unitCode="C62">-1</cbc:CreditedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">-3.96</cbc:LineExtensionAmount>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">-0.396</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
<cac:Item>
|
||||
<cbc:Name>Returned "Advanced computing" book</cbc:Name>
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>JB008</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:StandardItemIdentification>
|
||||
<cbc:ID schemeID="GTIN" schemeAgencyID="9">1234567890125</cbc:ID>
|
||||
</cac:StandardItemIdentification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="113" listID="UNSPSC">32344324</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="2" listID="CPV">65434567</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<ClassifiedTaxCategory xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">AA</cbc:ID>
|
||||
<cbc:Percent>10</cbc:Percent>
|
||||
<TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</TaxScheme>
|
||||
</ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">3.96</cbc:PriceAmount>
|
||||
<cbc:BaseQuantity unitCode="C62">1</cbc:BaseQuantity>
|
||||
</cac:Price>
|
||||
</cac:CreditNoteLine>
|
||||
<cac:CreditNoteLine>
|
||||
<cbc:ID>3</cbc:ID>
|
||||
<cbc:CreditedQuantity unitCode="C62">2</cbc:CreditedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">4.96</cbc:LineExtensionAmount>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">0.496</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
<cac:Item>
|
||||
<cbc:Name>"Computing for dummies" book</cbc:Name>
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>JB009</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:StandardItemIdentification>
|
||||
<cbc:ID schemeID="GTIN" schemeAgencyID="9">1234567890126</cbc:ID>
|
||||
</cac:StandardItemIdentification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="113" listID="UNSPSC">32344324</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="2" listID="CPV">65434566</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<ClassifiedTaxCategory xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">AA</cbc:ID>
|
||||
<cbc:Percent>10</cbc:Percent>
|
||||
<TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</TaxScheme>
|
||||
</ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">2.48</cbc:PriceAmount>
|
||||
<cbc:BaseQuantity unitCode="C62">1</cbc:BaseQuantity>
|
||||
<cac:AllowanceCharge>
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Contract</cbc:AllowanceChargeReason>
|
||||
<cbc:MultiplierFactorNumeric>0.1</cbc:MultiplierFactorNumeric>
|
||||
<cbc:Amount currencyID="EUR">0.275</cbc:Amount>
|
||||
<cbc:BaseAmount currencyID="EUR">2.75</cbc:BaseAmount>
|
||||
</cac:AllowanceCharge>
|
||||
</cac:Price>
|
||||
</cac:CreditNoteLine>
|
||||
<cac:CreditNoteLine>
|
||||
<cbc:ID>4</cbc:ID>
|
||||
<cbc:CreditedQuantity unitCode="C62">-1</cbc:CreditedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">-25</cbc:LineExtensionAmount>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">0</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
<cac:Item>
|
||||
<cbc:Name>Returned IBM 5150 desktop</cbc:Name>
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>JB010</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:StandardItemIdentification>
|
||||
<cbc:ID schemeID="GTIN" schemeAgencyID="9">1234567890127</cbc:ID>
|
||||
</cac:StandardItemIdentification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="113" listID="UNSPSC">12344322</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="2" listID="CPV">65434565</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<ClassifiedTaxCategory xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">E</cbc:ID>
|
||||
<cbc:Percent>0</cbc:Percent>
|
||||
<TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</TaxScheme>
|
||||
</ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">25</cbc:PriceAmount>
|
||||
<cbc:BaseQuantity unitCode="C62">1</cbc:BaseQuantity>
|
||||
</cac:Price>
|
||||
</cac:CreditNoteLine>
|
||||
<cac:CreditNoteLine>
|
||||
<cbc:ID>5</cbc:ID>
|
||||
<cbc:CreditedQuantity unitCode="C62">250</cbc:CreditedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">187.5</cbc:LineExtensionAmount>
|
||||
<cbc:AccountingCost>BookingCode002</cbc:AccountingCost>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">37.5</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
<cac:Item>
|
||||
<cbc:Name>Network cable</cbc:Name>
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>JB011</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:StandardItemIdentification>
|
||||
<cbc:ID schemeID="GTIN" schemeAgencyID="9">1234567890128</cbc:ID>
|
||||
</cac:StandardItemIdentification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="113" listID="UNSPSC">12344325</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="2" listID="CPV">65434564</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<ClassifiedTaxCategory xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
|
||||
<cbc:Percent>20</cbc:Percent>
|
||||
<TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</TaxScheme>
|
||||
</ClassifiedTaxCategory>
|
||||
<cac:AdditionalItemProperty>
|
||||
<cbc:Name>Type</cbc:Name>
|
||||
<cbc:Value>Cat5</cbc:Value>
|
||||
</cac:AdditionalItemProperty>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">0.75</cbc:PriceAmount>
|
||||
<cbc:BaseQuantity unitCode="C62">1</cbc:BaseQuantity>
|
||||
</cac:Price>
|
||||
</cac:CreditNoteLine>
|
||||
</CreditNote>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
|
||||
|
||||
<cbc:ID>123</cbc:ID>
|
||||
<cbc:IssueDate>2011-09-22</cbc:IssueDate>
|
||||
|
||||
<cac:InvoicePeriod>
|
||||
<cbc:StartDate>2011-08-01</cbc:StartDate>
|
||||
<cbc:EndDate>2011-08-31</cbc:EndDate>
|
||||
</cac:InvoicePeriod>
|
||||
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Custom Cotter Pins</cbc:Name>
|
||||
</cac:PartyName>
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>North American Veeblefetzer</cbc:Name>
|
||||
</cac:PartyName>
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:PayableAmount currencyID="CAD">100.00</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:LineExtensionAmount currencyID="CAD">100.00</cbc:LineExtensionAmount>
|
||||
<cac:Item>
|
||||
<cbc:Description>Cotter pin, MIL-SPEC</cbc:Description>
|
||||
</cac:Item>
|
||||
</cac:InvoiceLine>
|
||||
|
||||
</Invoice>
|
||||
470
modules/edocument_ubl/tests/UBL-Invoice-2.1-Example.xml
Normal file
470
modules/edocument_ubl/tests/UBL-Invoice-2.1-Example.xml
Normal file
@@ -0,0 +1,470 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
|
||||
<cbc:UBLVersionID>2.1</cbc:UBLVersionID>
|
||||
<cbc:ID>TOSL108</cbc:ID>
|
||||
<cbc:IssueDate>2009-12-15</cbc:IssueDate>
|
||||
<cbc:InvoiceTypeCode listID="UN/ECE 1001 Subset" listAgencyID="6">380</cbc:InvoiceTypeCode>
|
||||
<cbc:Note languageID="en">Ordered in our booth at the convention.</cbc:Note>
|
||||
<cbc:TaxPointDate>2009-11-30</cbc:TaxPointDate>
|
||||
<cbc:DocumentCurrencyCode listID="ISO 4217 Alpha" listAgencyID="6">EUR</cbc:DocumentCurrencyCode>
|
||||
<cbc:AccountingCost>Project cost code 123</cbc:AccountingCost>
|
||||
<cac:InvoicePeriod>
|
||||
<cbc:StartDate>2009-11-01</cbc:StartDate>
|
||||
<cbc:EndDate>2009-11-30</cbc:EndDate>
|
||||
</cac:InvoicePeriod>
|
||||
<cac:OrderReference>
|
||||
<cbc:ID>123</cbc:ID>
|
||||
</cac:OrderReference>
|
||||
<cac:ContractDocumentReference>
|
||||
<cbc:ID>Contract321</cbc:ID>
|
||||
<cbc:DocumentType>Framework agreement</cbc:DocumentType>
|
||||
</cac:ContractDocumentReference>
|
||||
<cac:AdditionalDocumentReference>
|
||||
<cbc:ID>Doc1</cbc:ID>
|
||||
<cbc:DocumentType>Timesheet</cbc:DocumentType>
|
||||
<cac:Attachment>
|
||||
<cac:ExternalReference>
|
||||
<cbc:URI>http://www.suppliersite.eu/sheet001.html</cbc:URI>
|
||||
</cac:ExternalReference>
|
||||
</cac:Attachment>
|
||||
</cac:AdditionalDocumentReference>
|
||||
<cac:AdditionalDocumentReference>
|
||||
<cbc:ID>Doc2</cbc:ID>
|
||||
<cbc:DocumentType>Drawing</cbc:DocumentType>
|
||||
<cac:Attachment>
|
||||
<cbc:EmbeddedDocumentBinaryObject mimeCode="application/pdf">UjBsR09EbGhjZ0dTQUxNQUFBUUNBRU1tQ1p0dU1GUXhEUzhi</cbc:EmbeddedDocumentBinaryObject>
|
||||
</cac:Attachment>
|
||||
</cac:AdditionalDocumentReference>
|
||||
<cac:AccountingSupplierParty>
|
||||
<cac:Party>
|
||||
<cbc:EndpointID schemeID="GLN" schemeAgencyID="9">1234567890123</cbc:EndpointID>
|
||||
<cac:PartyIdentification>
|
||||
<cbc:ID schemeID="ZZZ">Supp123</cbc:ID>
|
||||
</cac:PartyIdentification>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Salescompany ltd.</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:ID schemeID="GLN" schemeAgencyID="9">1231412341324</cbc:ID>
|
||||
<cbc:Postbox>5467</cbc:Postbox>
|
||||
<cbc:StreetName>Main street</cbc:StreetName>
|
||||
<cbc:AdditionalStreetName>Suite 123</cbc:AdditionalStreetName>
|
||||
<cbc:BuildingNumber>1</cbc:BuildingNumber>
|
||||
<cbc:Department>Revenue department</cbc:Department>
|
||||
<cbc:CityName>Big city</cbc:CityName>
|
||||
<cbc:PostalZone>54321</cbc:PostalZone>
|
||||
<cbc:CountrySubentityCode>RegionA</cbc:CountrySubentityCode>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode listID="ISO3166-1" listAgencyID="6">DK</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID schemeID="DKVAT" schemeAgencyID="ZZZ">DK12345</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
<cbc:RegistrationName>The Sellercompany Incorporated</cbc:RegistrationName>
|
||||
<cbc:CompanyID schemeID="CVR" schemeAgencyID="ZZZ">5402697509</cbc:CompanyID>
|
||||
<cac:RegistrationAddress>
|
||||
<cbc:CityName>Big city</cbc:CityName>
|
||||
<cbc:CountrySubentity>RegionA</cbc:CountrySubentity>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>DK</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:RegistrationAddress>
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
<cbc:Telephone>4621230</cbc:Telephone>
|
||||
<cbc:Telefax>4621231</cbc:Telefax>
|
||||
<cbc:ElectronicMail>antonio@salescompany.dk</cbc:ElectronicMail>
|
||||
</cac:Contact>
|
||||
<cac:Person>
|
||||
<cbc:FirstName>Antonio</cbc:FirstName>
|
||||
<cbc:FamilyName>Salemacher</cbc:FamilyName>
|
||||
<cbc:MiddleName>M</cbc:MiddleName>
|
||||
<cbc:JobTitle>Sales manager</cbc:JobTitle>
|
||||
</cac:Person>
|
||||
</cac:Party>
|
||||
</cac:AccountingSupplierParty>
|
||||
<cac:AccountingCustomerParty>
|
||||
<cac:Party>
|
||||
<cbc:EndpointID schemeID="GLN" schemeAgencyID="9">1234567987654</cbc:EndpointID>
|
||||
<cac:PartyIdentification>
|
||||
<cbc:ID schemeID="ZZZ">345KS5324</cbc:ID>
|
||||
</cac:PartyIdentification>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Buyercompany ltd</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PostalAddress>
|
||||
<cbc:ID schemeID="GLN" schemeAgencyID="9">1238764941386</cbc:ID>
|
||||
<cbc:Postbox>123</cbc:Postbox>
|
||||
<cbc:StreetName>Anystreet</cbc:StreetName>
|
||||
<cbc:AdditionalStreetName>Back door</cbc:AdditionalStreetName>
|
||||
<cbc:BuildingNumber>8</cbc:BuildingNumber>
|
||||
<cbc:Department>Accounting department</cbc:Department>
|
||||
<cbc:CityName>Anytown</cbc:CityName>
|
||||
<cbc:PostalZone>101</cbc:PostalZone>
|
||||
<cbc:CountrySubentity>RegionB</cbc:CountrySubentity>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode listID="ISO3166-1" listAgencyID="6">BE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:PostalAddress>
|
||||
<cac:PartyTaxScheme>
|
||||
<cbc:CompanyID schemeID="BEVAT" schemeAgencyID="ZZZ">BE54321</cbc:CompanyID>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:PartyTaxScheme>
|
||||
<cac:PartyLegalEntity>
|
||||
<cbc:RegistrationName>The buyercompany inc.</cbc:RegistrationName>
|
||||
<cbc:CompanyID schemeAgencyID="ZZZ" schemeID="ZZZ">5645342123</cbc:CompanyID>
|
||||
<cac:RegistrationAddress>
|
||||
<cbc:CityName>Mainplace</cbc:CityName>
|
||||
<cbc:CountrySubentity>RegionB</cbc:CountrySubentity>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>BE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:RegistrationAddress>
|
||||
</cac:PartyLegalEntity>
|
||||
<cac:Contact>
|
||||
<cbc:Telephone>5121230</cbc:Telephone>
|
||||
<cbc:Telefax>5121231</cbc:Telefax>
|
||||
<cbc:ElectronicMail>john@buyercompany.eu</cbc:ElectronicMail>
|
||||
</cac:Contact>
|
||||
<cac:Person>
|
||||
<cbc:FirstName>John</cbc:FirstName>
|
||||
<cbc:FamilyName>Doe</cbc:FamilyName>
|
||||
<cbc:MiddleName>X</cbc:MiddleName>
|
||||
<cbc:JobTitle>Purchasing manager</cbc:JobTitle>
|
||||
</cac:Person>
|
||||
</cac:Party>
|
||||
</cac:AccountingCustomerParty>
|
||||
<cac:PayeeParty>
|
||||
<cac:PartyIdentification>
|
||||
<cbc:ID schemeID="GLN" schemeAgencyID="9">098740918237</cbc:ID>
|
||||
</cac:PartyIdentification>
|
||||
<cac:PartyName>
|
||||
<cbc:Name>Ebeneser Scrooge Inc.</cbc:Name>
|
||||
</cac:PartyName>
|
||||
<cac:PartyLegalEntity>
|
||||
<cbc:CompanyID schemeID="UK:CH" schemeAgencyID="ZZZ">6411982340</cbc:CompanyID>
|
||||
</cac:PartyLegalEntity>
|
||||
</cac:PayeeParty>
|
||||
<cac:Delivery>
|
||||
<cbc:ActualDeliveryDate>2009-12-15</cbc:ActualDeliveryDate>
|
||||
<cac:DeliveryLocation>
|
||||
<cbc:ID schemeID="GLN" schemeAgencyID="9">6754238987648</cbc:ID>
|
||||
<cac:Address>
|
||||
<cbc:StreetName>Deliverystreet</cbc:StreetName>
|
||||
<cbc:AdditionalStreetName>Side door</cbc:AdditionalStreetName>
|
||||
<cbc:BuildingNumber>12</cbc:BuildingNumber>
|
||||
<cbc:CityName>DeliveryCity</cbc:CityName>
|
||||
<cbc:PostalZone>523427</cbc:PostalZone>
|
||||
<cbc:CountrySubentity>RegionC</cbc:CountrySubentity>
|
||||
<cac:Country>
|
||||
<cbc:IdentificationCode>BE</cbc:IdentificationCode>
|
||||
</cac:Country>
|
||||
</cac:Address>
|
||||
</cac:DeliveryLocation>
|
||||
</cac:Delivery>
|
||||
<cac:PaymentMeans>
|
||||
<cbc:PaymentMeansCode listID="UN/ECE 4461">31</cbc:PaymentMeansCode>
|
||||
<cbc:PaymentDueDate>2009-12-31</cbc:PaymentDueDate>
|
||||
<cbc:PaymentChannelCode>IBAN</cbc:PaymentChannelCode>
|
||||
<cbc:PaymentID>Payref1</cbc:PaymentID>
|
||||
<cac:PayeeFinancialAccount>
|
||||
<cbc:ID>DK1212341234123412</cbc:ID>
|
||||
<cac:FinancialInstitutionBranch>
|
||||
<cac:FinancialInstitution>
|
||||
<cbc:ID>DKDKABCD</cbc:ID>
|
||||
</cac:FinancialInstitution>
|
||||
</cac:FinancialInstitutionBranch>
|
||||
</cac:PayeeFinancialAccount>
|
||||
</cac:PaymentMeans>
|
||||
<cac:PaymentTerms>
|
||||
<cbc:Note>Penalty percentage 10% from due date</cbc:Note>
|
||||
</cac:PaymentTerms>
|
||||
<cac:AllowanceCharge>
|
||||
<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Packing cost</cbc:AllowanceChargeReason>
|
||||
<cbc:Amount currencyID="EUR">100</cbc:Amount>
|
||||
</cac:AllowanceCharge>
|
||||
<cac:AllowanceCharge>
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Promotion discount</cbc:AllowanceChargeReason>
|
||||
<cbc:Amount currencyID="EUR">100</cbc:Amount>
|
||||
</cac:AllowanceCharge>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">292.20</cbc:TaxAmount>
|
||||
<cac:TaxSubtotal>
|
||||
<cbc:TaxableAmount currencyID="EUR">1460.5</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount currencyID="EUR">292.1</cbc:TaxAmount>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
|
||||
<cbc:Percent>20</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
<cac:TaxSubtotal>
|
||||
<cbc:TaxableAmount currencyID="EUR">1</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount currencyID="EUR">0.1</cbc:TaxAmount>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">AA</cbc:ID>
|
||||
<cbc:Percent>10</cbc:Percent>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
<cac:TaxSubtotal>
|
||||
<cbc:TaxableAmount currencyID="EUR">-25</cbc:TaxableAmount>
|
||||
<cbc:TaxAmount currencyID="EUR">0</cbc:TaxAmount>
|
||||
<cac:TaxCategory>
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">E</cbc:ID>
|
||||
<cbc:Percent>0</cbc:Percent>
|
||||
<cbc:TaxExemptionReasonCode listID="CWA 15577" listAgencyID="ZZZ">AAM</cbc:TaxExemptionReasonCode>
|
||||
<cbc:TaxExemptionReason>Exempt New Means of Transport</cbc:TaxExemptionReason>
|
||||
<cac:TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</cac:TaxScheme>
|
||||
</cac:TaxCategory>
|
||||
</cac:TaxSubtotal>
|
||||
</cac:TaxTotal>
|
||||
<cac:LegalMonetaryTotal>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">1436.5</cbc:LineExtensionAmount>
|
||||
<cbc:TaxExclusiveAmount currencyID="EUR">1436.5</cbc:TaxExclusiveAmount>
|
||||
<cbc:TaxInclusiveAmount currencyID="EUR">1729</cbc:TaxInclusiveAmount>
|
||||
<cbc:AllowanceTotalAmount currencyID="EUR">100</cbc:AllowanceTotalAmount>
|
||||
<cbc:ChargeTotalAmount currencyID="EUR">100</cbc:ChargeTotalAmount>
|
||||
<cbc:PrepaidAmount currencyID="EUR">1000</cbc:PrepaidAmount>
|
||||
<cbc:PayableRoundingAmount currencyID="EUR">0.30</cbc:PayableRoundingAmount>
|
||||
<cbc:PayableAmount currencyID="EUR">729</cbc:PayableAmount>
|
||||
</cac:LegalMonetaryTotal>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>1</cbc:ID>
|
||||
<cbc:Note>Scratch on box</cbc:Note>
|
||||
<cbc:InvoicedQuantity unitCode="C62">1</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">1273</cbc:LineExtensionAmount>
|
||||
<cbc:AccountingCost>BookingCode001</cbc:AccountingCost>
|
||||
<cac:OrderLineReference>
|
||||
<cbc:LineID>1</cbc:LineID>
|
||||
</cac:OrderLineReference>
|
||||
<cac:AllowanceCharge>
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Damage</cbc:AllowanceChargeReason>
|
||||
<cbc:Amount currencyID="EUR">12</cbc:Amount>
|
||||
</cac:AllowanceCharge>
|
||||
<cac:AllowanceCharge>
|
||||
<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Testing</cbc:AllowanceChargeReason>
|
||||
<cbc:Amount currencyID="EUR">10</cbc:Amount>
|
||||
</cac:AllowanceCharge>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">254.6</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
<cac:Item>
|
||||
<cbc:Description languageID="EN">Processor: Intel Core 2 Duo SU9400 LV (1.4GHz). RAM:
|
||||
3MB. Screen 1440x900</cbc:Description>
|
||||
<cbc:Name>Labtop computer</cbc:Name>
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>JB007</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:StandardItemIdentification>
|
||||
<cbc:ID schemeID="GTIN" schemeAgencyID="9">1234567890124</cbc:ID>
|
||||
</cac:StandardItemIdentification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="113" listID="UNSPSC">12344321</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="2" listID="CPV">65434568</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<ClassifiedTaxCategory xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
|
||||
<cbc:Percent>20</cbc:Percent>
|
||||
<TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</TaxScheme>
|
||||
</ClassifiedTaxCategory>
|
||||
<cac:AdditionalItemProperty>
|
||||
<cbc:Name>Color</cbc:Name>
|
||||
<cbc:Value>black</cbc:Value>
|
||||
</cac:AdditionalItemProperty>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">1273</cbc:PriceAmount>
|
||||
<cbc:BaseQuantity unitCode="C62">1</cbc:BaseQuantity>
|
||||
<cac:AllowanceCharge>
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Contract</cbc:AllowanceChargeReason>
|
||||
<cbc:MultiplierFactorNumeric>0.15</cbc:MultiplierFactorNumeric>
|
||||
<cbc:Amount currencyID="EUR">225</cbc:Amount>
|
||||
<cbc:BaseAmount currencyID="EUR">1500</cbc:BaseAmount>
|
||||
</cac:AllowanceCharge>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>2</cbc:ID>
|
||||
<cbc:Note>Cover is slightly damaged.</cbc:Note>
|
||||
<cbc:InvoicedQuantity unitCode="C62">-1</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">-3.96</cbc:LineExtensionAmount>
|
||||
<cac:OrderLineReference>
|
||||
<cbc:LineID>5</cbc:LineID>
|
||||
</cac:OrderLineReference>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">-0.396</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
<cac:Item>
|
||||
<cbc:Name>Returned "Advanced computing" book</cbc:Name>
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>JB008</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:StandardItemIdentification>
|
||||
<cbc:ID schemeID="GTIN" schemeAgencyID="9">1234567890125</cbc:ID>
|
||||
</cac:StandardItemIdentification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="113" listID="UNSPSC">32344324</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="2" listID="CPV">65434567</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<ClassifiedTaxCategory xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">AA</cbc:ID>
|
||||
<cbc:Percent>10</cbc:Percent>
|
||||
<TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</TaxScheme>
|
||||
</ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">3.96</cbc:PriceAmount>
|
||||
<cbc:BaseQuantity unitCode="C62">1</cbc:BaseQuantity>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>3</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="C62">2</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">4.96</cbc:LineExtensionAmount>
|
||||
<cac:OrderLineReference>
|
||||
<cbc:LineID>3</cbc:LineID>
|
||||
</cac:OrderLineReference>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">0.496</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
<cac:Item>
|
||||
<cbc:Name>"Computing for dummies" book</cbc:Name>
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>JB009</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:StandardItemIdentification>
|
||||
<cbc:ID schemeID="GTIN" schemeAgencyID="9">1234567890126</cbc:ID>
|
||||
</cac:StandardItemIdentification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="113" listID="UNSPSC">32344324</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="2" listID="CPV">65434566</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<ClassifiedTaxCategory xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">AA</cbc:ID>
|
||||
<cbc:Percent>10</cbc:Percent>
|
||||
<TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</TaxScheme>
|
||||
</ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">2.48</cbc:PriceAmount>
|
||||
<cbc:BaseQuantity unitCode="C62">1</cbc:BaseQuantity>
|
||||
<cac:AllowanceCharge>
|
||||
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
|
||||
<cbc:AllowanceChargeReason>Contract</cbc:AllowanceChargeReason>
|
||||
<cbc:MultiplierFactorNumeric>0.1</cbc:MultiplierFactorNumeric>
|
||||
<cbc:Amount currencyID="EUR">0.275</cbc:Amount>
|
||||
<cbc:BaseAmount currencyID="EUR">2.75</cbc:BaseAmount>
|
||||
</cac:AllowanceCharge>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>4</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="C62">-1</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">-25</cbc:LineExtensionAmount>
|
||||
<cac:OrderLineReference>
|
||||
<cbc:LineID>2</cbc:LineID>
|
||||
</cac:OrderLineReference>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">0</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
<cac:Item>
|
||||
<cbc:Name>Returned IBM 5150 desktop</cbc:Name>
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>JB010</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:StandardItemIdentification>
|
||||
<cbc:ID schemeID="GTIN" schemeAgencyID="9">1234567890127</cbc:ID>
|
||||
</cac:StandardItemIdentification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="113" listID="UNSPSC">12344322</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="2" listID="CPV">65434565</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<ClassifiedTaxCategory xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">E</cbc:ID>
|
||||
<cbc:Percent>0</cbc:Percent>
|
||||
<TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</TaxScheme>
|
||||
</ClassifiedTaxCategory>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">25</cbc:PriceAmount>
|
||||
<cbc:BaseQuantity unitCode="C62">1</cbc:BaseQuantity>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
<cac:InvoiceLine>
|
||||
<cbc:ID>5</cbc:ID>
|
||||
<cbc:InvoicedQuantity unitCode="C62">250</cbc:InvoicedQuantity>
|
||||
<cbc:LineExtensionAmount currencyID="EUR">187.5</cbc:LineExtensionAmount>
|
||||
<cbc:AccountingCost>BookingCode002</cbc:AccountingCost>
|
||||
<cac:OrderLineReference>
|
||||
<cbc:LineID>4</cbc:LineID>
|
||||
</cac:OrderLineReference>
|
||||
<cac:TaxTotal>
|
||||
<cbc:TaxAmount currencyID="EUR">37.5</cbc:TaxAmount>
|
||||
</cac:TaxTotal>
|
||||
<cac:Item>
|
||||
<cbc:Name>Network cable</cbc:Name>
|
||||
<cac:SellersItemIdentification>
|
||||
<cbc:ID>JB011</cbc:ID>
|
||||
</cac:SellersItemIdentification>
|
||||
<cac:StandardItemIdentification>
|
||||
<cbc:ID schemeID="GTIN" schemeAgencyID="9">1234567890128</cbc:ID>
|
||||
</cac:StandardItemIdentification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="113" listID="UNSPSC">12344325</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<cac:CommodityClassification>
|
||||
<cbc:ItemClassificationCode listAgencyID="2" listID="CPV">65434564</cbc:ItemClassificationCode>
|
||||
</cac:CommodityClassification>
|
||||
<ClassifiedTaxCategory xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2">
|
||||
<cbc:ID schemeID="UN/ECE 5305" schemeAgencyID="6">S</cbc:ID>
|
||||
<cbc:Percent>20</cbc:Percent>
|
||||
<TaxScheme>
|
||||
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
|
||||
</TaxScheme>
|
||||
</ClassifiedTaxCategory>
|
||||
<cac:AdditionalItemProperty>
|
||||
<cbc:Name>Type</cbc:Name>
|
||||
<cbc:Value>Cat5</cbc:Value>
|
||||
</cac:AdditionalItemProperty>
|
||||
</cac:Item>
|
||||
<cac:Price>
|
||||
<cbc:PriceAmount currencyID="EUR">0.75</cbc:PriceAmount>
|
||||
<cbc:BaseQuantity unitCode="C62">1</cbc:BaseQuantity>
|
||||
</cac:Price>
|
||||
</cac:InvoiceLine>
|
||||
</Invoice>
|
||||
2
modules/edocument_ubl/tests/__init__.py
Normal file
2
modules/edocument_ubl/tests/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
BIN
modules/edocument_ubl/tests/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
modules/edocument_ubl/tests/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
[
|
||||
{"cash_rounding": true}
|
||||
,{"cash_rounding": false}
|
||||
]
|
||||
@@ -0,0 +1,90 @@
|
||||
=======================
|
||||
UBL 2 Credit Note Parse
|
||||
=======================
|
||||
|
||||
Imports::
|
||||
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.modules.account.tests.tools import create_chart, create_tax
|
||||
>>> from trytond.modules.company.tests.tools import create_company, get_company
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
|
||||
>>> cash_rounding = globals().get('cash_rounding', False)
|
||||
|
||||
Activate modules::
|
||||
|
||||
>>> modules = ['edocument_ubl', 'account_invoice']
|
||||
>>> if cash_rounding:
|
||||
... modules.append('account_cash_rounding')
|
||||
>>> config = activate_modules(modules, create_company, create_chart)
|
||||
|
||||
>>> Attachment = Model.get('ir.attachment')
|
||||
>>> EInvoice = Model.get('edocument.ubl.invoice')
|
||||
>>> Invoice = Model.get('account.invoice')
|
||||
|
||||
Setup company::
|
||||
|
||||
>>> company = get_company()
|
||||
>>> company.party.name = 'Buyercompany ltd'
|
||||
>>> company.party.save()
|
||||
|
||||
Create currency::
|
||||
|
||||
>>> eur = get_currency('EUR')
|
||||
>>> if cash_rounding:
|
||||
... eur.cash_rounding = Decimal('1')
|
||||
>>> eur.save()
|
||||
|
||||
Create tax::
|
||||
|
||||
>>> tax20 = create_tax(Decimal('.2'))
|
||||
>>> tax20.unece_category_code = 'S'
|
||||
>>> tax20.unece_code = 'VAT'
|
||||
>>> tax20.save()
|
||||
|
||||
>>> tax10 = create_tax(Decimal('.1'))
|
||||
>>> tax10.unece_category_code = 'AA'
|
||||
>>> tax10.unece_code = 'VAT'
|
||||
>>> tax10.save()
|
||||
|
||||
>>> tax0 = create_tax(Decimal('0'))
|
||||
>>> tax0.unece_category_code = 'E'
|
||||
>>> tax0.unece_code = 'VAT'
|
||||
>>> tax0.save()
|
||||
|
||||
Parse the UBL invoice::
|
||||
|
||||
>>> with file_open(
|
||||
... 'edocument_ubl/tests/UBL-CreditNote-2.1-Example.xml',
|
||||
... mode='rb') as fp:
|
||||
... invoice_id = EInvoice.parse(fp.read(), config.context)
|
||||
|
||||
>>> invoice = Invoice(invoice_id)
|
||||
|
||||
>>> invoice.reference
|
||||
'TOSL108'
|
||||
>>> assertEqual(invoice.invoice_date, dt.date(2009, 12, 15))
|
||||
>>> invoice.party.name
|
||||
'The Sellercompany Incorporated'
|
||||
>>> invoice.invoice_address.rec_name
|
||||
'The Sellercompany Incorporated, Main street 1 5467, 54321, Big city'
|
||||
>>> assertEqual(invoice.company, company)
|
||||
>>> assertEqual(
|
||||
... invoice.total_amount,
|
||||
... Decimal('-1729.00') if cash_rounding else Decimal('-1728.70'))
|
||||
>>> invoice.tax_amount
|
||||
Decimal('-292.20')
|
||||
>>> len(invoice.lines)
|
||||
7
|
||||
|
||||
>>> attachments = Attachment.find([])
|
||||
>>> len(attachments)
|
||||
3
|
||||
>>> assertEqual({a.resource for a in attachments}, {invoice})
|
||||
>>> sorted((a.name, a.type) for a in attachments)
|
||||
[('Drawing Doc2.pdf', 'data'), ('Framework agreement Contract321', 'data'), ('Timesheet Doc1', 'link')]
|
||||
@@ -0,0 +1,4 @@
|
||||
[
|
||||
{"cash_rounding": true}
|
||||
,{"cash_rounding": false}
|
||||
]
|
||||
90
modules/edocument_ubl/tests/scenario_ubl_2_invoice_parse.rst
Normal file
90
modules/edocument_ubl/tests/scenario_ubl_2_invoice_parse.rst
Normal file
@@ -0,0 +1,90 @@
|
||||
===================
|
||||
UBL 2 Invoice Parse
|
||||
===================
|
||||
|
||||
Imports::
|
||||
|
||||
>>> import datetime as dt
|
||||
>>> from decimal import Decimal
|
||||
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.modules.account.tests.tools import create_chart, create_tax
|
||||
>>> from trytond.modules.company.tests.tools import create_company, get_company
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
|
||||
>>> cash_rounding = globals().get('cash_rounding', False)
|
||||
|
||||
Activate modules::
|
||||
|
||||
>>> modules = ['edocument_ubl', 'account_invoice', 'purchase']
|
||||
>>> if cash_rounding:
|
||||
... modules.append('account_cash_rounding')
|
||||
>>> config = activate_modules(modules, create_company, create_chart)
|
||||
|
||||
>>> Attachment = Model.get('ir.attachment')
|
||||
>>> EInvoice = Model.get('edocument.ubl.invoice')
|
||||
>>> Invoice = Model.get('account.invoice')
|
||||
|
||||
Setup company::
|
||||
|
||||
>>> company = get_company()
|
||||
>>> company.party.name = 'Buyercompany ltd'
|
||||
>>> company.party.save()
|
||||
|
||||
Create currency::
|
||||
|
||||
>>> eur = get_currency('EUR')
|
||||
>>> if cash_rounding:
|
||||
... eur.cash_rounding = Decimal('1')
|
||||
>>> eur.save()
|
||||
|
||||
Create tax::
|
||||
|
||||
>>> tax20 = create_tax(Decimal('.2'))
|
||||
>>> tax20.unece_category_code = 'S'
|
||||
>>> tax20.unece_code = 'VAT'
|
||||
>>> tax20.save()
|
||||
|
||||
>>> tax10 = create_tax(Decimal('.1'))
|
||||
>>> tax10.unece_category_code = 'AA'
|
||||
>>> tax10.unece_code = 'VAT'
|
||||
>>> tax10.save()
|
||||
|
||||
>>> tax0 = create_tax(Decimal('0'))
|
||||
>>> tax0.unece_category_code = 'E'
|
||||
>>> tax0.unece_code = 'VAT'
|
||||
>>> tax0.save()
|
||||
|
||||
Parse the UBL invoice::
|
||||
|
||||
>>> with file_open(
|
||||
... 'edocument_ubl/tests/UBL-Invoice-2.1-Example.xml',
|
||||
... mode='rb') as fp:
|
||||
... invoice_id = EInvoice.parse(fp.read(), config.context)
|
||||
|
||||
>>> invoice = Invoice(invoice_id)
|
||||
|
||||
>>> invoice.reference
|
||||
'TOSL108'
|
||||
>>> assertEqual(invoice.invoice_date, dt.date(2009, 12, 15))
|
||||
>>> invoice.party.name
|
||||
'The Sellercompany Incorporated'
|
||||
>>> invoice.invoice_address.rec_name
|
||||
'The Sellercompany Incorporated, Main street 1 5467, 54321, Big city'
|
||||
>>> assertEqual(invoice.company, company)
|
||||
>>> assertEqual(
|
||||
... invoice.total_amount,
|
||||
... Decimal('1729.00') if cash_rounding else Decimal('1728.70'))
|
||||
>>> invoice.tax_amount
|
||||
Decimal('292.20')
|
||||
>>> len(invoice.lines)
|
||||
7
|
||||
|
||||
>>> attachments = Attachment.find([])
|
||||
>>> len(attachments)
|
||||
3
|
||||
>>> assertEqual({a.resource for a in attachments}, {invoice})
|
||||
>>> sorted((a.name, a.type) for a in attachments)
|
||||
[('Drawing Doc2.pdf', 'data'), ('Framework agreement Contract321', 'data'), ('Timesheet Doc1', 'link')]
|
||||
@@ -0,0 +1,56 @@
|
||||
===========================
|
||||
UBL 2 Invoice Parse Trivial
|
||||
===========================
|
||||
|
||||
Imports::
|
||||
|
||||
>>> import datetime as dt
|
||||
|
||||
>>> from proteus import Model
|
||||
>>> from trytond.modules.account.tests.tools import create_chart
|
||||
>>> from trytond.modules.company.tests.tools import create_company, get_company
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
>>> from trytond.tools import file_open
|
||||
|
||||
Activate modules::
|
||||
|
||||
>>> config = activate_modules(
|
||||
... ['edocument_ubl', 'account_invoice'], create_company, create_chart)
|
||||
|
||||
>>> EInvoice = Model.get('edocument.ubl.invoice')
|
||||
>>> Invoice = Model.get('account.invoice')
|
||||
|
||||
Setup company::
|
||||
|
||||
>>> company = get_company()
|
||||
>>> company.party.name = 'North American Veeblefetzer'
|
||||
>>> company.party.save()
|
||||
|
||||
Create currency::
|
||||
|
||||
>>> eur = get_currency('CAD')
|
||||
|
||||
Parse the UBL invoice::
|
||||
|
||||
>>> with file_open(
|
||||
... 'edocument_ubl/tests/UBL-Invoice-2.1-Example-Trivial.xml',
|
||||
... mode='rb') as fp:
|
||||
... invoice_id = EInvoice.parse(fp.read(), config.context)
|
||||
|
||||
>>> invoice = Invoice(invoice_id)
|
||||
|
||||
>>> assertEqual(invoice.invoice_date, dt.date(2011, 9, 22))
|
||||
>>> invoice.party.name
|
||||
'Custom Cotter Pins'
|
||||
>>> assertEqual(invoice.company, company)
|
||||
>>> invoice.total_amount
|
||||
Decimal('100.00')
|
||||
>>> line, = invoice.lines
|
||||
>>> line.description
|
||||
'Cotter pin, MIL-SPEC'
|
||||
>>> line.quantity
|
||||
1.0
|
||||
>>> line.unit
|
||||
>>> line.unit_price
|
||||
Decimal('100.0000')
|
||||
269
modules/edocument_ubl/tests/test_module.py
Normal file
269
modules/edocument_ubl/tests/test_module.py
Normal file
@@ -0,0 +1,269 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
import datetime
|
||||
import os
|
||||
from decimal import Decimal
|
||||
from unittest.mock import MagicMock, Mock, patch
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from trytond.pool import Pool
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
|
||||
|
||||
def get_invoice():
|
||||
pool = Pool()
|
||||
Address = pool.get('party.address')
|
||||
Company = pool.get('company.company')
|
||||
Country = pool.get('country.country')
|
||||
Currency = pool.get('currency.currency')
|
||||
Identifier = pool.get('party.identifier')
|
||||
Invoice = pool.get('account.invoice')
|
||||
InvoiceLine = pool.get('account.invoice.line')
|
||||
InvoiceTax = pool.get('account.invoice.tax')
|
||||
MoveLine = pool.get('account.move.line')
|
||||
Party = pool.get('party.party')
|
||||
PaymentTerm = pool.get('account.invoice.payment_term')
|
||||
Product = pool.get('product.product')
|
||||
Tax = pool.get('account.tax')
|
||||
Uom = pool.get('product.uom')
|
||||
|
||||
address = Mock(spec=Address,
|
||||
street_unstructured="St sample, 15",
|
||||
street="St sample, 15\n2nd floor\nBox 1234\n",
|
||||
city="Scranton",
|
||||
postal_code="1000",
|
||||
subdivision=None,
|
||||
country=Mock(spec=Country,
|
||||
code='US'),
|
||||
)
|
||||
address.building_name = "Building A"
|
||||
address.country.name = "United States"
|
||||
identifier = MagicMock(
|
||||
spec=Identifier,
|
||||
type='be_vat',
|
||||
code='BE123456789')
|
||||
type(identifier).iso_6523 = Identifier.iso_6523
|
||||
type(identifier)._eas_type = Identifier._eas_type
|
||||
type(identifier).eas = Identifier.eas
|
||||
type(identifier).unece_code = Identifier.unece_code
|
||||
party = MagicMock(
|
||||
spec=Party,
|
||||
addresses=[address],
|
||||
identifiers=[identifier],
|
||||
)
|
||||
type(party).identifier_iso6523 = Party.identifier_iso6523
|
||||
type(party).identifier_eas = Party.identifier_eas
|
||||
party.name = "Michael Scott"
|
||||
company = Mock(spec=Company,
|
||||
party=Mock(
|
||||
spec=Party,
|
||||
addresses=[Mock(spec=Address,
|
||||
street_unstructured="Main street, 42",
|
||||
street="Main street, 42",
|
||||
country=Mock(spec=Country,
|
||||
code='US'))],
|
||||
identifiers=[Mock(
|
||||
spec=Identifier,
|
||||
type='us_ein',
|
||||
code='911144442')],
|
||||
))
|
||||
company.party.name = "Dunder Mifflin"
|
||||
company.party.address_get = Mock(return_value=company.party.addresses[0])
|
||||
taxes = [Mock(spec=InvoiceTax,
|
||||
tax=Mock(spec=Tax,
|
||||
legal_notice="Legal Notice",
|
||||
unece_category_code='S',
|
||||
unece_code='VAT',
|
||||
type='percentage',
|
||||
rate=Decimal('.1'),
|
||||
),
|
||||
base=Decimal('100.00'),
|
||||
amount=Decimal('10.00'),
|
||||
legal_notice="Legal Notice",
|
||||
)]
|
||||
product = Mock(spec=Product,
|
||||
code="12345",
|
||||
type='service',
|
||||
)
|
||||
product.name = "Product"
|
||||
product.identifier_get.return_value = '98412345678908'
|
||||
lines = [Mock(spec=InvoiceLine,
|
||||
type='line',
|
||||
product=product,
|
||||
unit=Mock(spec=Uom,
|
||||
),
|
||||
quantity=1,
|
||||
unit_price=Decimal('100.0000'),
|
||||
amount=Decimal('100.00'),
|
||||
description="Description",
|
||||
invoice_taxes=taxes,
|
||||
)]
|
||||
invoice = MagicMock(spec=Invoice,
|
||||
id=-1,
|
||||
__int__=Mock(return_value=-1),
|
||||
type='out',
|
||||
sequence_type='invoice',
|
||||
number="001",
|
||||
party=party,
|
||||
party_lang='fr',
|
||||
party_tax_identifier=identifier,
|
||||
invoice_address=party.addresses[0],
|
||||
company=company,
|
||||
currency=Mock(spec=Currency,
|
||||
code='USD',
|
||||
round=lambda a: a),
|
||||
invoice_date=datetime.date.today(),
|
||||
reference="PO1234",
|
||||
payment_term=Mock(spec=PaymentTerm, description="Direct"),
|
||||
lines=lines,
|
||||
line_lines=lines,
|
||||
taxes=taxes,
|
||||
untaxed_amount=Decimal('100.00'),
|
||||
tax_amount=Decimal('10.00'),
|
||||
total_amount=Decimal('110.00'),
|
||||
amount_to_pay=Decimal('110.00'),
|
||||
lines_to_pay=[Mock(spec=MoveLine,
|
||||
maturity_date=datetime.date.today(),
|
||||
amount=Decimal('110.00'),
|
||||
)],
|
||||
sales=[],
|
||||
state='posted',
|
||||
)
|
||||
return invoice
|
||||
|
||||
|
||||
class EdocumentUblTestCase(ModuleTestCase):
|
||||
"Test Edocument Ubl module"
|
||||
module = 'edocument_ubl'
|
||||
extras = [
|
||||
'account_invoice', 'document_incoming_invoice', 'purchase', 'sale']
|
||||
|
||||
@with_transaction()
|
||||
def test_Invoice_2(self):
|
||||
"Test Invoice-2"
|
||||
pool = Pool()
|
||||
Template = pool.get('edocument.ubl.invoice')
|
||||
InvoiceReport = pool.get('account.invoice', type='report')
|
||||
with patch.object(InvoiceReport, 'execute') as execute:
|
||||
execute.return_value = ['pdf', b'data', False, 'Invoice-1234']
|
||||
invoice = get_invoice()
|
||||
template = Template(invoice)
|
||||
|
||||
invoice_string = template.render('2')
|
||||
invoice_xml = etree.fromstring(invoice_string)
|
||||
schema_file = os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
'2.4', 'maindoc', 'UBL-Invoice-2.4.xsd')
|
||||
schema = etree.XMLSchema(etree.parse(schema_file))
|
||||
schema.assertValid(invoice_xml)
|
||||
|
||||
@with_transaction()
|
||||
def test_Invoice_2_Peppol_BIS_3(self):
|
||||
"Test Invoice-2"
|
||||
pool = Pool()
|
||||
Template = pool.get('edocument.ubl.invoice')
|
||||
InvoiceReport = pool.get('account.invoice', type='report')
|
||||
with patch.object(InvoiceReport, 'execute') as execute:
|
||||
execute.return_value = ['pdf', b'data', False, 'Invoice-1234']
|
||||
invoice = get_invoice()
|
||||
template = Template(invoice)
|
||||
|
||||
invoice_string = template.render('2', specification='peppol-bis-3')
|
||||
invoice_xml = etree.fromstring(invoice_string)
|
||||
schema_file = os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
'2.4', 'maindoc', 'UBL-Invoice-2.4.xsd')
|
||||
schema = etree.XMLSchema(etree.parse(schema_file))
|
||||
schema.assertValid(invoice_xml)
|
||||
|
||||
@with_transaction()
|
||||
def test_CreditNote_2(self):
|
||||
"Test CreditNote-2"
|
||||
pool = Pool()
|
||||
Template = pool.get('edocument.ubl.invoice')
|
||||
InvoiceReport = pool.get('account.invoice', type='report')
|
||||
with patch.object(InvoiceReport, 'execute') as execute:
|
||||
execute.return_value = ['pdf', b'data', False, 'Invoice-1234']
|
||||
invoice = get_invoice()
|
||||
invoice.sequence_type = 'credit_note'
|
||||
for line in invoice.lines:
|
||||
line.quantity *= -1
|
||||
invoice.untaxed_amount *= -1
|
||||
invoice.tax_amount *= -1
|
||||
invoice.total_amount *= -1
|
||||
invoice.amount_to_pay *= -1
|
||||
for line in invoice.lines_to_pay:
|
||||
line.amount *= -1
|
||||
template = Template(invoice)
|
||||
|
||||
invoice_string = template.render('2')
|
||||
invoice_xml = etree.fromstring(invoice_string)
|
||||
schema_file = os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
'2.4', 'maindoc', 'UBL-CreditNote-2.4.xsd')
|
||||
schema = etree.XMLSchema(etree.parse(schema_file))
|
||||
schema.assertValid(invoice_xml)
|
||||
|
||||
@with_transaction()
|
||||
def test_CreditNote_2_Peppol_BIS_3(self):
|
||||
"Test CreditNote-2"
|
||||
pool = Pool()
|
||||
Template = pool.get('edocument.ubl.invoice')
|
||||
InvoiceReport = pool.get('account.invoice', type='report')
|
||||
with patch.object(InvoiceReport, 'execute') as execute:
|
||||
execute.return_value = ['pdf', b'data', False, 'Invoice-1234']
|
||||
invoice = get_invoice()
|
||||
invoice.sequence_type = 'credit_note'
|
||||
for line in invoice.lines:
|
||||
line.quantity *= -1
|
||||
invoice.untaxed_amount *= -1
|
||||
invoice.tax_amount *= -1
|
||||
invoice.total_amount *= -1
|
||||
invoice.amount_to_pay *= -1
|
||||
for line in invoice.lines_to_pay:
|
||||
line.amount *= -1
|
||||
template = Template(invoice)
|
||||
|
||||
invoice_string = template.render('2', specification='peppol-bis-3')
|
||||
invoice_xml = etree.fromstring(invoice_string)
|
||||
schema_file = os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
'2.4', 'maindoc', 'UBL-CreditNote-2.4.xsd')
|
||||
schema = etree.XMLSchema(etree.parse(schema_file))
|
||||
schema.assertValid(invoice_xml)
|
||||
|
||||
@with_transaction()
|
||||
def test_identifier_eas(self):
|
||||
"Test EAS identifier"
|
||||
pool = Pool()
|
||||
Identifier = pool.get('party.identifier')
|
||||
|
||||
for type, code, eas_code, eas, vatin in [
|
||||
('gr_vat', '023456783',
|
||||
'9933', 'el023456783', 'EL023456783'),
|
||||
('eu_vat', 'EL023456783',
|
||||
'9933', 'el023456783', 'EL023456783'),
|
||||
('eu_vat', 'GR023456783',
|
||||
'9933', 'el023456783', 'EL023456783'),
|
||||
('be_vat', '0403019261',
|
||||
'9925', 'be0403019261', 'BE0403019261'),
|
||||
('eu_vat', 'BE0403019261',
|
||||
'9925', 'be0403019261', 'BE0403019261'),
|
||||
('gb_vat', '980780684',
|
||||
'9932', 'gb980780684', 'GB980780684'),
|
||||
('eu_vat', 'GB980780684',
|
||||
'9932', 'gb980780684', 'GB980780684'),
|
||||
('eu_vat', 'XI980780684',
|
||||
'9932', 'gb980780684', 'GB980780684'),
|
||||
]:
|
||||
with self.subTest(type=type, code=code):
|
||||
identifier = Identifier(type=type, code=code)
|
||||
|
||||
self.assertEqual(identifier.eas_code, eas_code)
|
||||
self.assertEqual(identifier.eas, eas)
|
||||
self.assertEqual(identifier.vatin, vatin)
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
8
modules/edocument_ubl/tests/test_scenario.py
Normal file
8
modules/edocument_ubl/tests/test_scenario.py
Normal file
@@ -0,0 +1,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.
|
||||
|
||||
from trytond.tests.test_tryton import load_doc_tests
|
||||
|
||||
|
||||
def load_tests(*args, **kwargs):
|
||||
return load_doc_tests(__name__, __file__, *args, **kwargs)
|
||||
Reference in New Issue
Block a user