Uncancel ticket when cancel invoice

This commit is contained in:
Mauricio Baeza 2020-03-03 22:47:40 -06:00
parent 82af00fedf
commit ed23a3531c
4 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,8 @@
v 1.38.0 [07-mar-2020]
----------------------
- Mejora: Factura global por ticket o nota
v 1.37.0 [02-mar-2020] v 1.37.0 [02-mar-2020]
---------------------- ----------------------
- Mejora: Soporte para complemento Leyendas Fiscales - Mejora: Soporte para complemento Leyendas Fiscales

View File

@ -1 +1 @@
1.37.0 1.38.0

View File

@ -48,6 +48,7 @@ from settings import (
PATHS, PATHS,
URL, URL,
VALUES_PDF, VALUES_PDF,
RFCS,
) )
FORMAT = '{0:.2f}' FORMAT = '{0:.2f}'
@ -3824,7 +3825,7 @@ class Facturas(BaseModel):
obj.acuse = result['Acuse'] or '' obj.acuse = result['Acuse'] or ''
self._actualizar_saldo_cliente(self, obj, True) self._actualizar_saldo_cliente(self, obj, True)
self._update_inventory(self, obj, True) self._update_inventory(self, obj, True)
# ~ self._uncancel_tickets(self, obj) self._uncancel_tickets(self, obj)
else: else:
obj.error = data['msg'] obj.error = data['msg']
obj.save() obj.save()
@ -3832,6 +3833,11 @@ class Facturas(BaseModel):
@utils.run_in_thread @utils.run_in_thread
def _uncancel_tickets(self, invoice): def _uncancel_tickets(self, invoice):
query = (Tickets
.update(estatus='Generado', cancelado=False, factura=None)
.where(Tickets.factura==invoice)
)
query.execute()
return return
def _cancel_signature(self, id): def _cancel_signature(self, id):
@ -7287,7 +7293,8 @@ class Tickets(BaseModel):
def _get_payment_type(self, ids): def _get_payment_type(self, ids):
"""Get max of payment type""" """Get max of payment type"""
query = (Tickets.select( query = (Tickets
.select(
Tickets.forma_pago, Tickets.forma_pago,
fn.Sum(Tickets.subtotal).alias('total')) fn.Sum(Tickets.subtotal).alias('total'))
.where(Tickets.id.in_(ids)) .where(Tickets.id.in_(ids))

View File

@ -47,7 +47,7 @@ except ImportError:
DEBUG = DEBUG DEBUG = DEBUG
VERSION = '1.37.0' VERSION = '1.38.0'
EMAIL_SUPPORT = ('soporte@empresalibre.mx',) EMAIL_SUPPORT = ('soporte@empresalibre.mx',)
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION) TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)
@ -234,6 +234,10 @@ VALUES_PDF = {
}, },
} }
RFCS = {
'PUBLIC': 'XAXX010101000',
}
URL = { URL = {
'SEAFILE': 'https://seafile.elmau.net', 'SEAFILE': 'https://seafile.elmau.net',
} }