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

Conversation

Projects
None yet
2 participants
@duskybomb
Collaborator

duskybomb commented May 26, 2018

Let's discuss it here.
Issue #22

  • It is validating against XML schema and passes.
  • able to print xml using write_xml()
  • unable to print pdf using 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.
@duskybomb

This comment has been minimized.

Show comment
Hide comment
@duskybomb

duskybomb May 27, 2018

Collaborator

What should we do about this?

Collaborator

duskybomb commented May 27, 2018

What should we do about this?

@m3nu

This comment has been minimized.

Show comment
Hide comment
@m3nu

m3nu May 27, 2018

Collaborator

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)
Collaborator

m3nu commented May 27, 2018

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)
@duskybomb

This comment has been minimized.

Show comment
Hide comment
@duskybomb

duskybomb May 27, 2018

Collaborator

Okay, so this way we don't need to create any function and can just copy empty XML templates.

Collaborator

duskybomb commented May 27, 2018

Okay, so this way we don't need to create any function and can just copy empty XML templates.

@m3nu

This comment has been minimized.

Show comment
Hide comment
@m3nu

m3nu May 27, 2018

Collaborator

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.

Collaborator

m3nu commented May 27, 2018

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.

@duskybomb

This comment has been minimized.

Show comment
Hide comment
@duskybomb

duskybomb May 27, 2018

Collaborator

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>
Collaborator

duskybomb commented May 27, 2018

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>
@duskybomb

This comment has been minimized.

Show comment
Hide comment
@duskybomb

duskybomb May 28, 2018

Collaborator

I haven't tested all but minimum.xml. And it works just fine.

Collaborator

duskybomb commented May 28, 2018

I haven't tested all but minimum.xml. And it works just fine.

@duskybomb duskybomb changed the title from First commit to clean up XML template files to Clean up XML template files May 29, 2018

@m3nu

This comment has been minimized.

Show comment
Hide comment
@m3nu

m3nu Jun 2, 2018

Collaborator

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.

Collaborator

m3nu commented Jun 2, 2018

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.

@m3nu m3nu closed this Jun 2, 2018

@m3nu m3nu reopened this Jun 2, 2018

@duskybomb

This comment has been minimized.

Show comment
Hide comment
@duskybomb

duskybomb Jun 2, 2018

Collaborator

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'
Collaborator

duskybomb commented Jun 2, 2018

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'
@m3nu

This comment has been minimized.

Show comment
Hide comment
@m3nu

m3nu Jun 3, 2018

Collaborator

Still need major changes before merging. See comments and

  • you didn't show a full understanding of the XML document. So you are not sure how to clean it up. Having a better understanding of the document will be helpful for you.
  • After you empty fields, you need to see if a) we have them covered as editable fields, b) they are useless, c) they could have a default value that never changes.
Collaborator

m3nu commented Jun 3, 2018

Still need major changes before merging. See comments and

  • you didn't show a full understanding of the XML document. So you are not sure how to clean it up. Having a better understanding of the document will be helpful for you.
  • After you empty fields, you need to see if a) we have them covered as editable fields, b) they are useless, c) they could have a default value that never changes.
@duskybomb

This comment has been minimized.

Show comment
Hide comment
@duskybomb

duskybomb Jun 3, 2018

Collaborator

Can you provide me some resource from where I can understand the XML document?

Collaborator

duskybomb commented Jun 3, 2018

Can you provide me some resource from where I can understand the XML document?

@m3nu

This comment has been minimized.

Show comment
Hide comment
@m3nu

m3nu Jun 3, 2018

Collaborator

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.

Collaborator

m3nu commented Jun 3, 2018

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.

@duskybomb

This comment has been minimized.

Show comment
Hide comment
@duskybomb

duskybomb Jun 5, 2018

Collaborator

Here are the things I have gathered till know:

  • Only four fields can be changed using pdfwriter.py
    • seller
    • invoice_number
    • date
    • doc_type
  • Since only four fields can be changed using python, we can extend it to at least change _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
Collaborator

duskybomb commented Jun 5, 2018

Here are the things I have gathered till know:

  • Only four fields can be changed using pdfwriter.py
    • seller
    • invoice_number
    • date
    • doc_type
  • Since only four fields can be changed using python, we can extend it to at least change _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
@m3nu

This comment has been minimized.

Show comment
Hide comment
@m3nu

m3nu Jun 5, 2018

Collaborator

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.

Collaborator

m3nu commented Jun 5, 2018

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.

@m3nu

This comment has been minimized.

Show comment
Hide comment
@m3nu

m3nu Jun 5, 2018

Collaborator

It seems you are mixing up the module for creating the PDF with the module responsible for the XML document. That's totally unrelated...

Collaborator

m3nu commented Jun 5, 2018

It seems you are mixing up the module for creating the PDF with the module responsible for the XML document. That's totally unrelated...

Cleaned Files after review
 * Assigning a placeholder if some restriction is there in XSD
 * Or if it contains default value
 * All the templates have been successfully validated against XSD
@m3nu

This comment has been minimized.

Show comment
Hide comment
@m3nu

m3nu Jun 7, 2018

Collaborator

It seems like you didn't adjust the code to use the new empty templates you created. That would be here.

Collaborator

m3nu commented Jun 7, 2018

It seems like you didn't adjust the code to use the new empty templates you created. That would be here.

@duskybomb

This comment has been minimized.

Show comment
Hide comment
@duskybomb

duskybomb Jun 7, 2018

Collaborator

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.

Collaborator

duskybomb commented Jun 7, 2018

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.

duskybomb added some commits Jun 7, 2018

@m3nu m3nu merged commit 26cf6c9 into master Jun 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment