facho/facho.py (FachoXML): placeholder_for alias a find_or_create_element
FossilOrigin-Name: 3eed13b608fc6f06cb1c0d4f30926ff76094d556d9c4fa2de3f6eb09bba975d2
This commit is contained in:
parent
9b358f690c
commit
dfeb071709
@ -151,6 +151,9 @@ class FachoXML:
|
||||
|
||||
def _normalize_xpath(self, xpath):
|
||||
return xpath.replace('//', '/')
|
||||
|
||||
def placeholder_for(self, xpath):
|
||||
return self.find_or_create_element(xpath)
|
||||
|
||||
def find_or_create_element(self, xpath, append=False):
|
||||
"""
|
||||
|
@ -216,8 +216,6 @@ class DIANInvoiceXML(fe.FeXML):
|
||||
super().__init__('Invoice', 'http://www.dian.gov.co/contratos/facturaelectronica/v1')
|
||||
self.attach_invoice(invoice)
|
||||
|
||||
def placeholder_for(fexml, xpath):
|
||||
fexml.find_or_create_element(xpath)
|
||||
|
||||
def set_supplier(fexml, invoice):
|
||||
fexml.set_element('/fe:Invoice/cac:AccountingSupplierParty/cbc:AdditionalAccountID',
|
||||
@ -234,7 +232,7 @@ class DIANInvoiceXML(fe.FeXML):
|
||||
fexml.set_element('/fe:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:TaxLevelCode',
|
||||
invoice.invoice_supplier.responsability_code)
|
||||
|
||||
fexml.find_or_create_element('/fe:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cac:TaxScheme')
|
||||
fexml.placeholder_for('/fe:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cac:TaxScheme')
|
||||
fexml.set_element('/fe:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cbc:RegistrationName',
|
||||
invoice.invoice_supplier.legal_name)
|
||||
fexml.set_element('/fe:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PartyLegalEntity/cac:RegistrationAddress/cbc:CityName', invoice.invoice_supplier.address.city)
|
||||
@ -256,7 +254,7 @@ class DIANInvoiceXML(fe.FeXML):
|
||||
**fe.SCHEME_AGENCY_ATTRS)
|
||||
fexml.set_element('/fe:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme/cbc:TaxLevelCode',
|
||||
invoice.invoice_customer.responsability_code)
|
||||
fexml.find_or_create_element('/fe:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme/cac:TaxScheme')
|
||||
fexml.placeholder_for('/fe:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme/cac:TaxScheme')
|
||||
|
||||
fexml.set_element('/fe:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyLegalEntity/cbc:RegistrationName',
|
||||
invoice.invoice_customer.legal_name)
|
||||
|
Loading…
Reference in New Issue
Block a user