Fix - Al buscar productos
This commit is contained in:
parent
4e428ab1b7
commit
5fa6ce9394
|
@ -1722,7 +1722,7 @@ class ImportFacturaLibreGambas(object):
|
|||
('receptores', 'Socios'),
|
||||
('cfdifacturas', 'Facturas'),
|
||||
('categorias', 'Categorias'),
|
||||
('productos', 'Productos'),
|
||||
# ~ ('productos', 'Productos'),
|
||||
('tickets', 'Tickets'),
|
||||
)
|
||||
for source, target in tables:
|
||||
|
@ -1870,11 +1870,12 @@ class ImportFacturaLibreGambas(object):
|
|||
('id_categoria', 'categoria'),
|
||||
('noidentificacion', 'clave'),
|
||||
('descripcion', 'descripcion'),
|
||||
('unidad', 'unidad'),
|
||||
('costo', 'ultimo_costo'),
|
||||
# ~ ('unidad', 'unidad'),
|
||||
('id_unidad', 'unidad'),
|
||||
# ~ ('costo', 'ultimo_costo'),
|
||||
('valorunitario', 'valor_unitario'),
|
||||
('existencia', 'existencia'),
|
||||
('minimo', 'minimo'),
|
||||
# ~ ('existencia', 'existencia'),
|
||||
# ~ ('minimo', 'minimo'),
|
||||
('inventario', 'inventario'),
|
||||
('codigobarras', 'codigo_barras'),
|
||||
('cuentapredial', 'cuenta_predial'),
|
||||
|
@ -1890,9 +1891,13 @@ class ImportFacturaLibreGambas(object):
|
|||
for i, row in enumerate(rows):
|
||||
msg = '\tImportando producto {} de {}'.format(i+1, totals)
|
||||
log.info(msg)
|
||||
|
||||
# ~ print (i, dict(row))
|
||||
new = {t: row[s] for s, t in fields}
|
||||
|
||||
# ~ print (new['unidad'])
|
||||
if new['unidad'] == 2:
|
||||
new['unidad'] = 'servicio'
|
||||
|
||||
u = new['unidad'].lower().strip()
|
||||
if u in ('sin',):
|
||||
continue
|
||||
|
@ -2095,7 +2100,7 @@ class ImportFacturaLibreGambas(object):
|
|||
|
||||
if not new['uuid']:
|
||||
new['uuid'] = None
|
||||
elif new['uuid'] in('ok', '123', '??'):
|
||||
elif new['uuid'] in('ok', '123', '??', 'X'):
|
||||
new['uuid'] = None
|
||||
new['estatus'] = 'Cancelada'
|
||||
new['cancelada'] = True
|
||||
|
|
|
@ -5362,7 +5362,7 @@ def _importar_factura_libre_gambas(conexion):
|
|||
_importar_socios(data['Socios'])
|
||||
_importar_facturas(data['Facturas'])
|
||||
_importar_categorias(data['Categorias'])
|
||||
_importar_productos_gambas(data['Productos'])
|
||||
# ~ _importar_productos_gambas(data['Productos'])
|
||||
_import_tickets(data['Tickets'])
|
||||
|
||||
log.info('Importación terminada...')
|
||||
|
|
|
@ -846,14 +846,31 @@ function set_product(values){
|
|||
|
||||
|
||||
function grid_products_found_click(obj){
|
||||
search_product_by_id(obj.id)
|
||||
search_product_by_key(obj.clave)
|
||||
}
|
||||
|
||||
|
||||
function search_product_by_id(id){
|
||||
var msg = ''
|
||||
//~ function search_product_by_id(id){
|
||||
//~ webix.ajax().get('/values/product', {'id': id}, {
|
||||
//~ error: function(text, data, xhr) {
|
||||
//~ msg_error('Error al consultar')
|
||||
//~ },
|
||||
//~ success: function(text, data, xhr){
|
||||
//~ var values = data.json()
|
||||
//~ if (values.ok){
|
||||
//~ set_product(values)
|
||||
//~ } else {
|
||||
//~ msg = 'No se encontró un producto con la clave: ' + id
|
||||
//~ msg_error(msg)
|
||||
//~ }
|
||||
//~ }
|
||||
//~ })
|
||||
|
||||
webix.ajax().get('/values/product', {'id': id}, {
|
||||
//~ }
|
||||
|
||||
|
||||
function search_product_by_key(key){
|
||||
webix.ajax().get('/values/productokey', {'key': key}, {
|
||||
error: function(text, data, xhr) {
|
||||
msg_error('Error al consultar')
|
||||
},
|
||||
|
@ -862,7 +879,7 @@ function search_product_by_id(id){
|
|||
if (values.ok){
|
||||
set_product(values)
|
||||
} else {
|
||||
msg = 'No se encontró un producto con la clave: ' + id
|
||||
msg = 'No se encontró un producto con la clave: ' + key
|
||||
msg_error(msg)
|
||||
}
|
||||
}
|
||||
|
@ -872,14 +889,9 @@ function search_product_by_id(id){
|
|||
|
||||
|
||||
function search_product_id_key_press(code, e){
|
||||
var value = this.getValue()
|
||||
var value = this.getValue().trim()
|
||||
if(code == 13 && value.length > 0){
|
||||
var id = parseInt(value, 10)
|
||||
if (isNaN(id)){
|
||||
msg_error('Captura una clave válida')
|
||||
}else{
|
||||
search_product_by_id(id)
|
||||
}
|
||||
search_product_by_key(value)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue