forked from elmau/empresa-libre
Fix name error in warehouse
This commit is contained in:
parent
870d95cb5a
commit
93f0d09f4d
|
@ -698,20 +698,20 @@ class AppInventoryEntries(object):
|
||||||
resp.status = falcon.HTTP_200
|
resp.status = falcon.HTTP_200
|
||||||
|
|
||||||
|
|
||||||
class AppWhareHouse(object):
|
class AppWareHouse(object):
|
||||||
|
|
||||||
def __init__(self, db):
|
def __init__(self, db):
|
||||||
self._db = db
|
self._db = db
|
||||||
|
|
||||||
def on_get(self, req, resp):
|
def on_get(self, req, resp):
|
||||||
values = req.params
|
values = req.params
|
||||||
req.context['result'] = self._db.wharehouse_get(values)
|
req.context['result'] = self._db.warehouse_get(values)
|
||||||
resp.status = falcon.HTTP_200
|
resp.status = falcon.HTTP_200
|
||||||
|
|
||||||
def on_post(self, req, resp):
|
def on_post(self, req, resp):
|
||||||
values = req.params
|
values = req.params
|
||||||
user = req.env['beaker.session']['userobj']
|
user = req.env['beaker.session']['userobj']
|
||||||
req.context['result'] = self._db.wharehouse_post(values, user)
|
req.context['result'] = self._db.warehouse_post(values, user)
|
||||||
resp.status = falcon.HTTP_200
|
resp.status = falcon.HTTP_200
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ from controllers.main import (AppEmpresas,
|
||||||
AppSATFormaPago, AppSATLeyendaFiscales, AppCert, AppSucursales,
|
AppSATFormaPago, AppSATLeyendaFiscales, AppCert, AppSucursales,
|
||||||
AppPartnerProducts,
|
AppPartnerProducts,
|
||||||
AppInventoryEntries,
|
AppInventoryEntries,
|
||||||
AppWhareHouse,
|
AppWareHouse,
|
||||||
AppUsers,
|
AppUsers,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ api.add_route('/cert', AppCert(db))
|
||||||
api.add_route('/sucursales', AppSucursales(db))
|
api.add_route('/sucursales', AppSucursales(db))
|
||||||
api.add_route('/partnerproducts', AppPartnerProducts(db))
|
api.add_route('/partnerproducts', AppPartnerProducts(db))
|
||||||
api.add_route('/inventoryentries', AppInventoryEntries(db))
|
api.add_route('/inventoryentries', AppInventoryEntries(db))
|
||||||
api.add_route('/wharehouse', AppWhareHouse(db))
|
api.add_route('/warehouse', AppWareHouse(db))
|
||||||
api.add_route('/users', AppUsers(db))
|
api.add_route('/users', AppUsers(db))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -487,10 +487,10 @@ class StorageEngine(object):
|
||||||
def inventory_entries_post(self, filters, user):
|
def inventory_entries_post(self, filters, user):
|
||||||
return main.InventoryEntries.post(filters, user)
|
return main.InventoryEntries.post(filters, user)
|
||||||
|
|
||||||
def wharehouse_get(self, filters):
|
def warehouse_get(self, filters):
|
||||||
return main.Almacenes.get_data(filters)
|
return main.Almacenes.get_data(filters)
|
||||||
|
|
||||||
def wharehouse_post(self, values, user):
|
def warehouse_post(self, values, user):
|
||||||
return main.Almacenes.post(values, user)
|
return main.Almacenes.post(values, user)
|
||||||
|
|
||||||
def users_get(self, filters, user):
|
def users_get(self, filters, user):
|
||||||
|
|
|
@ -3428,7 +3428,7 @@ class Almacenes(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
class Sucursales(BaseModel):
|
class Sucursales(BaseModel):
|
||||||
wharehouse = ForeignKeyField(Almacenes, null=True)
|
warehouse = ForeignKeyField(Almacenes, null=True)
|
||||||
nombre = TextField(default='')
|
nombre = TextField(default='')
|
||||||
direccion = TextField(default='')
|
direccion = TextField(default='')
|
||||||
serie_facturas = TextField(default='')
|
serie_facturas = TextField(default='')
|
||||||
|
@ -3945,15 +3945,15 @@ class Productos(BaseModel):
|
||||||
return bool(q.execute())
|
return bool(q.execute())
|
||||||
|
|
||||||
|
|
||||||
class WhareHouseProduct(BaseModel):
|
class WareHouseProduct(BaseModel):
|
||||||
wharehouse = ForeignKeyField(Almacenes)
|
warehouse = ForeignKeyField(Almacenes)
|
||||||
product = ForeignKeyField(Productos)
|
product = ForeignKeyField(Productos)
|
||||||
exists = DecimalField(default=0.0, max_digits=18, decimal_places=2,
|
exists = DecimalField(default=0.0, max_digits=18, decimal_places=2,
|
||||||
auto_round=True)
|
auto_round=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
indexes = (
|
indexes = (
|
||||||
(('wharehouse', 'product'), True),
|
(('warehouse', 'product'), True),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -9860,7 +9860,7 @@ def _crear_tablas(rfc):
|
||||||
PartnerProducts,
|
PartnerProducts,
|
||||||
InventoryEntries,
|
InventoryEntries,
|
||||||
PartnerInvoices,
|
PartnerInvoices,
|
||||||
WhareHouseProduct,
|
WareHouseProduct,
|
||||||
]
|
]
|
||||||
log.info('Creando tablas...')
|
log.info('Creando tablas...')
|
||||||
database_proxy.create_tables(tablas, True)
|
database_proxy.create_tables(tablas, True)
|
||||||
|
@ -9917,7 +9917,7 @@ def _migrate_tables(rfc=''):
|
||||||
PartnerProducts,
|
PartnerProducts,
|
||||||
InventoryEntries,
|
InventoryEntries,
|
||||||
PartnerInvoices,
|
PartnerInvoices,
|
||||||
WhareHouseProduct,
|
WareHouseProduct,
|
||||||
]
|
]
|
||||||
log.info('Creando tablas nuevas...')
|
log.info('Creando tablas nuevas...')
|
||||||
database_proxy.create_tables(tablas, True)
|
database_proxy.create_tables(tablas, True)
|
||||||
|
@ -10069,9 +10069,9 @@ def _migrate_tables(rfc=''):
|
||||||
|
|
||||||
table = 'sucursales'
|
table = 'sucursales'
|
||||||
columns = [c.name for c in database_proxy.get_columns(table)]
|
columns = [c.name for c in database_proxy.get_columns(table)]
|
||||||
if not 'wharehouse_id' in columns:
|
if not 'warehouse_id' in columns:
|
||||||
wharehouse = ForeignKeyField(Almacenes, null=True, to_field=Almacenes.id)
|
warehouse = ForeignKeyField(Almacenes, null=True, to_field=Almacenes.id)
|
||||||
migrations.append(migrator.add_column(table, 'wharehouse', wharehouse))
|
migrations.append(migrator.add_column(table, 'warehouse', warehouse))
|
||||||
|
|
||||||
if migrations:
|
if migrations:
|
||||||
with database_proxy.atomic() as txn:
|
with database_proxy.atomic() as txn:
|
||||||
|
|
|
@ -96,7 +96,8 @@ var controllers = {
|
||||||
$$('chk_config_precio_con_impuestos').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_config_precio_con_impuestos').attachEvent('onItemClick', chk_config_item_click)
|
||||||
$$('chk_llevar_inventario').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_llevar_inventario').attachEvent('onItemClick', chk_config_item_click)
|
||||||
$$('chk_multi_stock').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_multi_stock').attachEvent('onItemClick', chk_config_item_click)
|
||||||
$$('cmd_add_wharehouse').attachEvent('onItemClick', cmd_add_wharehouse_click)
|
$$('cmd_add_warehouse').attachEvent('onItemClick', cmd_add_warehouse_click)
|
||||||
|
$$('grid_warehouse').attachEvent('onItemClick', grid_warehouse_click)
|
||||||
//~ $$('chk_use_packing').attachEvent('onItemClick', chk_config_item_click)
|
//~ $$('chk_use_packing').attachEvent('onItemClick', chk_config_item_click)
|
||||||
|
|
||||||
//~ Complements
|
//~ Complements
|
||||||
|
@ -2513,26 +2514,24 @@ function admin_config_other_options(id){
|
||||||
}else{
|
}else{
|
||||||
$$('chk_multi_stock').setValue(0)
|
$$('chk_multi_stock').setValue(0)
|
||||||
$$('chk_multi_stock').disable()
|
$$('chk_multi_stock').disable()
|
||||||
set_visible_wharehouse(false)
|
set_visible_warehouse(false)
|
||||||
disable_config_option('chk_multi_stock')
|
disable_config_option('chk_multi_stock')
|
||||||
}
|
}
|
||||||
}else if(id=='chk_multi_stock'){
|
}else if(id=='chk_multi_stock'){
|
||||||
set_visible_wharehouse(value)
|
set_visible_warehouse(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function set_visible_wharehouse(value){
|
function set_visible_warehouse(value){
|
||||||
if(value){
|
if(value){
|
||||||
//~ $$('template_add_wharehouse').show()
|
$$('txt_add_warehouse').show()
|
||||||
$$('txt_add_wharehouse').show()
|
$$('cmd_add_warehouse').show()
|
||||||
$$('cmd_add_wharehouse').show()
|
$$('grid_warehouse').load('/warehouse?opt=all')
|
||||||
$$('grid_warehouse').load('/wharehouse?opt=all')
|
|
||||||
$$('grid_warehouse').show()
|
$$('grid_warehouse').show()
|
||||||
}else{
|
}else{
|
||||||
//~ $$('template_add_wharehouse').hide()
|
$$('txt_add_warehouse').hide()
|
||||||
$$('txt_add_wharehouse').hide()
|
$$('cmd_add_warehouse').hide()
|
||||||
$$('cmd_add_wharehouse').hide()
|
|
||||||
$$('grid_warehouse').hide()
|
$$('grid_warehouse').hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2963,8 +2962,8 @@ function disable_config_option(id){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function cmd_add_wharehouse_click(){
|
function cmd_add_warehouse_click(){
|
||||||
var value = $$('txt_add_wharehouse').getValue().trim()
|
var value = $$('txt_add_warehouse').getValue().trim()
|
||||||
|
|
||||||
if(!value){
|
if(!value){
|
||||||
msg = 'El nombre del almacen es requerido'
|
msg = 'El nombre del almacen es requerido'
|
||||||
|
@ -2981,20 +2980,20 @@ function cmd_add_wharehouse_click(){
|
||||||
text: msg,
|
text: msg,
|
||||||
callback:function(result){
|
callback:function(result){
|
||||||
if(result){
|
if(result){
|
||||||
add_wharehouse(value)
|
add_warehouse(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_wharehouse(name){
|
function add_warehouse(name){
|
||||||
var grid = $$('grid_warehouse')
|
var grid = $$('grid_warehouse')
|
||||||
var data = {
|
var data = {
|
||||||
opt: 'create',
|
opt: 'create',
|
||||||
values: {name: name},
|
values: {name: name},
|
||||||
}
|
}
|
||||||
|
|
||||||
webix.ajax().post('/wharehouse', data, {
|
webix.ajax().post('/warehouse', data, {
|
||||||
error:function(text, data, XmlHttpRequest){
|
error:function(text, data, XmlHttpRequest){
|
||||||
msg = 'Ocurrio un error, consulta a soporte técnico'
|
msg = 'Ocurrio un error, consulta a soporte técnico'
|
||||||
msg_error(msg)
|
msg_error(msg)
|
||||||
|
@ -3002,7 +3001,7 @@ function add_wharehouse(name){
|
||||||
success:function(text, data, XmlHttpRequest){
|
success:function(text, data, XmlHttpRequest){
|
||||||
var values = data.json()
|
var values = data.json()
|
||||||
if(values.ok){
|
if(values.ok){
|
||||||
$$('txt_add_wharehouse').setValue('')
|
$$('txt_add_warehouse').setValue('')
|
||||||
if(values.msg){
|
if(values.msg){
|
||||||
msg_ok(values.msg)
|
msg_ok(values.msg)
|
||||||
}else{
|
}else{
|
||||||
|
@ -3016,3 +3015,42 @@ function add_wharehouse(name){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function grid_warehouse_click(id, e, node){
|
||||||
|
if(id.column != 'delete'){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
opt: 'delete',
|
||||||
|
values: {id: id.row},
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = '¿Estás seguro de borrar el almacen seleccionado?<BR><BR>ESTA ACCIÓN NO SE PUEDE DESHACER'
|
||||||
|
webix.confirm({
|
||||||
|
title: 'Borrar Almacen',
|
||||||
|
ok: 'Si',
|
||||||
|
cancel: 'No',
|
||||||
|
type: 'confirm-error',
|
||||||
|
text: msg,
|
||||||
|
callback:function(result){
|
||||||
|
if(result){
|
||||||
|
webix.ajax().post('/warehouse', data, {
|
||||||
|
error:function(text, data, XmlHttpRequest){
|
||||||
|
msg = 'Ocurrio un error, consulta a soporte técnico'
|
||||||
|
msg_error(msg)
|
||||||
|
},
|
||||||
|
success:function(text, data, XmlHttpRequest){
|
||||||
|
var values = data.json()
|
||||||
|
if(values.ok){
|
||||||
|
$$('grid_warehouse').remove(id.row)
|
||||||
|
msg_ok('Almacen eliminado correctamente')
|
||||||
|
}else{
|
||||||
|
msg_error(values.msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -800,11 +800,11 @@ var options_admin_products = [
|
||||||
{cols: [{maxWidth: 30}, {view: 'checkbox', id: 'chk_multi_stock', labelWidth: 15,
|
{cols: [{maxWidth: 30}, {view: 'checkbox', id: 'chk_multi_stock', labelWidth: 15,
|
||||||
labelRight: 'Multialmacen', disabled: true}]},
|
labelRight: 'Multialmacen', disabled: true}]},
|
||||||
{cols: [{maxWidth: 30}, {rows: [
|
{cols: [{maxWidth: 30}, {rows: [
|
||||||
{template: 'Agregar Almacen', type: 'section', id: 'template_add_wharehouse'},
|
{template: 'Agregar Almacen', type: 'section', id: 'template_add_warehouse'},
|
||||||
{cols: [
|
{cols: [
|
||||||
{view: 'text', id: 'txt_add_wharehouse', label: 'Nombre: ',
|
{view: 'text', id: 'txt_add_warehouse', label: 'Nombre: ',
|
||||||
labelPosition: 'left', required: true},
|
labelPosition: 'left', required: true},
|
||||||
{view: 'button', id: 'cmd_add_wharehouse', label: 'Agregar',
|
{view: 'button', id: 'cmd_add_warehouse', label: 'Agregar',
|
||||||
autowidth: true, type: 'iconButton', icon: 'plus'},
|
autowidth: true, type: 'iconButton', icon: 'plus'},
|
||||||
]},
|
]},
|
||||||
{template: 'Almacenes', type: 'section'},
|
{template: 'Almacenes', type: 'section'},
|
||||||
|
|
Loading…
Reference in New Issue