Compare commits
3 Commits
76df7a62e5
...
6570d82f1b
Author | SHA1 | Date |
---|---|---|
Mauricio | 6570d82f1b | |
Mauricio | 3774bd1447 | |
Mauricio | 5eef753a7e |
|
@ -294,19 +294,20 @@ class DictToCfdi():
|
|||
for i, doc in enumerate(docs):
|
||||
node_name = f"{{{self._PAGOS['xmlns']}}}DoctoRelacionado"
|
||||
node_doc = ET.SubElement(node_pago, node_name, doc)
|
||||
if taxesd:
|
||||
if taxesd[i]:
|
||||
doc_taxes = taxesd[i]
|
||||
node_name = f"{{{self._PAGOS['xmlns']}}}ImpuestosDR"
|
||||
node_taxes_doc = ET.SubElement(node_doc, node_name)
|
||||
if 'retenciones' in taxesd:
|
||||
if 'retenciones' in doc_taxes:
|
||||
node_name = f"{{{self._PAGOS['xmlns']}}}RetencionesDR"
|
||||
node_taxes_dr = ET.SubElement(node_taxes_doc, node_name)
|
||||
for r in taxesd['retenciones']:
|
||||
for r in doc_taxes['retenciones']:
|
||||
node_name = f"{{{self._PAGOS['xmlns']}}}RetencionDR"
|
||||
ET.SubElement(node_taxes_dr, node_name, r)
|
||||
if 'traslados' in taxesd:
|
||||
if 'traslados' in doc_taxes:
|
||||
node_name = f"{{{self._PAGOS['xmlns']}}}TrasladosDR"
|
||||
node_taxes_dt = ET.SubElement(node_taxes_doc, node_name)
|
||||
for t in taxesd['traslados']:
|
||||
for t in doc_taxes['traslados']:
|
||||
node_name = f"{{{self._PAGOS['xmlns']}}}TrasladoDR"
|
||||
ET.SubElement(node_taxes_dt, node_name, t)
|
||||
|
||||
|
@ -358,7 +359,7 @@ class DictToCfdi():
|
|||
node_name = f"{{{self._COMERCIO['xmlns']}}}Receptor"
|
||||
attr = {}
|
||||
if 'NumRegIdTrib' in receptor:
|
||||
attr = {'NumRegIdTrib': emisor.pop('NumRegIdTrib')}
|
||||
attr = {'NumRegIdTrib': receptor.pop('NumRegIdTrib')}
|
||||
node_receptor = ET.SubElement(node_comercio, node_name, attr)
|
||||
|
||||
node_name = f"{{{self._COMERCIO['xmlns']}}}Domicilio"
|
||||
|
@ -607,6 +608,7 @@ class DataToDict():
|
|||
taxes = {}
|
||||
traslados = []
|
||||
retenciones = []
|
||||
|
||||
for i in range(0, len(data), 6):
|
||||
type_tax = data[i]
|
||||
tax = {
|
||||
|
@ -615,9 +617,9 @@ class DataToDict():
|
|||
'TipoFactor': data[i + 3],
|
||||
}
|
||||
if data[i + 4]:
|
||||
tax['TasaOCuota'] : data[i + 4]
|
||||
tax['TasaOCuota'] = data[i + 4]
|
||||
if data[i + 5]:
|
||||
tax['Importe'] : data[i + 5]
|
||||
tax['Importe'] = data[i + 5]
|
||||
|
||||
if type_tax == self.TRASLADO:
|
||||
traslados.append(tax)
|
||||
|
@ -627,6 +629,7 @@ class DataToDict():
|
|||
taxes['traslados'] = traslados
|
||||
if retenciones:
|
||||
taxes['retenciones'] = retenciones
|
||||
|
||||
return taxes
|
||||
|
||||
def _conceptos(self, data):
|
||||
|
@ -740,7 +743,7 @@ class DataToDict():
|
|||
self._cfdi['complementos']['pagos'] = version
|
||||
self._cfdi['complementos']['pagos']['docs'] = []
|
||||
self._cfdi['complementos']['pagos']['taxes'] = {}
|
||||
self._cfdi['complementos']['pagos']['taxesd'] = {}
|
||||
self._cfdi['complementos']['pagos']['taxesd'] = []
|
||||
elif self._complement == '2':
|
||||
self._cfdi['complementos']['comercio'] = version
|
||||
|
||||
|
@ -958,7 +961,7 @@ class DataToDict():
|
|||
|
||||
if self._complement == '1':
|
||||
attr = self._get_taxes_by_doc(data)
|
||||
self._cfdi['complementos']['pagos']['taxesd'] = attr
|
||||
self._cfdi['complementos']['pagos']['taxesd'].append(attr)
|
||||
elif self._complement == '2':
|
||||
fields = (
|
||||
'NoIdentificacion',
|
||||
|
|
Loading…
Reference in New Issue