Merge branch 'develop'
Permitir editar la descripción en un movimiento bancario Fix #343
This commit is contained in:
commit
519a61e132
|
@ -1,3 +1,8 @@
|
|||
v 1.29.0 [08-mar-2019]
|
||||
----------------------
|
||||
- Error: Al mostrar detalle en facturas importadas #343
|
||||
- Mejora: Editar la descripción de un movimiento bancario.
|
||||
|
||||
v 1.28.2 [04-mar-2019]
|
||||
----------------------
|
||||
- Error: Al enviar facturas de pago
|
||||
|
|
|
@ -2908,6 +2908,18 @@ class MovimientosBanco(BaseModel):
|
|||
CuentasBanco.actualizar_saldo(row.cuenta, saldo)
|
||||
return saldo
|
||||
|
||||
def _update_description(self, values):
|
||||
try:
|
||||
obj = MovimientosBanco.get(MovimientosBanco.id==values['id'])
|
||||
except MovimientosBanco.DoesNotExist:
|
||||
msg = 'No se encontró el movimiento'
|
||||
return {'ok': False, 'msg': msg}
|
||||
|
||||
obj.descripcion = values['description']
|
||||
obj.save()
|
||||
msg = 'Descripción actualizada correctamente'
|
||||
return {'ok': True, 'msg': msg}
|
||||
|
||||
@classmethod
|
||||
def post(cls, values):
|
||||
opt = values.pop('opt')
|
||||
|
@ -5184,7 +5196,12 @@ class Facturas(BaseModel):
|
|||
for concepto in data['conceptos']:
|
||||
valor_unitario = float(concepto['ValorUnitario'])
|
||||
descuento = float(concepto.get('Descuento', '0.0'))
|
||||
clave = concepto.get('NoIdentificacion', '')
|
||||
producto = None
|
||||
if Productos.select().where(Productos.clave==clave).exists():
|
||||
producto = Productos.get(Productos.clave==clave)
|
||||
c = {
|
||||
'producto': producto,
|
||||
'cantidad': float(concepto['Cantidad']),
|
||||
'valor_unitario': valor_unitario,
|
||||
'descuento': descuento,
|
||||
|
@ -5192,7 +5209,7 @@ class Facturas(BaseModel):
|
|||
'importe': float(concepto['Importe']),
|
||||
'descripcion': concepto['Descripcion'],
|
||||
'unidad': concepto.get('Unidad', ''),
|
||||
'clave': concepto.get('NoIdentificacion', ''),
|
||||
'clave': clave,
|
||||
'clave_sat': concepto['ClaveProdServ'],
|
||||
}
|
||||
conceptos.append(c)
|
||||
|
|
|
@ -47,7 +47,7 @@ except ImportError:
|
|||
|
||||
|
||||
DEBUG = DEBUG
|
||||
VERSION = '1.28.2'
|
||||
VERSION = '1.29.0'
|
||||
EMAIL_SUPPORT = ('soporte@empresalibre.mx',)
|
||||
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ var bancos_controllers = {
|
|||
$$('filter_invoice_pay_year').attachEvent('onChange', filter_invoice_pay_change)
|
||||
$$('filter_invoice_pay_month').attachEvent('onChange', filter_invoice_pay_change)
|
||||
$$('grid_bank_invoice_pay').attachEvent('onItemClick', grid_bank_invoice_pay_click)
|
||||
$$('grid_cuentabanco').attachEvent('onItemDblClick', grid_cuentabanco_double_click)
|
||||
|
||||
init_config_bank()
|
||||
}
|
||||
|
@ -1293,3 +1294,60 @@ function grid_cfdi_por_pagar_on_after_filter(){
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function save_mov_description(value){
|
||||
var row = $$('grid_cuentabanco').getSelectedId()
|
||||
var data = new Object()
|
||||
|
||||
data['opt'] = 'update_description'
|
||||
data['id'] = row.id
|
||||
data['description'] = value
|
||||
|
||||
webix.ajax().post('/movbanco', data, {
|
||||
error:function(text, data, XmlHttpRequest){
|
||||
},
|
||||
success:function(text, data, XmlHttpRequest){
|
||||
values = data.json();
|
||||
if(values.ok){
|
||||
var item = $$('grid_cuentabanco').getItem(row.row)
|
||||
item[row.column] = value
|
||||
$$('grid_cuentabanco').updateItem(row.row, item)
|
||||
msg_ok(values.msg)
|
||||
}else{
|
||||
msg_error(values.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
function grid_cuentabanco_double_click(id, e, node){
|
||||
if(id.column != 'descripcion'){
|
||||
return
|
||||
}
|
||||
var row = this.getSelectedItem()
|
||||
win_mov_description.init()
|
||||
$$('mov_description').setValue(row.descripcion)
|
||||
$$('win_mov_description').show()
|
||||
to_end('mov_description')
|
||||
}
|
||||
|
||||
|
||||
function cmd_save_mov_description_click(){
|
||||
var value = $$('mov_description').getValue().trim()
|
||||
if(!value){
|
||||
focus('mov_description')
|
||||
msg = 'La descripción no puede estar vacía'
|
||||
msg_error(msg)
|
||||
return
|
||||
}
|
||||
save_mov_description(value)
|
||||
cmd_close_mov_description_click()
|
||||
}
|
||||
|
||||
|
||||
function cmd_close_mov_description_click(){
|
||||
$$('win_mov_description').close()
|
||||
}
|
||||
|
|
|
@ -575,3 +575,35 @@ var app_bancos = {
|
|||
}
|
||||
|
||||
|
||||
var win_body_mov_description = {rows: [
|
||||
{minHeight: 5, maxHeight: 5},
|
||||
{view: 'textarea', id: 'mov_description', name: 'mov_description',
|
||||
height: 300},
|
||||
{minHeight: 5, maxHeight: 5},
|
||||
{cols: [{},
|
||||
{view: 'button', id: 'cmd_save_mov_description', autowidth: true,
|
||||
label: 'Guardar', type: 'iconButton', icon: 'save', hotkey: 'Ctrl+enter'},
|
||||
{maxWidth: 50},
|
||||
{view: 'button', id: 'cmd_close_mov_description', autowidth: true,
|
||||
label: 'Cerrar', type: 'iconButton', icon: 'times-circle', hotkey: 'esc'},
|
||||
{}]},
|
||||
{minHeight: 5, maxHeight: 5},
|
||||
],}
|
||||
|
||||
|
||||
var win_mov_description = {
|
||||
init: function(){
|
||||
webix.ui({
|
||||
view: 'window',
|
||||
id: 'win_mov_description',
|
||||
height: 400,
|
||||
width: 600,
|
||||
modal: true,
|
||||
position: 'center',
|
||||
head: 'Descripción del movimiento',
|
||||
body: win_body_mov_description,
|
||||
})
|
||||
$$('cmd_save_mov_description').attachEvent('onItemClick', cmd_save_mov_description_click)
|
||||
$$('cmd_close_mov_description').attachEvent('onItemClick', cmd_close_mov_description_click)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue