facho/cli.py(generate_invoice): nuevos metodos descriptores
*document_xml* metodo debe retonar la clase de documento xml a generar. *validator* metodo debe retornar validador. FossilOrigin-Name: f0a1ea065c4b8d9e364c678eb4ea11cd3087777c98d5ea5c12a792b429bd2e25
This commit is contained in:
parent
55cb95ea19
commit
5437c37a40
15
facho/cli.py
15
facho/cli.py
@ -250,15 +250,26 @@ def generate_invoice(private_key, passphrase, scriptname, generate=False, ssl=Tr
|
||||
from facho.fe.form_xml import DIANInvoiceXML, DIANWriteSigned,DIANWrite
|
||||
from facho import fe
|
||||
|
||||
try:
|
||||
invoice_xml = module.document_xml()
|
||||
except AttributeError:
|
||||
invoice_xml = DIANInvoiceXML
|
||||
|
||||
print("Using document xml:", invoice_xml)
|
||||
invoice = module.invoice()
|
||||
invoice.calculate()
|
||||
validator = form.DianResolucion0001Validator()
|
||||
|
||||
try:
|
||||
validator = module.validator()
|
||||
except AttributeError:
|
||||
validator = form.DianResolucion0001Validator()
|
||||
|
||||
if not validator.validate(invoice):
|
||||
for error in validator.errors:
|
||||
print("ERROR:", error)
|
||||
|
||||
if generate:
|
||||
xml = DIANInvoiceXML(invoice)
|
||||
xml = invoice_xml(invoice)
|
||||
|
||||
extensions = module.extensions(invoice)
|
||||
for extension in extensions:
|
||||
|
Loading…
Reference in New Issue
Block a user