Start changes for uncancel

This commit is contained in:
Mauricio Baeza 2019-07-11 13:34:59 -05:00
parent a67d174782
commit a87c78fc6b
2 changed files with 19 additions and 1 deletions

View File

@ -19,7 +19,7 @@ contratar: administracion ARROBA empresalibre.net
* Servidor web, recomendado Nginx
* uwsgi
* python3
* python3.6+
* xsltproc
* openssl
* xmlsec

View File

@ -3663,6 +3663,8 @@ class Facturas(BaseModel):
@classmethod
def validate_count_partners(cls, ids):
"""Validate if invoices IDs are of unique client"""
filters = (Facturas.id.in_(tuple(ids.keys())))
partners = (Facturas.select(fn.COUNT(Socios.rfc))
.where(filters)
@ -5275,6 +5277,16 @@ class Facturas(BaseModel):
return {'ok': False}
# ~ v2
@classmethod
def uncancel(cls, id):
obj = Facturas.get(Facturas.id==id)
if obj.uuid is None:
msg = 'La factura no esta timbrada'
return {'ok': False, 'msg': msg}
return
class PreFacturas(BaseModel):
cliente = ForeignKeyField(Socios)
@ -9974,6 +9986,8 @@ def _exportar_documentos():
if not month:
month = str(n.month)
without_stamp = []
filters = {
'year': year,
'month': month,
@ -9986,6 +10000,8 @@ def _exportar_documentos():
i+1, t, row['serie'], row['folio'])
log.info(msg)
_, name = Facturas.get_xml(row['id'])
if not row['uuid']:
without_stamp.append(f"{row['serie']}-{row['folio']}")
msg = '\tXML extraido...'
log.info(msg)
name = name[:-3] + 'pdf'
@ -9998,6 +10014,8 @@ def _exportar_documentos():
log.info(msg)
log.info('Documentos exportados...')
for i in without_stamp:
log.info(i)
return