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