From 27921ea73d43b2411e9c81d0d510abc4f75ac3a1 Mon Sep 17 00:00:00 2001 From: "bit4bit@riseup.net" <bit4bit@riseup.net> Date: Sun, 27 Sep 2020 17:01:38 +0000 Subject: [PATCH 1/3] se actualiza README.md FossilOrigin-Name: 3272eda3f1aa353f255c0a639698bcdd3ced3cd5a21891fd156fbba41e895620 --- README.md | 18 +++++++++++++++--- requirements_dev.txt | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e17d4ed..cf2ac1e 100644 --- a/README.md +++ b/README.md @@ -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.. \ No newline at end of file diff --git a/requirements_dev.txt b/requirements_dev.txt index 4ea07ea..f17ffa4 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -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 From 72f7e09291f240fa2ddcbbefb89a86813896e9ac Mon Sep 17 00:00:00 2001 From: "alnus@disroot.org" <alnus@disroot.org> Date: Sat, 10 Oct 2020 20:43:08 +0000 Subject: [PATCH 2/3] FBB04 #24, FAK55 #23, FAS07 #21 FossilOrigin-Name: 731cdb177455192cbd3ec06a0b4eba325920210fc84fc3c5b53e20c78b887d31 --- facho/fe/form.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/facho/fe/form.py b/facho/fe/form.py index d0a107c..77f2761 100644 --- a/facho/fe/form.py +++ b/facho/fe/form.py @@ -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 From 463ec90060a370c40c48fa2112c871f0f837608e Mon Sep 17 00:00:00 2001 From: "alnus@disroot.org" <alnus@disroot.org> Date: Mon, 12 Oct 2020 21:35:19 +0000 Subject: [PATCH 3/3] Se quita X509IssuerSerial, X509IssuerName y X509SerialNumber, de X509 FossilOrigin-Name: 9c6313e44fd8d57d85030ecf9770316ff0054107f9eb66f0cfc12e28b3f41871 --- facho/fe/fe.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/facho/fe/fe.py b/facho/fe/fe.py index 39c6625..afd935f 100644 --- a/facho/fe/fe.py +++ b/facho/fe/fe.py @@ -224,9 +224,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)