diff --git a/facho/fe/fe.py b/facho/fe/fe.py index f1c6fb5..19a1e5e 100644 --- a/facho/fe/fe.py +++ b/facho/fe/fe.py @@ -46,7 +46,13 @@ class FeXML(FachoXML): self._cn = root.rstrip('/') #self.find_or_create_element(self._cn) + # MACHETE se elimina xml namespace fe + def tostring(self, **kw): + return super().tostring(**kw)\ + .replace("fe:", "")\ + .replace("xmlns:fe", "xmlns") + class DianXMLExtensionCUFE(FachoXMLExtension): AMBIENTE_PRUEBAS = codelist.TipoAmbiente.by_name('Pruebas')['code'] AMBIENTE_PRODUCCION = codelist.TipoAmbiente.by_name('Producción')['code'] diff --git a/facho/fe/form.py b/facho/fe/form.py index 9a1d6fc..adf9dcc 100644 --- a/facho/fe/form.py +++ b/facho/fe/form.py @@ -298,8 +298,7 @@ class DIANInvoiceXML(fe.FeXML): def __init__(self, invoice): super().__init__('Invoice', 'http://www.dian.gov.co/contratos/facturaelectronica/v1') self.attach_invoice(invoice) - - + def set_supplier(fexml, invoice): fexml.set_element('/fe:Invoice/cac:AccountingSupplierParty/cbc:AdditionalAccountID', invoice.invoice_supplier.organization_code) diff --git a/tests/test_fe.py b/tests/test_fe.py index 41e7061..9318134 100644 --- a/tests/test_fe.py +++ b/tests/test_fe.py @@ -87,6 +87,11 @@ def test_dian_extension_authorization_provider(): dian_nit = xml.get_element_text('/fe:Invoice/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/sts:DianExtensions/sts:AuthorizationProvider/sts:AuthorizationProviderID') assert dian_nit == '800197268' +def test_dian_invoice_with_fe(): + xml = fe.FeXML('Invoice', + 'http://www.dian.gov.co/contratos/facturaelectronica/v1') + + assert "