forked from elmau/empresa-libre
Corregir error al cancelar nomina
This commit is contained in:
parent
db77f6972d
commit
8a151d42ad
|
@ -1,4 +1,4 @@
|
|||
v 1.43.0 [05-Dic-2021]
|
||||
v 1.43.0 [12-Dic-2021]
|
||||
----------------------
|
||||
- Soporte para entradas de almacen.
|
||||
- Soporte para multi almacen.
|
||||
|
|
|
@ -682,7 +682,7 @@ def _cancel_with_cert(invoice, auth, certificado):
|
|||
|
||||
|
||||
def cancel_xml_sign(invoice, auth, certificado):
|
||||
# ~ return _cancel_with_cert(invoice, auth, certificado)
|
||||
return _cancel_with_cert(invoice, auth, certificado)
|
||||
|
||||
cert = SATCertificate(certificado.cer, certificado.key_enc.encode())
|
||||
pac = PACS[auth['pac']]()
|
||||
|
|
|
@ -42,6 +42,7 @@ from settings import log, COMPANIES, VERSION, PATH_CP, PRE, CURRENT_CFDI, \
|
|||
from controllers import utils
|
||||
from settings import (
|
||||
DEBUG,
|
||||
CANCEL_VERSION,
|
||||
DEFAULT_GLOBAL,
|
||||
DB_COMPANIES,
|
||||
EXT,
|
||||
|
@ -4318,8 +4319,8 @@ class Facturas(BaseModel):
|
|||
|
||||
@classmethod
|
||||
def _cancel_xml_sign(cls, invoice):
|
||||
if invoice.version != '3.3':
|
||||
msg = 'Solo es posible cancelar CFDI 3.3'
|
||||
if not invoice.version in CANCEL_VERSION:
|
||||
msg = 'Solo es posible cancelar CFDI >= 3.3'
|
||||
return {'ok': False, 'msg': msg}
|
||||
|
||||
pac = utils.get_pac_by_rfc(invoice.xml)
|
||||
|
@ -4361,8 +4362,8 @@ class Facturas(BaseModel):
|
|||
obj.estatus = 'Cancelada'
|
||||
obj.error = ''
|
||||
obj.cancelada = True
|
||||
obj.fecha_cancelacion = result['Fecha']
|
||||
obj.acuse = result['Acuse'] or ''
|
||||
obj.fecha_cancelacion = result['date']
|
||||
obj.acuse = result['acuse'] or ''
|
||||
self._actualizar_saldo_cliente(self, obj, True)
|
||||
self._update_inventory(self, obj, True)
|
||||
self._uncancel_tickets(self, obj)
|
||||
|
@ -7026,10 +7027,6 @@ class CfdiPagos(BaseModel):
|
|||
data = {'ok': False, 'msg': msg}
|
||||
return data
|
||||
|
||||
# ~ auth = Configuracion.get_({'fields': 'pac_auth'})
|
||||
# ~ certificado = Certificado.get(Certificado.es_fiel==False)
|
||||
# ~ result = utils.cancel_xml_sign(last, auth, certificado)
|
||||
|
||||
pac = utils.get_pac_by_rfc(last.xml)
|
||||
auth = Configuracion.get_({'fields': 'auth_by_pac', 'pac': pac})
|
||||
|
||||
|
@ -7040,7 +7037,7 @@ class CfdiPagos(BaseModel):
|
|||
last.estatus = 'Cancelada'
|
||||
last.error = ''
|
||||
last.cancelada = True
|
||||
last.fecha_cancelacion = result['Fecha']
|
||||
last.fecha_cancelacion = result['date']
|
||||
else:
|
||||
last.error = result['msg']
|
||||
last.save()
|
||||
|
@ -8648,8 +8645,8 @@ class CfdiNomina(BaseModel):
|
|||
obj.estatus = 'Cancelado'
|
||||
obj.error = ''
|
||||
obj.cancelada = True
|
||||
obj.fecha_cancelacion = result['Fecha']
|
||||
obj.acuse = result['Acuse'] or ''
|
||||
obj.fecha_cancelacion = result['date']
|
||||
obj.acuse = result['acuse'] or ''
|
||||
else:
|
||||
obj.error = result['msg']
|
||||
obj.save()
|
||||
|
|
|
@ -192,6 +192,8 @@ API = 'https://api.empresalibre.net{}'
|
|||
CURRENCY_MN = 'MXN'
|
||||
|
||||
# ~ v2
|
||||
CANCEL_VERSION = ('3.3', '4.0')
|
||||
|
||||
IS_MV = MV
|
||||
DB_COMPANIES = os.path.abspath(os.path.join(BASE_DIR, '..', 'db', 'rfc.db'))
|
||||
path_bk = os.path.join(path_docs, 'tmp')
|
||||
|
|
Loading…
Reference in New Issue