Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up XML template files #23

Merged
merged 6 commits into from
Jun 7, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions facturx/facturx.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ def __getitem__(self, field_name):
value = datetime.strptime(value, '%Y%m%d')
return value


def __setitem__(self, field_name, value):
path = self.flavor._get_xml_path(field_name)
res = self.xml.xpath(path, namespaces=self._namespaces)
Expand All @@ -129,7 +128,6 @@ def is_valid(self):
"""
pass


def write_pdf(self, path):
pdfwriter = FacturXPDFWriter(self)
with open(path, 'wb') as output_f:
Expand Down
136 changes: 60 additions & 76 deletions facturx/flavors/factur-x/xml/basic.xml
Original file line number Diff line number Diff line change
@@ -1,165 +1,149 @@
<rsm:CrossIndustryInvoice xmlns:qdt="urn:un:unece:uncefact:data:standard:QualifiedDataType:100" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<rsm:ExchangedDocumentContext>
<ram:BusinessProcessSpecifiedDocumentContextParameter>
<ram:ID>A1</ram:ID>
<ram:ID></ram:ID>
</ram:BusinessProcessSpecifiedDocumentContextParameter>
<ram:GuidelineSpecifiedDocumentContextParameter>
<ram:ID>urn:factur-x.eu:1p0:basic</ram:ID>
</ram:GuidelineSpecifiedDocumentContextParameter>
</rsm:ExchangedDocumentContext>
<rsm:ExchangedDocument>
<ram:ID>2017-TEST-04</ram:ID>
<ram:ID></ram:ID>
<ram:TypeCode>380</ram:TypeCode>
<ram:IssueDateTime>
<udt:DateTimeString format="102">20171031</udt:DateTimeString>
<udt:DateTimeString format=""></udt:DateTimeString>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to keep the default time format. Else we need to code support for different formats which isn't practical.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should I leave all the attributes as is?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave all the time formats. format="102". Else we need to take care of time formatting in many places.

</ram:IssueDateTime>
<ram:IncludedNote>
<ram:Content>FOURNISSEUR F SARL au capital de 50 000 EUR</ram:Content>
<ram:SubjectCode>REG</ram:SubjectCode>
</ram:IncludedNote>
<ram:IncludedNote>
<ram:Content>RCS NANTERRE 999 888 777</ram:Content>
<ram:SubjectCode>ABL</ram:SubjectCode>
</ram:IncludedNote>
<ram:IncludedNote>
<ram:Content>Taux de pénalités de retard de paiement égal au taux de refinancement de la Banque Centrale Européenne majorée de 10 points de pourcentage</ram:Content>
<ram:SubjectCode>PMD</ram:SubjectCode>
</ram:IncludedNote>
<ram:IncludedNote>
<ram:Content>Retard de paiement: Indemnité forfaitaire pour frais de recouvrement de 40 Euros</ram:Content>
<ram:SubjectCode>PMT</ram:SubjectCode>
</ram:IncludedNote>
<ram:IncludedNote>
<ram:Content>Aucun escompte en cas de paiement anticipé</ram:Content>
<ram:SubjectCode>AAB</ram:SubjectCode>
<ram:Content></ram:Content>
<ram:SubjectCode></ram:SubjectCode>
</ram:IncludedNote>
</rsm:ExchangedDocument>
<rsm:SupplyChainTradeTransaction>
<ram:IncludedSupplyChainTradeLineItem>
<ram:AssociatedDocumentLineDocument>
<ram:LineID>1</ram:LineID>
<ram:LineID></ram:LineID>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:GlobalID schemeID="0160">1234567890123</ram:GlobalID>
<ram:Name>PRODUIT 1</ram:Name>
<ram:GlobalID schemeID=""></ram:GlobalID>
<ram:Name></ram:Name>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
<ram:NetPriceProductTradePrice>
<ram:ChargeAmount currencyID="EUR">91.00</ram:ChargeAmount>
<ram:ChargeAmount currencyID="EUR">0</ram:ChargeAmount>
</ram:NetPriceProductTradePrice>
</ram:SpecifiedLineTradeAgreement>
<ram:SpecifiedLineTradeDelivery>
<ram:BilledQuantity unitCode="PCE">181</ram:BilledQuantity>
<ram:BilledQuantity unitCode="">0</ram:BilledQuantity>
</ram:SpecifiedLineTradeDelivery>
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:RateApplicablePercent>20</ram:RateApplicablePercent>
<ram:TypeCode></ram:TypeCode>
<ram:CategoryCode></ram:CategoryCode>
<ram:RateApplicablePercent>0</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeSettlementLineMonetarySummation>
<ram:LineTotalAmount currencyID="EUR">16471.00</ram:LineTotalAmount>
<ram:LineTotalAmount currencyID="EUR">0</ram:LineTotalAmount>
</ram:SpecifiedTradeSettlementLineMonetarySummation>
</ram:SpecifiedLineTradeSettlement>
</ram:IncludedSupplyChainTradeLineItem>
<ram:ApplicableHeaderTradeAgreement>
<ram:BuyerReference>CodeSERVICE A</ram:BuyerReference>
<ram:BuyerReference></ram:BuyerReference>
<ram:SellerTradeParty>
<ram:ID schemeID="0002">99988877900017</ram:ID>
<ram:GlobalID schemeID="0002">99988877900017</ram:GlobalID>
<ram:Name>FOURNISSEUR F</ram:Name>
<ram:ID schemeID="">0</ram:ID>
<ram:GlobalID schemeID="">0</ram:GlobalID>
<ram:Name></ram:Name>
<ram:SpecifiedLegalOrganization>
<ram:ID schemeID="0002">99988877900017</ram:ID>
<ram:ID schemeID=""></ram:ID>
</ram:SpecifiedLegalOrganization>
<ram:PostalTradeAddress>
<ram:PostcodeCode>92120</ram:PostcodeCode>
<ram:LineOne>25 rue du Fournisseur</ram:LineOne>
<ram:CityName>MONTROUGE</ram:CityName>
<ram:CountryID>FR</ram:CountryID>
<ram:PostcodeCode></ram:PostcodeCode>
<ram:LineOne></ram:LineOne>
<ram:CityName></ram:CityName>
<ram:CountryID></ram:CountryID>
</ram:PostalTradeAddress>
<ram:URIUniversalCommunication>
<ram:URIID schemeID="SMTP">[email protected]</ram:URIID>
<ram:URIID schemeID=""></ram:URIID>
</ram:URIUniversalCommunication>
<ram:SpecifiedTaxRegistration>
<ram:ID schemeID="VA">FR34999888779</ram:ID>
<ram:ID schemeID=""></ram:ID>
</ram:SpecifiedTaxRegistration>
</ram:SellerTradeParty>
<ram:BuyerTradeParty>
<ram:ID schemeID="0002">77788899100018</ram:ID>
<ram:Name>CLIENT 1</ram:Name>
<ram:ID schemeID=""></ram:ID>
<ram:Name></ram:Name>
<ram:SpecifiedLegalOrganization>
<ram:ID schemeID="0002">77788899100018</ram:ID>
<ram:ID schemeID=""></ram:ID>
</ram:SpecifiedLegalOrganization>
<ram:PostalTradeAddress>
<ram:PostcodeCode>75015</ram:PostcodeCode>
<ram:LineOne>1 rue du Client</ram:LineOne>
<ram:CityName>PARIS</ram:CityName>
<ram:CountryID>FR</ram:CountryID>
<ram:PostcodeCode></ram:PostcodeCode>
<ram:LineOne></ram:LineOne>
<ram:CityName></ram:CityName>
<ram:CountryID></ram:CountryID>
</ram:PostalTradeAddress>
<ram:SpecifiedTaxRegistration>
<ram:ID schemeID="VA">FR51777888991</ram:ID>
<ram:ID schemeID=""></ram:ID>
</ram:SpecifiedTaxRegistration>
</ram:BuyerTradeParty>
<ram:BuyerOrderReferencedDocument>
<ram:IssuerAssignedID>CDE234</ram:IssuerAssignedID>
<ram:IssuerAssignedID></ram:IssuerAssignedID>
</ram:BuyerOrderReferencedDocument>
<ram:ContractReferencedDocument>
<ram:IssuerAssignedID>CT12345</ram:IssuerAssignedID>
<ram:IssuerAssignedID></ram:IssuerAssignedID>
</ram:ContractReferencedDocument>
</ram:ApplicableHeaderTradeAgreement>
<ram:ApplicableHeaderTradeDelivery>
<ram:ActualDeliverySupplyChainEvent>
<ram:OccurrenceDateTime>
<udt:DateTimeString format="102">20171023</udt:DateTimeString>
<udt:DateTimeString format=""></udt:DateTimeString>
</ram:OccurrenceDateTime>
</ram:ActualDeliverySupplyChainEvent>
<ram:DespatchAdviceReferencedDocument>
<ram:IssuerAssignedID>BL45</ram:IssuerAssignedID>
<ram:IssuerAssignedID></ram:IssuerAssignedID>
</ram:DespatchAdviceReferencedDocument>
</ram:ApplicableHeaderTradeDelivery>
<ram:ApplicableHeaderTradeSettlement>
<ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
<ram:SpecifiedTradeSettlementPaymentMeans>
<ram:TypeCode>42</ram:TypeCode>
<ram:TypeCode></ram:TypeCode>
<ram:PayeePartyCreditorFinancialAccount>
<ram:IBANID>FR99 3122 1234 0000 9999 1234 008</ram:IBANID>
<ram:IBANID></ram:IBANID>
</ram:PayeePartyCreditorFinancialAccount>
</ram:SpecifiedTradeSettlementPaymentMeans>
<ram:ApplicableTradeTax>
<ram:CalculatedAmount currencyID="EUR">3195.37</ram:CalculatedAmount>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:BasisAmount currencyID="EUR">15976.87</ram:BasisAmount>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:DueDateTypeCode>5</ram:DueDateTypeCode>
<ram:RateApplicablePercent>20</ram:RateApplicablePercent>
<ram:CalculatedAmount currencyID="EUR">0</ram:CalculatedAmount>
<ram:TypeCode></ram:TypeCode>
<ram:BasisAmount currencyID="EUR">0</ram:BasisAmount>
<ram:CategoryCode></ram:CategoryCode>
<ram:DueDateTypeCode></ram:DueDateTypeCode>
<ram:RateApplicablePercent>0</ram:RateApplicablePercent>
</ram:ApplicableTradeTax>
<ram:SpecifiedTradeAllowanceCharge>
<ram:ChargeIndicator>
<udt:Indicator>false</udt:Indicator>
</ram:ChargeIndicator>
<ram:CalculationPercent>3.00</ram:CalculationPercent>
<ram:BasisAmount currencyID="EUR">16471.00</ram:BasisAmount>
<ram:ActualAmount currencyID="EUR">494.13</ram:ActualAmount>
<ram:Reason>Remise négociation commerciale</ram:Reason>
<ram:CalculationPercent>0</ram:CalculationPercent>
<ram:BasisAmount currencyID="EUR">0</ram:BasisAmount>
<ram:ActualAmount currencyID="EUR">0</ram:ActualAmount>
<ram:Reason></ram:Reason>
<ram:CategoryTradeTax>
<ram:TypeCode>VAT</ram:TypeCode>
<ram:CategoryCode>S</ram:CategoryCode>
<ram:DueDateTypeCode>5</ram:DueDateTypeCode>
<ram:RateApplicablePercent>20</ram:RateApplicablePercent>
<ram:TypeCode></ram:TypeCode>
<ram:CategoryCode></ram:CategoryCode>
<ram:DueDateTypeCode></ram:DueDateTypeCode>
<ram:RateApplicablePercent>0</ram:RateApplicablePercent>
</ram:CategoryTradeTax>
</ram:SpecifiedTradeAllowanceCharge>
<ram:SpecifiedTradePaymentTerms>
<ram:DueDateDateTime>
<udt:DateTimeString format="102">20171130</udt:DateTimeString>
<udt:DateTimeString format=""></udt:DateTimeString>
</ram:DueDateDateTime>
</ram:SpecifiedTradePaymentTerms>
<ram:SpecifiedTradeSettlementHeaderMonetarySummation>
<ram:LineTotalAmount currencyID="EUR">16471.00</ram:LineTotalAmount>
<ram:AllowanceTotalAmount currencyID="EUR">494.13</ram:AllowanceTotalAmount>
<ram:TaxBasisTotalAmount currencyID="EUR">15976.87</ram:TaxBasisTotalAmount>
<ram:TaxTotalAmount currencyID="EUR">3195.37</ram:TaxTotalAmount>
<ram:GrandTotalAmount currencyID="EUR">19172.24</ram:GrandTotalAmount>
<ram:DuePayableAmount currencyID="EUR">19172.24</ram:DuePayableAmount>
<ram:LineTotalAmount currencyID="EUR">0</ram:LineTotalAmount>
<ram:AllowanceTotalAmount currencyID="EUR">0</ram:AllowanceTotalAmount>
<ram:TaxBasisTotalAmount currencyID="EUR">0</ram:TaxBasisTotalAmount>
<ram:TaxTotalAmount currencyID="EUR">0</ram:TaxTotalAmount>
<ram:GrandTotalAmount currencyID="EUR">0</ram:GrandTotalAmount>
<ram:DuePayableAmount currencyID="EUR">0</ram:DuePayableAmount>
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
</ram:ApplicableHeaderTradeSettlement>
</rsm:SupplyChainTradeTransaction>
Expand Down
Loading