Agregar nodo para domicilio en Carta Porte
This commit is contained in:
parent
8bbd2ba62b
commit
0f041ed975
|
@ -473,7 +473,6 @@ class CFDI(object):
|
||||||
|
|
||||||
if self._carta_porte:
|
if self._carta_porte:
|
||||||
datos = datos['cartaporte']
|
datos = datos['cartaporte']
|
||||||
print('\nDatos', datos)
|
|
||||||
ubicaciones = datos.pop('ubicaciones')
|
ubicaciones = datos.pop('ubicaciones')
|
||||||
mercancias = datos.pop('mercancias', ())
|
mercancias = datos.pop('mercancias', ())
|
||||||
tiposfigura = datos.pop('tiposfigura', ())
|
tiposfigura = datos.pop('tiposfigura', ())
|
||||||
|
@ -486,9 +485,12 @@ class CFDI(object):
|
||||||
|
|
||||||
node = ET.SubElement(node_carta, f'{prefix}:Ubicaciones')
|
node = ET.SubElement(node_carta, f'{prefix}:Ubicaciones')
|
||||||
for ubicacion in ubicaciones:
|
for ubicacion in ubicaciones:
|
||||||
|
domicilio = ubicacion.pop('domicilio', {})
|
||||||
dt = parser.parse(ubicacion['FechaHoraSalidaLlegada'])
|
dt = parser.parse(ubicacion['FechaHoraSalidaLlegada'])
|
||||||
ubicacion['FechaHoraSalidaLlegada'] = dt.isoformat()[:19]
|
ubicacion['FechaHoraSalidaLlegada'] = dt.isoformat()[:19]
|
||||||
ET.SubElement(node, f'{prefix}:Ubicacion', ubicacion)
|
sub_node = ET.SubElement(node, f'{prefix}:Ubicacion', ubicacion)
|
||||||
|
if domicilio:
|
||||||
|
ET.SubElement(sub_node, f'{prefix}:Domicilio', domicilio)
|
||||||
|
|
||||||
attr = mercancias
|
attr = mercancias
|
||||||
mercancias = attr.pop('mercancias')
|
mercancias = attr.pop('mercancias')
|
||||||
|
|
|
@ -641,9 +641,9 @@ def get_cert(args):
|
||||||
|
|
||||||
def make_xml(data, certificado):
|
def make_xml(data, certificado):
|
||||||
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
|
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
|
||||||
if DEBUG:
|
# ~ if DEBUG:
|
||||||
data['emisor']['Rfc'] = certificado.rfc
|
# ~ data['emisor']['Rfc'] = certificado.rfc
|
||||||
data['emisor']['RegimenFiscal'] = '603'
|
# ~ data['emisor']['RegimenFiscal'] = '603'
|
||||||
|
|
||||||
cfdi = CFDI()
|
cfdi = CFDI()
|
||||||
xml = ET.parse(BytesIO(cfdi.get_xml(data).encode()))
|
xml = ET.parse(BytesIO(cfdi.get_xml(data).encode()))
|
||||||
|
|
Loading…
Reference in New Issue