FossilOrigin-Name: bb1bc22707ab2c09d58463955a8854302a9ae5a611593772feba4fbfb11c66fa
This commit is contained in:
bit4bit@riseup.net 2020-10-16 01:10:51 +00:00
commit 7422b9f157
4 changed files with 31 additions and 11 deletions

View File

@ -12,10 +12,22 @@ $ pip install git+https://git.disroot.org/Etrivial/facho
al instalar el paquete se genera el comando *facho*
## COMMANDO: generate-invoice
genera factura xml desde archiv .py ver *examples/generate-invoice-invoice.py*.
## COMENTARIOS
* http://facturasyrespuestas.com/2342/error-al-enviar-set-de-pruebas-usando-sendtestsetasync
# CÓMO CONTRIBUIR?
## INSTALAR USANDO python develop
este enlaza el ejecutable **facho** en lugar de copiarlo.
## CUMPLIR ANEXO TECNICO
el archivo **docs/DIAN/Anexo_Tecnico_Factura_Electronica_Vr1_7_2020.pdf** describe la implementación de la
facturación, la libreria **facho.py** permite crear elementos xml usando XPath-Like con el proposito
de facilitar la relación entre el anexo y la implementación.
* facho/form.py: generación de Invoice XML.
* facho/fe.py: extensiones XML, ejemplo CUFE, Firma, etc..

View File

@ -225,9 +225,6 @@ class DianXMLExtensionSigner(FachoXMLExtension):
ki = xmlsig.template.ensure_key_info(signature, name=id_keyinfo)
data = xmlsig.template.add_x509_data(ki)
xmlsig.template.x509_data_add_certificate(data)
serial = xmlsig.template.x509_data_add_issuer_serial(data)
xmlsig.template.x509_issuer_serial_add_issuer_name(serial)
xmlsig.template.x509_issuer_serial_add_serial_number(serial)
xmlsig.template.add_key_value(ki)

View File

@ -485,6 +485,10 @@ class DIANInvoiceXML(fe.FeXML):
invoice.invoice_customer.address.country.code)
fexml.placeholder_for('/fe:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme/cac:TaxScheme')
fexml.set_element('/fe:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme/cac:TaxScheme/cbc:ID',
'Zy')
fexml.set_element('/fe:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme/cac:TaxScheme/cbc:Name',
'No causa')
fexml.placeholder_for('/fe:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyLegalEntity')
fexml.set_element('/fe:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyLegalEntity/cbc:RegistrationName',
@ -496,6 +500,9 @@ class DIANInvoiceXML(fe.FeXML):
fexml.set_element('/fe:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyLegalEntity/cac:RegistrationAddress/cac:Country/cbc:IdentificationCode', invoice.invoice_customer.address.country.code)
fexml.set_element('/fe:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyLegalEntity/cac:RegistrationAddress/cac:Country/cbc:Name', invoice.invoice_customer.address.country.name)
#DIAN 1.7.-2020: FAK55
fexml.set_element('/fe:Invoice/cac:AccountingCustomerParty/cac:Party/cac:Contact/cbc:ElectronicMail',
invoice.invoice_customer.email)
def set_payment_mean(fexml, invoice):
payment_mean = invoice.invoice_payment_mean
@ -533,10 +540,11 @@ class DIANInvoiceXML(fe.FeXML):
#requeridos para CUFE
tax_amount_for['01']['tax_amount'] = 0.0
tax_amount_for['01']['taxable_amount'] = 0.0
tax_amount_for['04']['tax_amount'] = 0.0
tax_amount_for['04']['taxable_amount'] = 0.0
tax_amount_for['03']['tax_amount'] = 0.0
tax_amount_for['03']['taxable_amount'] = 0.0
#DIAN 1.7.-2020: FAS07 => Se debe construir estrategia para su manejo
#tax_amount_for['04']['tax_amount'] = 0.0
#tax_amount_for['04']['taxable_amount'] = 0.0
#tax_amount_for['03']['tax_amount'] = 0.0
#tax_amount_for['03']['taxable_amount'] = 0.0
total_tax_amount = 0.0
@ -613,7 +621,9 @@ class DIANInvoiceXML(fe.FeXML):
line.set_element('/cac:InvoiceLine/cac:Item/cbc:Description', invoice_line.item.description)
# TODO
line.set_element('/cac:InvoiceLine/cac:Item/cac:StandardItemIdentification/cbc:ID', invoice_line.item.id)
line.set_element('/cac:InvoiceLine/cac:Price/cbc:PriceAmount', invoice_line.price.amount, currencyID="COP")
line.set_element('/cac:InvoiceLine/cac:Price/cbc:PriceAmount', invoice_line.price.amount, currencyID="COP")
#DIAN 1.7.-2020: FBB04
line.set_element('/cac:InvoiceLine/cac:Price/cbc:BaseQuantity', invoice_line.price.amount)
def attach_invoice(fexml, invoice):
"""adiciona etiquetas a FEXML y retorna FEXML

View File

@ -7,6 +7,7 @@ tox==3.5.2
coverage==4.5.1
Sphinx==1.8.1
twine==1.12.1
xmlsec==1.3.8
pytest==3.8.2
pytest-runner==4.2