forked from elmau/empresa-libre
Descancelar ticket al eliminar factura
This commit is contained in:
parent
3e3c4be720
commit
e2da894d8b
|
@ -24,6 +24,7 @@ from settings import log, DEBUG, VERSION, PATH_CP, COMPANIES, PRE, CURRENT_CFDI,
|
|||
FORMAT = '{0:.2f}'
|
||||
FORMAT3 = '{0:.3f}'
|
||||
FORMAT_TAX = '{0:.4f}'
|
||||
RFC_PUBLICO = 'XAXX010101000'
|
||||
|
||||
|
||||
database_proxy = Proxy()
|
||||
|
@ -3401,6 +3402,9 @@ class Facturas(BaseModel):
|
|||
if invoice.donativo and invoice.forma_pago == '12':
|
||||
return
|
||||
|
||||
if invoice.cliente.rfc == RFC_PUBLICO:
|
||||
return
|
||||
|
||||
importe = invoice.total_mn
|
||||
if invoice.tipo_comprobante == 'E':
|
||||
importe *= -1
|
||||
|
@ -3647,6 +3651,7 @@ class Facturas(BaseModel):
|
|||
q.execute()
|
||||
q = FacturasRelacionadas.delete().where(FacturasRelacionadas.factura==obj)
|
||||
q.execute()
|
||||
Tickets.uncancel(obj)
|
||||
return bool(obj.delete_instance())
|
||||
|
||||
def _get_folio(self, serie):
|
||||
|
@ -4252,7 +4257,7 @@ class Facturas(BaseModel):
|
|||
tipo_persona = 1
|
||||
if receptor['rfc'] == 'XEXX010101000':
|
||||
tipo_persona = 4
|
||||
elif receptor['rfc'] == 'XAXX010101000':
|
||||
elif receptor['rfc'] == RFC_PUBLICO:
|
||||
tipo_persona = 3
|
||||
elif len(receptor['rfc']) == 12:
|
||||
tipo_persona = 2
|
||||
|
@ -5353,6 +5358,15 @@ class Tickets(BaseModel):
|
|||
|
||||
return inicio
|
||||
|
||||
@classmethod
|
||||
def uncancel(cls, invoice):
|
||||
query = (Tickets
|
||||
.update(estatus='Generado', cancelado=False, factura=None)
|
||||
.where(Tickets.factura==invoice)
|
||||
)
|
||||
result = query.execute()
|
||||
return result
|
||||
|
||||
def _cancel_tickets(self, invoice, tickets):
|
||||
query = (Tickets
|
||||
.update(estatus='Facturado', cancelado=True, factura=invoice)
|
||||
|
@ -5453,7 +5467,7 @@ class Tickets(BaseModel):
|
|||
|
||||
if is_invoice_day:
|
||||
filters = (
|
||||
Socios.rfc == 'XAXX010101000' and
|
||||
Socios.rfc == RFC_PUBLICO and
|
||||
Socios.slug == 'publico_en_general')
|
||||
try:
|
||||
client = Socios.get(filters)
|
||||
|
@ -7166,7 +7180,7 @@ def _init_values(rfc):
|
|||
data = (
|
||||
{'clave': 'version', 'valor': VERSION},
|
||||
{'clave': 'migracion', 'valor': '0'},
|
||||
{'clave': 'rfc_publico', 'valor': 'XAXX010101000'},
|
||||
{'clave': 'rfc_publico', 'valor': RFC_PUBLICO},
|
||||
{'clave': 'rfc_extranjero', 'valor': 'XEXX010101000'},
|
||||
{'clave': 'decimales', 'valor': '2'},
|
||||
{'clave': 'path_key', 'valor': ''},
|
||||
|
|
|
@ -495,6 +495,16 @@ function cmd_cancelar_ticket_click(){
|
|||
return
|
||||
}
|
||||
|
||||
if(row['estatus']=='Cancelado'){
|
||||
msg_error('El ticket ya esta cancelado')
|
||||
return
|
||||
}
|
||||
|
||||
if(row['estatus']=='Facturado'){
|
||||
msg_error('El ticket esta facturado')
|
||||
return
|
||||
}
|
||||
|
||||
msg = '¿Estás seguro de cancelar el siguiente Ticket?<BR><BR>'
|
||||
msg += 'Folio: ' + row['folio']
|
||||
msg += '<BR><BR>ESTA ACCIÓN NO SE PUEDE DESHACER'
|
||||
|
|
Loading…
Reference in New Issue