Cancel cfdi of pay with xml signed

This commit is contained in:
Mauricio Baeza 2020-12-31 21:00:00 -06:00
parent 8f15961d20
commit 90eec635ce
2 changed files with 9 additions and 10 deletions

View File

@ -669,6 +669,6 @@ def cancel_xml_sign(invoice, auth, certificado):
date_cancel = tree.xpath('string(//Acuse/@Fecha)')[:19]
msg = 'Factura cancelada correctamente'
result = {'ok': True, 'msg': '', 'row': {'estatus': 'Cancelada'},
result = {'ok': True, 'msg': msg, 'row': {'estatus': 'Cancelada'},
'Fecha': date_cancel, 'Acuse': result}
return result

View File

@ -6526,21 +6526,21 @@ class CfdiPagos(BaseModel):
data = {'ok': False, 'msg': msg}
return data
auth = Emisor.get_auth()
cert = Certificado.get_cert()
data, result = util.cancel_xml(auth, last.uuid, cert)
if data['ok']:
auth = Configuracion.get_({'fields': 'pac_auth'})
certificado = Certificado.get(Certificado.es_fiel==False)
result = utils.cancel_xml_sign(last, auth, certificado)
# ~ data, result = util.cancel_xml(auth, last.uuid, cert)
if result['ok']:
last.estatus = 'Cancelada'
last.error = ''
last.cancelada = True
last.fecha_cancelacion = result['Fecha']
msg = 'Factura cancelada correctamente'
# ~ msg = 'Factura cancelada correctamente'
else:
last.error = msg = data['msg']
last.error = result['msg']
last.save()
return {'ok': data['ok'], 'msg': msg, 'id': last.id}
return {'ok': result['ok'], 'msg': result['msg'], 'id': last.id}
def _get_folio(self, serie):
folio = int(Configuracion.get_('txt_config_cfdipay_folio') or '0')
@ -8587,7 +8587,6 @@ class CfdiNomina(BaseModel):
def _make_xml(self, cfdi):
emisor = Emisor.select()[0]
empleado = cfdi.empleado
# ~ certificado = Certificado.select()[0]
certificado = Certificado.get(Certificado.es_fiel==False)
totals = CfdiNominaTotales.select().where(CfdiNominaTotales.cfdi==cfdi)[0]