This commit is contained in:
El Mau 2022-02-15 23:51:27 -06:00
commit 68c0203039
6 changed files with 136 additions and 30 deletions

View File

@ -1,3 +1,8 @@
v 1.46.3 [15-Feb-2022]
----------------------
- Error: Issue #53
v 1.46.2 [31-Ene-2022]
----------------------
- Error: Al generar Carta Porte sin remolque.

View File

@ -1,2 +1,2 @@
1.46.2
1.46.3

View File

@ -7168,6 +7168,7 @@ class CfdiPagos(BaseModel):
def _cancel(self, values):
id_mov = int(values['id_mov'])
args = utils.loads(values['args'])
filters = (
(CfdiPagos.movimiento==id_mov) &
@ -7194,7 +7195,7 @@ class CfdiPagos(BaseModel):
auth = Configuracion.get_({'fields': 'auth_by_pac', 'pac': pac})
certificado = Certificado.get(Certificado.es_fiel==False)
result = utils.cancel_xml_sign(last, auth, certificado)
result = utils.cancel_xml_sign(last, args, auth, certificado)
if result['ok']:
last.estatus = 'Cancelada'

View File

@ -42,7 +42,7 @@ except ImportError:
DEBUG = DEBUG
VERSION = '1.46.2'
VERSION = '1.46.3'
EMAIL_SUPPORT = ('soporte@empresalibre.mx',)
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)

View File

@ -1063,6 +1063,61 @@ function cmd_pay_stamp_click(){
}
function cmd_win_cancel_pay_close_click(){
$$('win_invoice_cancel_pay').close()
}
function send_invoice_cancel_pay(reason='', uuid=''){
var grid = $$('grid_cfdi_pay')
var form = $$('form_bank_pay')
var values = form.getValues()
var data = {
'opt': 'cancel',
'id_mov': values.id_mov,
args: {
reason: reason,
uuid: uuid,
}
}
webix.ajax().post('cfdipay', data, function(text, data){
var values = data.json()
if(values.ok){
msg_ok(values.msg)
grid.updateItem(values.id, {'estatus': 'Cancelada'})
}else{
msg_error('No fue posible cancelar')
webix.alert({
title: 'Error al Cancelar',
text: values.msg,
type: 'alert-error'
})
}
})
}
function cmd_invoice_cancel_pay_click(){
var reason = $$('lst_reasons_cancel').getValue()
var uuid = $$('txt_cancel_uuid').getValue()
if(!reason){
msg = 'Selecciona un motivo para esta cancelación'
msg_error(msg)
return
}
if(reason=='01' & !uuid){
msg = 'Debes de capturar el UUID que reemplaza a este CFDI'
msg_error(msg)
return
}
send_invoice_cancel_pay(reason, uuid)
$$('win_invoice_cancel_pay').close()
}
function cmd_pay_cancel_click(){
var form = $$('form_bank_pay')
var values = form.getValues()
@ -1074,33 +1129,36 @@ function cmd_pay_cancel_click(){
return
}
msg = '¿Estás seguro de cancelar esta factura?\n\nESTA ACCIÓN NO SE PUEDE DESHACER'
webix.confirm({
title: 'Cancelar Factura',
ok: 'Si',
cancel: 'No',
type: 'confirm-error',
text: msg,
callback:function(result){
if(result){
webix.ajax().post('/cfdipay', data, {
error:function(text, data, XmlHttpRequest){
msg = 'Ocurrio un error, consulta a soporte técnico'
msg_error(msg)
},
success:function(text, data, XmlHttpRequest){
values = data.json();
if(values.ok){
grid.updateItem(values.id, {'estatus': 'Cancelada'})
msg_ok(values.msg)
}else{
msg_error(values.msg)
}
}
})
}
}
})
win_invoice_cancel_pay.init()
$$('win_invoice_cancel_pay').show()
//~ msg = '¿Estás seguro de cancelar esta factura?\n\nESTA ACCIÓN NO SE PUEDE DESHACER'
//~ webix.confirm({
//~ title: 'Cancelar Factura',
//~ ok: 'Si',
//~ cancel: 'No',
//~ type: 'confirm-error',
//~ text: msg,
//~ callback:function(result){
//~ if(result){
//~ webix.ajax().post('/cfdipay', data, {
//~ error:function(text, data, XmlHttpRequest){
//~ msg = 'Ocurrio un error, consulta a soporte técnico'
//~ msg_error(msg)
//~ },
//~ success:function(text, data, XmlHttpRequest){
//~ values = data.json();
//~ if(values.ok){
//~ grid.updateItem(values.id, {'estatus': 'Cancelada'})
//~ msg_ok(values.msg)
//~ }else{
//~ msg_error(values.msg)
//~ }
//~ }
//~ })
//~ }
//~ }
//~ })
}

View File

@ -608,3 +608,45 @@ var win_mov_description = {
$$('cmd_close_mov_description').attachEvent('onItemClick', cmd_close_mov_description_click)
}
}
var opt_reasons_cancel_pay = [
{id: '', value: ''},
{id: '01', value: '[01] Comprobante emitido con errores con relación'},
{id: '02', value: '[02] Comprobante emitido con errores sin relación'},
{id: '03', value: '[03] No se llevó acabo la operación'},
{id: '04', value: '[04] Operación nominativa relacionada en una factura global'},
]
var body_invoice_cancel_pay = {rows: [{minHeight: 15},
{view: 'richselect', id: 'lst_reasons_cancel', labelPosition: 'top', label: 'Razón de cancelación', options: opt_reasons_cancel_pay, value: '', width: 400},
{view: 'text', id: 'txt_cancel_uuid', labelPosition: 'top', label: 'UUID que sustituye', width: 400},
{view: 'label', label: 'Esta acción no se puede deshacer', autowidth: true, align: 'center'},
{view: 'label', label: '¿Estás segura de continuar?', autowidth: true, align: 'center'},
{cols: [{},
{view: 'button', id: 'cmd_invoice_cancel_pay', width: 100, label: 'Cancelar', type: 'danger', icon: 'ban'},
{maxWidth: 25},
{view: 'button', id: 'cmd_win_cancel_pay_close', width: 100, label: 'Cerrar'},
{}
]},
{minHeight: 20},
]}
var win_invoice_cancel_pay = {
init: function(){
webix.ui({
view: 'window',
id: 'win_invoice_cancel_pay',
modal: true,
width: 400,
position: 'center',
head: 'Cancelar CFDI',
body: body_invoice_cancel_pay,
})
$$('cmd_invoice_cancel_pay').attachEvent('onItemClick', cmd_invoice_cancel_pay_click)
$$('cmd_win_cancel_pay_close').attachEvent('onItemClick', cmd_win_cancel_pay_close_click)
}
}