From 2f30bba8b4e5f57f667bb8d7e23e860dd22d6b9e Mon Sep 17 00:00:00 2001 From: El Mau Date: Thu, 23 Dec 2021 12:28:07 -0600 Subject: [PATCH] =?UTF-8?q?Ejemplo=20m=C3=ADnimo=20de=20CFDI=203.3=20con?= =?UTF-8?q?=20Carta=20Porte=202.0=20funcional?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 +- ejemplos/cfdi_carta_porte.json | 78 ++++++++++++++++++++++++++++++++++ source/util.py | 8 ++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 ejemplos/cfdi_carta_porte.json diff --git a/.gitignore b/.gitignore index a1a71fb..6055b65 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ conf.py -.envi/ +.pyenv/ __pycache__/ diff --git a/ejemplos/cfdi_carta_porte.json b/ejemplos/cfdi_carta_porte.json new file mode 100644 index 0000000..04c7907 --- /dev/null +++ b/ejemplos/cfdi_carta_porte.json @@ -0,0 +1,78 @@ +{ + "comprobante" : { + "Moneda": "XXX", + "TipoDeComprobante": "T", + "LugarExpedicion": "06850", + "SubTotal": "0", + "Total": "0" + }, + "emisor": { + "Rfc": "EKU9003173C9", + "RegimenFiscal": "603" + }, + "receptor": { + "Rfc": "EKU9003173C9", + "UsoCFDI": "P01" + }, + "conceptos": [ + { + "ClaveProdServ": "10111301", + "Cantidad": "1", + "ClaveUnidad": "ACT", + "Descripcion": "Carta Porte", + "ValorUnitario": "0.00", + "Importe": "0.00" + } + ], + "cartaporte": { + "TranspInternac": "No", + "TotalDistRec": "150", + "ubicaciones": [ + { + "TipoUbicacion": "Origen", + "RFCRemitenteDestinatario": "XIQB891116QE4", + "FechaHoraSalidaLlegada": "2021-05-18T12:00:00" + }, + { + "TipoUbicacion": "Destino", + "RFCRemitenteDestinatario": "XIQB891116QE4", + "FechaHoraSalidaLlegada": "2020-05-25T12:00:00", + "DistanciaRecorrida": "150" + } + ], + "mercancias": { + "PesoBrutoTotal": "10.00", + "UnidadPeso": "X4A", + "NumTotalMercancias": "1", + "mercancias": [ + { + "BienesTransp": "10111301", + "Descripcion": "Carta Porte", + "Cantidad": "1", + "ClaveUnidad": "ACT", + "PesoEnKg": "10" + } + ], + "autotransporte": { + "PermSCT": "TPAF03", + "NumPermisoSCT": "Transporte privado de carga", + "identificacion": { + "ConfigVehicular": "C3", + "PlacaVM": "YYY1234", + "AnioModeloVM": "2020" + }, + "seguros": { + "AseguraRespCivil": "CompaƱia Aseguradora", + "PolizaRespCivil": "1234567890" + } + } + }, + "tiposfigura": [ + { + "TipoFigura": "01", + "RFCFigura": "XIQB891116QE4", + "NumLicencia": "1234567890" + } + ] + } +} diff --git a/source/util.py b/source/util.py index 864f9c4..7560c01 100644 --- a/source/util.py +++ b/source/util.py @@ -292,6 +292,7 @@ class CFDI(object): def _cartaporte(self, complemento, data): ubicaciones = data.pop('ubicaciones') mercancias = data.pop('mercancias') + tiposfigura = data.pop('tiposfigura', ()) if not 'Version' in data: data['Version'] = self.CARTAPORTE['version'] @@ -328,6 +329,13 @@ class CFDI(object): node_name = f"{{{self.CARTAPORTE['prefix']}}}Seguros" ET.SubElement(sub_node, node_name, seguros) + if tiposfigura: + node_name = f"{{{self.CARTAPORTE['prefix']}}}FiguraTransporte" + node = ET.SubElement(node_carta, node_name) + for figura in tiposfigura: + node_name = f"{{{self.CARTAPORTE['prefix']}}}TiposFigura" + ET.SubElement(node, node_name, figura) + return