invinet / python-en16931

A Python 3 package to parse, generate and manage the EN16931 Invoice format.
https://invinet.github.io/python-en16931/
Apache License 2.0
24 stars 8 forks source link

Select custom xml template from templates directory. #4

Closed mcmihai closed 9 months ago

mcmihai commented 9 months ago

I was thinking you could have multiple templates and you could select one when you initialize an invoice object. I've added a template for a Romanian invoice.

jtorrents commented 9 months ago

What is the specificity of the Romanian invoice? The template for EN16931 should cover all EU countries.

Thanks for all the contributions @mcmihai !

mcmihai commented 9 months ago

I guess now it's just the CustomizationID. It is also required to have provinces for buyer and seller and a payment means method. Also in the template invoice.xml the cbc:PriceAmount currencyID is hardcoded to euros but that can be easily fixed.

So in my program I used to have a different template which I loaded like this: invoice._templates = templates.get_template('ro_invoice.xml') and I was looking for a way to have a different template somehow: 'invoice = Invoice(currency="RON", template_name="ro_invoice.xml")`.

Now that all the other stuff is merged I guess it would make more sense to add a way to supply a different CustomizationID and make all the currencies variable.

Thanks for all the contributions @mcmihai !

no problem! :)

jtorrents commented 9 months ago

I guess now it's just the CustomizationID. It is also required to have provinces for buyer and seller and a payment means method. Also in the template invoice.xml the cbc:PriceAmount currencyID is hardcoded to euros but that can be easily fixed.

So in my program I used to have a different template which I loaded like this: invoice._templates = templates.get_template('ro_invoice.xml') and I was looking for a way to have a different template somehow: 'invoice = Invoice(currency="RON", template_name="ro_invoice.xml")`.

Now that all the other stuff is merged I guess it would make more sense to add a way to supply a different CustomizationID and make all the currencies variable.

That sounds like a plan! I'd prefer this solution.

jtorrents commented 9 months ago

Superseded by #9