From 49472fe20a73a49a3b625784a0b5782bc0990bf0 Mon Sep 17 00:00:00 2001 From: "bit4bit@riseup.net" Date: Sun, 30 Aug 2020 22:45:28 +0000 Subject: [PATCH] correcion en valor de schemeAgencyName facho/fe/form.py (PartyIdentification): nueva clase; FossilOrigin-Name: b2fb9d8073fd32d553bbd914a0c5c47d84ecdc566e2ed235e338a383023781df --- facho/fe/fe.py | 4 ++-- facho/fe/form.py | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/facho/fe/fe.py b/facho/fe/fe.py index 5c9a10c..82b1177 100644 --- a/facho/fe/fe.py +++ b/facho/fe/fe.py @@ -13,7 +13,7 @@ from contextlib import contextmanager from .data.dian import codelist SCHEME_AGENCY_ATTRS = { - 'schemeAgencyName': 'CO, DIAN (Direccion de Impuestos y Aduanas Nacionales)', + 'schemeAgencyName': 'CO, DIAN (Dirección de Impuestos y Aduanas Nacionales)', 'schemeAgencyID': '195' } @@ -248,7 +248,7 @@ class DianXMLExtensionAuthorizationProvider(FachoXMLExtension): # RESOLUCION 0004: pagina 176 def build(self, fexml): - dian_path = '/fe:Invoice/ext:UBLExtensions/ext:ExtensionContent/sts:DianExtensions/sts:AuthorizationProvider/sts:AuthorizationProviderID' + dian_path = '/fe:Invoice/ext:UBLExtensions/ext:UBLExtension/ext:ExtensionContent/sts:DianExtensions/sts:AuthorizationProvider/sts:AuthorizationProviderID' fexml.set_element(dian_path, '800197268') attrs = {'schemeID': '4', 'schemeName': '31'} diff --git a/facho/fe/form.py b/facho/fe/form.py index 3bdd913..f2f899d 100644 --- a/facho/fe/form.py +++ b/facho/fe/form.py @@ -36,7 +36,21 @@ class Address: department: str = '' country: Country = Country('CO', 'COLOMBIA') - + +@dataclass +class PartyIdentification: + number: str + dv: str + + def __str__(self): + return self.number + + def __eq__(self, other): + return str(self) == str(other) + + def full(self): + return "%s%s" % [self.number, self.dv] + @dataclass class Party: name: str @@ -279,7 +293,15 @@ class DIANInvoiceXML(fe.FeXML): invoice.invoice_supplier.name) fexml.set_element('/fe:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PhysicalLocation/cac:Address/cac:AddressLine/cbc:Line', invoice.invoice_supplier.address.street) - + + + supplier_company_id_attrs = fe.SCHEME_AGENCY_ATTRS.copy() + supplier_company_id_attrs.update({'schemeID': invoice.invoice_supplier.ident.dv, + 'schemeName': '31'}) + fexml.set_element('/fe:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:CompanyID', + invoice.invoice_supplier.ident, + **supplier_company_id_attrs) + fexml.set_element('/fe:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID', invoice.invoice_supplier.ident, **fe.SCHEME_AGENCY_ATTRS)