diff --git a/CHANGELOG.md b/CHANGELOG.md index fe4c14b..ec0d430 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ -v 1.28.3 [09-mar-2019] +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] ---------------------- diff --git a/VERSION b/VERSION index ac786b6..5e57fb8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.28.3 +1.29.0 diff --git a/source/app/models/main.py b/source/app/models/main.py index e052e66..375cd8f 100644 --- a/source/app/models/main.py +++ b/source/app/models/main.py @@ -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') diff --git a/source/app/settings.py b/source/app/settings.py index 54636fb..bbd2009 100644 --- a/source/app/settings.py +++ b/source/app/settings.py @@ -47,7 +47,7 @@ except ImportError: DEBUG = DEBUG -VERSION = '1.28.3' +VERSION = '1.29.0' EMAIL_SUPPORT = ('soporte@empresalibre.mx',) TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION) diff --git a/source/static/js/controller/bancos.js b/source/static/js/controller/bancos.js index 30f6f07..1fa2946 100644 --- a/source/static/js/controller/bancos.js +++ b/source/static/js/controller/bancos.js @@ -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() +} diff --git a/source/static/js/ui/bancos.js b/source/static/js/ui/bancos.js index d5aa289..a3861bb 100644 --- a/source/static/js/ui/bancos.js +++ b/source/static/js/ui/bancos.js @@ -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) + } +}