add test
This commit is contained in:
parent
bb5d5d27ff
commit
d861c9a6ff
2 changed files with 166 additions and 0 deletions
114
tests/facturx-extended.xml
Normal file
114
tests/facturx-extended.xml
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<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>RE2024.01234</ram:ID>
|
||||||
|
<ram:TypeCode>380</ram:TypeCode>
|
||||||
|
<ram:IssueDateTime>
|
||||||
|
<udt:DateTimeString format="102">20240617</udt:DateTimeString>
|
||||||
|
</ram:IssueDateTime>
|
||||||
|
<ram:IncludedNote>
|
||||||
|
<ram:Content>Some notes to the customer.</ram:Content>
|
||||||
|
</ram:IncludedNote>
|
||||||
|
</rsm:ExchangedDocument>
|
||||||
|
<rsm:SupplyChainTradeTransaction>
|
||||||
|
<ram:IncludedSupplyChainTradeLineItem>
|
||||||
|
<ram:AssociatedDocumentLineDocument>
|
||||||
|
<ram:LineID>1</ram:LineID>
|
||||||
|
</ram:AssociatedDocumentLineDocument>
|
||||||
|
<ram:SpecifiedTradeProduct>
|
||||||
|
<ram:Name>Name of Product 1</ram:Name>
|
||||||
|
<ram:Description>Description of Product 1</ram:Description>
|
||||||
|
</ram:SpecifiedTradeProduct>
|
||||||
|
<ram:SpecifiedLineTradeAgreement>
|
||||||
|
<ram:NetPriceProductTradePrice>
|
||||||
|
<ram:ChargeAmount currencyID="EUR">1350.00</ram:ChargeAmount>
|
||||||
|
</ram:NetPriceProductTradePrice>
|
||||||
|
</ram:SpecifiedLineTradeAgreement>
|
||||||
|
<ram:SpecifiedLineTradeDelivery>
|
||||||
|
<ram:BilledQuantity unitCode="C62">1.0</ram:BilledQuantity>
|
||||||
|
</ram:SpecifiedLineTradeDelivery>
|
||||||
|
<ram:SpecifiedLineTradeSettlement>
|
||||||
|
<ram:ApplicableTradeTax>
|
||||||
|
<ram:TypeCode>VAT</ram:TypeCode>
|
||||||
|
<ram:CategoryCode>S</ram:CategoryCode>
|
||||||
|
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
|
||||||
|
</ram:ApplicableTradeTax>
|
||||||
|
<ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||||
|
<ram:LineTotalAmount currencyID="EUR">1350.00</ram:LineTotalAmount>
|
||||||
|
</ram:SpecifiedTradeSettlementLineMonetarySummation>
|
||||||
|
</ram:SpecifiedLineTradeSettlement>
|
||||||
|
</ram:IncludedSupplyChainTradeLineItem>
|
||||||
|
<ram:ApplicableHeaderTradeAgreement>
|
||||||
|
<ram:SellerTradeParty>
|
||||||
|
<ram:Name>Name of the Comany</ram:Name>
|
||||||
|
<ram:SpecifiedLegalOrganization>
|
||||||
|
</ram:SpecifiedLegalOrganization>
|
||||||
|
<ram:PostalTradeAddress>
|
||||||
|
<ram:PostcodeCode>12345</ram:PostcodeCode>
|
||||||
|
<ram:LineOne>Street of Company No 1</ram:LineOne>
|
||||||
|
<ram:CityName>Berlin</ram:CityName>
|
||||||
|
<ram:CountryID>DE</ram:CountryID>
|
||||||
|
<ram:CountrySubDivisionName>Berlin</ram:CountrySubDivisionName>
|
||||||
|
</ram:PostalTradeAddress>
|
||||||
|
</ram:SellerTradeParty>
|
||||||
|
<ram:BuyerTradeParty>
|
||||||
|
<ram:Name>Customer Company</ram:Name>
|
||||||
|
<ram:SpecifiedLegalOrganization>
|
||||||
|
</ram:SpecifiedLegalOrganization>
|
||||||
|
<ram:PostalTradeAddress>
|
||||||
|
<ram:PostcodeCode>23456</ram:PostcodeCode>
|
||||||
|
<ram:LineOne>Address Line 1</ram:LineOne>
|
||||||
|
<ram:LineTwo>Address Line 2</ram:LineTwo>
|
||||||
|
<ram:CityName>Potsdam</ram:CityName>
|
||||||
|
<ram:CountryID>DE</ram:CountryID>
|
||||||
|
<ram:CountrySubDivisionName>Brandenburg</ram:CountrySubDivisionName>
|
||||||
|
</ram:PostalTradeAddress>
|
||||||
|
</ram:BuyerTradeParty>
|
||||||
|
<ram:BuyerOrderReferencedDocument>
|
||||||
|
<ram:IssuerAssignedID/>
|
||||||
|
</ram:BuyerOrderReferencedDocument>
|
||||||
|
</ram:ApplicableHeaderTradeAgreement>
|
||||||
|
<ram:ApplicableHeaderTradeDelivery>
|
||||||
|
</ram:ApplicableHeaderTradeDelivery>
|
||||||
|
<ram:ApplicableHeaderTradeSettlement>
|
||||||
|
<ram:PaymentReference>RE2024.01234</ram:PaymentReference>
|
||||||
|
<ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
|
||||||
|
<ram:SpecifiedTradeSettlementPaymentMeans>
|
||||||
|
<ram:TypeCode>30</ram:TypeCode>
|
||||||
|
<ram:Information>Wire transfer</ram:Information>
|
||||||
|
<ram:PayeePartyCreditorFinancialAccount>
|
||||||
|
<ram:IBANID>DE02300209000106531065</ram:IBANID>
|
||||||
|
<ram:AccountName>mbs</ram:AccountName>
|
||||||
|
</ram:PayeePartyCreditorFinancialAccount>
|
||||||
|
<ram:PayeeSpecifiedCreditorFinancialInstitution>
|
||||||
|
<ram:BICID>WELADED1PMB</ram:BICID>
|
||||||
|
</ram:PayeeSpecifiedCreditorFinancialInstitution>
|
||||||
|
</ram:SpecifiedTradeSettlementPaymentMeans>
|
||||||
|
<ram:ApplicableTradeTax>
|
||||||
|
<ram:CalculatedAmount currencyID="EUR">256.5</ram:CalculatedAmount>
|
||||||
|
<ram:TypeCode>VAT</ram:TypeCode>
|
||||||
|
<ram:BasisAmount>1350</ram:BasisAmount>
|
||||||
|
<ram:CategoryCode>S</ram:CategoryCode>
|
||||||
|
<ram:RateApplicablePercent>19.00</ram:RateApplicablePercent>
|
||||||
|
</ram:ApplicableTradeTax>
|
||||||
|
<ram:SpecifiedTradePaymentTerms>
|
||||||
|
<ram:DueDateDateTime>
|
||||||
|
<udt:DateTimeString format="102">20240701</udt:DateTimeString>
|
||||||
|
</ram:DueDateDateTime>
|
||||||
|
<ram:PartialPaymentAmount currencyID="EUR">1606.50</ram:PartialPaymentAmount>
|
||||||
|
</ram:SpecifiedTradePaymentTerms>
|
||||||
|
<ram:SpecifiedTradeSettlementHeaderMonetarySummation>
|
||||||
|
<ram:LineTotalAmount currencyID="EUR">1350.00</ram:LineTotalAmount>
|
||||||
|
<ram:TaxBasisTotalAmount currencyID="EUR">1350.00</ram:TaxBasisTotalAmount>
|
||||||
|
<ram:TaxTotalAmount currencyID="EUR">256.5</ram:TaxTotalAmount>
|
||||||
|
<ram:GrandTotalAmount currencyID="EUR">1606.50</ram:GrandTotalAmount>
|
||||||
|
<ram:DuePayableAmount currencyID="EUR">1606.50</ram:DuePayableAmount>
|
||||||
|
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
|
||||||
|
</ram:ApplicableHeaderTradeSettlement>
|
||||||
|
</rsm:SupplyChainTradeTransaction>
|
||||||
|
</rsm:CrossIndustryInvoice>
|
|
@ -3,6 +3,7 @@
|
||||||
# from m-ds for Tryton. The COPYRIGHT file at the top level of
|
# from m-ds for Tryton. The COPYRIGHT file at the top level of
|
||||||
# this repository contains the full copyright notices and license terms.
|
# this repository contains the full copyright notices and license terms.
|
||||||
|
|
||||||
|
import os.path
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from facturx import get_facturx_xml_from_pdf
|
from facturx import get_facturx_xml_from_pdf
|
||||||
|
@ -109,6 +110,57 @@ class InvoiceTestCase(ModuleTestCase):
|
||||||
self.assertEqual(len(inv_lst.move.lines), 3)
|
self.assertEqual(len(inv_lst.move.lines), 3)
|
||||||
return inv_lst
|
return inv_lst
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_wiz_import_single_xml(self):
|
||||||
|
""" run import wizard, upload a single file
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
ImportWiz = pool.get(
|
||||||
|
'account_invoice_xrechnung.import', type='wizard')
|
||||||
|
|
||||||
|
company1 = create_company('m-ds')
|
||||||
|
with Transaction().set_context({
|
||||||
|
'company': company1.id,
|
||||||
|
'active_model': 'party.party'}):
|
||||||
|
(sess_id, start_state, end_state) = ImportWiz.create()
|
||||||
|
w_obj = ImportWiz(sess_id)
|
||||||
|
self.assertEqual(start_state, 'start')
|
||||||
|
self.assertEqual(end_state, 'end')
|
||||||
|
|
||||||
|
# run start
|
||||||
|
result = ImportWiz.execute(sess_id, {}, start_state)
|
||||||
|
self.assertEqual(list(result.keys()), ['view'])
|
||||||
|
|
||||||
|
step_values = {
|
||||||
|
x: result['view']['defaults'][x]
|
||||||
|
for x in result['view']['defaults'].keys()
|
||||||
|
if '.' not in x}
|
||||||
|
|
||||||
|
self.assertEqual(step_values, {
|
||||||
|
'company': company1.id,
|
||||||
|
'invoice_type': 'in',
|
||||||
|
'file_': None})
|
||||||
|
|
||||||
|
# step 1: upload xml-file
|
||||||
|
with open(os.path.join(
|
||||||
|
os.path.split(__file__)[0],
|
||||||
|
'facturx-extended.xml'), 'rb') as fhdl:
|
||||||
|
step_values['file_'] = fhdl.read()
|
||||||
|
for i in step_values.keys():
|
||||||
|
setattr(w_obj.start, i, step_values[i])
|
||||||
|
|
||||||
|
result = ImportWiz.execute(
|
||||||
|
sess_id, {start_state: step_values}, 'doupload')
|
||||||
|
|
||||||
|
step_values = {
|
||||||
|
x: result['view']['defaults'][x]
|
||||||
|
for x in result['view']['defaults'].keys()
|
||||||
|
if '.' not in x}
|
||||||
|
|
||||||
|
self.assertEqual(step_values, {
|
||||||
|
'company': company1.id,
|
||||||
|
'invoice_type': 'in'})
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_xrechnung_configuration(self):
|
def test_xrechnung_configuration(self):
|
||||||
""" test configuration
|
""" test configuration
|
||||||
|
|
Loading…
Reference in a new issue