Closed duskybomb closed 6 years ago
What should we do about this?
I see you implemented a function to remove existing XML data from sample files. I don't think this is transparent enough since I can't easily look at the empty XML files and validate they are empty.
It would be better to split the current XML files into 2 folders. One for samples (to view and develop with) and one for empty templates.
factur-x/facturx/flavors/[zugferd|facturx|ubl]/xml/
(has empty XML templates)factur-x/facturx/flavors/[zugferd|facturx|ubl]/xml/samples
(has current sample files)Okay, so this way we don't need to create any function and can just copy empty XML templates.
Yes. I think this is the most transparent solution. So we can just look at the empty XML and validate it. In the accounting industry, no mistake can happen. Like forgetting to remove some old value from an XML template. That's what I meant from the start. From the way you implemented it, I see now that I wasn't clear enough on the implementation step.
Like this?
<?xml version="1.0" encoding="UTF-8"?>
<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/>
</ram:BusinessProcessSpecifiedDocumentContextParameter>
<ram:GuidelineSpecifiedDocumentContextParameter>
<ram:ID/>
</ram:GuidelineSpecifiedDocumentContextParameter>
</rsm:ExchangedDocumentContext>
<rsm:ExchangedDocument>
<ram:ID/>
<ram:TypeCode>0</ram:TypeCode>
<ram:IssueDateTime>
<udt:DateTimeString format="102">00000000</udt:DateTimeString>
</ram:IssueDateTime>
</rsm:ExchangedDocument>
<rsm:SupplyChainTradeTransaction>
<ram:ApplicableHeaderTradeAgreement>
<ram:BuyerReference/>
<ram:SellerTradeParty>
<ram:Name/>
<ram:SpecifiedLegalOrganization>
<ram:ID schemeID="0002">0</ram:ID>
</ram:SpecifiedLegalOrganization>
<ram:PostalTradeAddress>
<ram:CountryID/>
</ram:PostalTradeAddress>
<ram:SpecifiedTaxRegistration>
<ram:ID schemeID="VA"/>
</ram:SpecifiedTaxRegistration>
</ram:SellerTradeParty>
<ram:BuyerTradeParty>
<ram:Name/>
<ram:SpecifiedLegalOrganization>
<ram:ID schemeID="0002">0</ram:ID>
</ram:SpecifiedLegalOrganization>
</ram:BuyerTradeParty>
<ram:BuyerOrderReferencedDocument>
<ram:IssuerAssignedID/>
</ram:BuyerOrderReferencedDocument>
</ram:ApplicableHeaderTradeAgreement>
<ram:ApplicableHeaderTradeDelivery/>
<ram:ApplicableHeaderTradeSettlement>
<ram:InvoiceCurrencyCode/>
<ram:SpecifiedTradeSettlementHeaderMonetarySummation>
<ram:TaxBasisTotalAmount currencyID="">0.0</ram:TaxBasisTotalAmount>
<ram:TaxTotalAmount currencyID="">0.0</ram:TaxTotalAmount>
<ram:GrandTotalAmount currencyID="">0.0</ram:GrandTotalAmount>
<ram:DuePayableAmount currencyID="">0.0</ram:DuePayableAmount>
</ram:SpecifiedTradeSettlementHeaderMonetarySummation>
</ram:ApplicableHeaderTradeSettlement>
</rsm:SupplyChainTradeTransaction>
</rsm:CrossIndustryInvoice>
I haven't tested all but minimum.xml
. And it works just fine.
Please provide a minimal example that I can run to see that the empty XML templates can be filled again. Can post it here as comment.
You can try this to check:
from facturx import *
factx = FacturX('invoice.pdf') # where invoice.pdf doesn't contain any embedded metadata
factx['seller'] = 'Manu'
Still need major changes before merging. See comments and
Can you provide me some resource from where I can understand the XML document?
The XML represents an invoice. You can look at the sample invoice PDF content and see how they relate to the XML. Then try again.
Here are the things I have gathered till know:
pdfwriter.py
seller
invoice_number
date
doc_type
_required
fields. And as most of the fields needs to be changed manually we should use <tag></tag>
instead of <tag/>
for empty tags.BusinessProcessSpecifiedDocumentContextParameter
is something that is not related to invoice and maybe useless or can have a default value.GuidelineSpecifiedDocumentContextParameter/ID
needs to have a default value for every level. Like for minimum it is urn:factur-x.eu:1p0:minimum
I don't know what you mean with your last comment. The stuff you write about the "only four fields can be changed" is simply not true. Maybe you want to check again.
It seems you are mixing up the module for creating the PDF with the module responsible for the XML document. That's totally unrelated...
It seems like you didn't adjust the code to use the new empty templates you created. That would be here.
I don't think there is any need to adjust the code, because the old templates are moved to sample
and the new empty templates have been added in-place of older ones.
Let's discuss it here. Issue #22
write_xml()
write_pdf
because some fields are conflicting. Example I have replace date data with '0' but white printing it cannot convert it to date format.