forked from elmau/empresa-libre
Cantidad por empaque en productos
This commit is contained in:
parent
d48122608b
commit
06170cb054
|
@ -1,3 +1,10 @@
|
||||||
|
v 1.28.0 [03-feb-2019]
|
||||||
|
----------------------
|
||||||
|
- Mejora: Manejo de empaques para mensajeria
|
||||||
|
|
||||||
|
* IMPORTANTE: Es necesario realizar una migración, despues de actualizar.
|
||||||
|
|
||||||
|
|
||||||
v 1.27.1 [23-ene-2019]
|
v 1.27.1 [23-ene-2019]
|
||||||
----------------------
|
----------------------
|
||||||
- Error: Al cancelar nómina
|
- Error: Al cancelar nómina
|
||||||
|
|
|
@ -368,6 +368,39 @@ class Configuracion(BaseModel):
|
||||||
values = {r.clave: util.get_bool(r.valor) for r in data}
|
values = {r.clave: util.get_bool(r.valor) for r in data}
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
|
||||||
|
def _get_admin_products(self):
|
||||||
|
fields = (
|
||||||
|
'chk_config_cuenta_predial',
|
||||||
|
'chk_config_codigo_barras',
|
||||||
|
'chk_config_precio_con_impuestos',
|
||||||
|
'chk_llevar_inventario',
|
||||||
|
'chk_use_packing',
|
||||||
|
)
|
||||||
|
data = (Configuracion
|
||||||
|
.select()
|
||||||
|
.where(Configuracion.clave.in_(fields))
|
||||||
|
)
|
||||||
|
values = {r.clave: util.get_bool(r.valor) for r in data}
|
||||||
|
return values
|
||||||
|
|
||||||
|
def _get_main_products(self):
|
||||||
|
fields = (
|
||||||
|
'chk_config_cuenta_predial',
|
||||||
|
'chk_config_codigo_barras',
|
||||||
|
'chk_config_precio_con_impuestos',
|
||||||
|
'chk_llevar_inventario',
|
||||||
|
'chk_use_packing',
|
||||||
|
)
|
||||||
|
data = (Configuracion
|
||||||
|
.select()
|
||||||
|
.where(Configuracion.clave.in_(fields))
|
||||||
|
)
|
||||||
|
values = {r.clave: r.valor for r in data}
|
||||||
|
values['default_tax'] = SATImpuestos.select()[0].id
|
||||||
|
values['default_unidad'] = SATUnidades.get_default()
|
||||||
|
return values
|
||||||
|
|
||||||
def _get_complements(self):
|
def _get_complements(self):
|
||||||
fields = (
|
fields = (
|
||||||
'chk_config_ine',
|
'chk_config_ine',
|
||||||
|
@ -412,27 +445,14 @@ class Configuracion(BaseModel):
|
||||||
return data[0].valor
|
return data[0].valor
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
options = ('partners', 'complements', 'folios')
|
options = ('partners',
|
||||||
|
'admin_products', 'main_products',
|
||||||
|
'complements',
|
||||||
|
'folios')
|
||||||
opt = keys['fields']
|
opt = keys['fields']
|
||||||
if opt in options:
|
if opt in options:
|
||||||
return getattr(cls, '_get_{}'.format(opt))(cls)
|
return getattr(cls, '_get_{}'.format(opt))(cls)
|
||||||
|
|
||||||
if keys['fields'] == 'productos':
|
|
||||||
fields = (
|
|
||||||
'chk_config_cuenta_predial',
|
|
||||||
'chk_config_codigo_barras',
|
|
||||||
'chk_config_precio_con_impuestos',
|
|
||||||
'chk_llevar_inventario',
|
|
||||||
)
|
|
||||||
data = (Configuracion
|
|
||||||
.select()
|
|
||||||
.where(Configuracion.clave.in_(fields))
|
|
||||||
)
|
|
||||||
values = {r.clave: r.valor for r in data}
|
|
||||||
values['default_tax'] = SATImpuestos.select()[0].id
|
|
||||||
values['default_unidad'] = SATUnidades.get_default()
|
|
||||||
return values
|
|
||||||
|
|
||||||
if keys['fields'] == 'configtemplates':
|
if keys['fields'] == 'configtemplates':
|
||||||
try:
|
try:
|
||||||
emisor = Emisor.select()[0]
|
emisor = Emisor.select()[0]
|
||||||
|
@ -465,10 +485,6 @@ class Configuracion(BaseModel):
|
||||||
'chk_config_tax_locales_truncate',
|
'chk_config_tax_locales_truncate',
|
||||||
'chk_config_decimales_precios',
|
'chk_config_decimales_precios',
|
||||||
'chk_config_anticipo',
|
'chk_config_anticipo',
|
||||||
'chk_config_cuenta_predial',
|
|
||||||
'chk_config_codigo_barras',
|
|
||||||
'chk_config_precio_con_impuestos',
|
|
||||||
'chk_llevar_inventario',
|
|
||||||
'chk_usar_punto_de_venta',
|
'chk_usar_punto_de_venta',
|
||||||
'chk_ticket_pdf_show',
|
'chk_ticket_pdf_show',
|
||||||
'chk_ticket_direct_print',
|
'chk_ticket_direct_print',
|
||||||
|
@ -3204,6 +3220,8 @@ class Productos(BaseModel):
|
||||||
es_activo = BooleanField(default=True)
|
es_activo = BooleanField(default=True)
|
||||||
impuestos = ManyToManyField(SATImpuestos, related_name='productos')
|
impuestos = ManyToManyField(SATImpuestos, related_name='productos')
|
||||||
tags = ManyToManyField(Tags, related_name='productos_tags')
|
tags = ManyToManyField(Tags, related_name='productos_tags')
|
||||||
|
cantidad_empaque = DecimalField(default=0.0, max_digits=14, decimal_places=4,
|
||||||
|
auto_round=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
order_by = ('descripcion',)
|
order_by = ('descripcion',)
|
||||||
|
@ -3415,6 +3433,7 @@ class Productos(BaseModel):
|
||||||
Productos.inventario,
|
Productos.inventario,
|
||||||
Productos.existencia,
|
Productos.existencia,
|
||||||
Productos.minimo,
|
Productos.minimo,
|
||||||
|
Productos.cantidad_empaque.alias('cant_by_packing'),
|
||||||
)
|
)
|
||||||
.where(Productos.id==id).dicts()[0]
|
.where(Productos.id==id).dicts()[0]
|
||||||
)
|
)
|
||||||
|
@ -3442,6 +3461,7 @@ class Productos(BaseModel):
|
||||||
descripcion = util.spaces(values.pop('descripcion'))
|
descripcion = util.spaces(values.pop('descripcion'))
|
||||||
fields = util.clean(values)
|
fields = util.clean(values)
|
||||||
|
|
||||||
|
fields['cantidad_empaque'] = fields.pop('cant_by_packing', 0.0)
|
||||||
fields.pop('precio_con_impuestos', '')
|
fields.pop('precio_con_impuestos', '')
|
||||||
fields['es_activo'] = fields.pop('es_activo_producto')
|
fields['es_activo'] = fields.pop('es_activo_producto')
|
||||||
fields['descripcion'] = descripcion
|
fields['descripcion'] = descripcion
|
||||||
|
@ -3484,6 +3504,7 @@ class Productos(BaseModel):
|
||||||
def actualizar(cls, values, id):
|
def actualizar(cls, values, id):
|
||||||
values['cuenta_predial'] = values.get('cuenta_predial', '')
|
values['cuenta_predial'] = values.get('cuenta_predial', '')
|
||||||
values['codigo_barras'] = values.get('codigo_barras', '')
|
values['codigo_barras'] = values.get('codigo_barras', '')
|
||||||
|
# ~ values['cantidad_empaque'] = values.pop('cant_by_packing', 0.0)
|
||||||
fields, taxes = cls._clean(cls, values)
|
fields, taxes = cls._clean(cls, values)
|
||||||
obj_taxes = SATImpuestos.select().where(SATImpuestos.id.in_(taxes))
|
obj_taxes = SATImpuestos.select().where(SATImpuestos.id.in_(taxes))
|
||||||
with database_proxy.transaction():
|
with database_proxy.transaction():
|
||||||
|
@ -5616,6 +5637,8 @@ class FacturasDetalle(BaseModel):
|
||||||
nivel = TextField(default='')
|
nivel = TextField(default='')
|
||||||
autorizacion = TextField(default='')
|
autorizacion = TextField(default='')
|
||||||
cuenta_predial = TextField(default='')
|
cuenta_predial = TextField(default='')
|
||||||
|
empaques = DecimalField(default=0.0, max_digits=14, decimal_places=4,
|
||||||
|
auto_round=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
order_by = ('factura',)
|
order_by = ('factura',)
|
||||||
|
@ -8835,6 +8858,22 @@ def _migrate_tables(rfc=''):
|
||||||
activa = BooleanField(default=True)
|
activa = BooleanField(default=True)
|
||||||
migrations.append(migrator.add_column(table, 'activa', activa))
|
migrations.append(migrator.add_column(table, 'activa', activa))
|
||||||
|
|
||||||
|
table = 'productos'
|
||||||
|
columns = [c.name for c in database_proxy.get_columns(table)]
|
||||||
|
if not 'cantidad_empaque' in columns:
|
||||||
|
cantidad_empaque = DecimalField(default=0.0, max_digits=14,
|
||||||
|
decimal_places=4, auto_round=True)
|
||||||
|
migrations.append(migrator.add_column(
|
||||||
|
table, 'cantidad_empaque', cantidad_empaque))
|
||||||
|
|
||||||
|
table = 'facturasdetalle'
|
||||||
|
columns = [c.name for c in database_proxy.get_columns(table)]
|
||||||
|
if not 'empaques' in columns:
|
||||||
|
empaques = DecimalField(default=0.0, max_digits=14,
|
||||||
|
decimal_places=4, auto_round=True)
|
||||||
|
migrations.append(migrator.add_column(
|
||||||
|
table, 'empaques', empaques))
|
||||||
|
|
||||||
if migrations:
|
if migrations:
|
||||||
with database_proxy.atomic() as txn:
|
with database_proxy.atomic() as txn:
|
||||||
migrate(*migrations)
|
migrate(*migrations)
|
||||||
|
|
|
@ -47,7 +47,7 @@ except ImportError:
|
||||||
|
|
||||||
|
|
||||||
DEBUG = DEBUG
|
DEBUG = DEBUG
|
||||||
VERSION = '1.27.1'
|
VERSION = '1.28.0'
|
||||||
EMAIL_SUPPORT = ('soporte@empresalibre.net',)
|
EMAIL_SUPPORT = ('soporte@empresalibre.net',)
|
||||||
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)
|
TITLE_APP = '{} v{}'.format(TITLE_APP, VERSION)
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,13 @@ var controllers = {
|
||||||
//~ Partners
|
//~ Partners
|
||||||
$$('chk_config_change_balance_partner').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_config_change_balance_partner').attachEvent('onItemClick', chk_config_item_click)
|
||||||
|
|
||||||
|
//~ Products
|
||||||
|
$$('chk_config_cuenta_predial').attachEvent('onItemClick', chk_config_item_click)
|
||||||
|
$$('chk_config_codigo_barras').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_use_packing').attachEvent('onItemClick', chk_config_item_click)
|
||||||
|
|
||||||
$$('chk_config_ocultar_metodo_pago').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_config_ocultar_metodo_pago').attachEvent('onItemClick', chk_config_item_click)
|
||||||
$$('chk_config_ocultar_condiciones_pago').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_config_ocultar_condiciones_pago').attachEvent('onItemClick', chk_config_item_click)
|
||||||
$$('chk_config_send_zip').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_config_send_zip').attachEvent('onItemClick', chk_config_item_click)
|
||||||
|
@ -99,10 +106,6 @@ var controllers = {
|
||||||
$$('chk_config_edu').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_config_edu').attachEvent('onItemClick', chk_config_item_click)
|
||||||
$$('chk_config_pagos').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_config_pagos').attachEvent('onItemClick', chk_config_item_click)
|
||||||
$$('chk_cfg_pays_data_bank').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_cfg_pays_data_bank').attachEvent('onItemClick', chk_config_item_click)
|
||||||
$$('chk_config_cuenta_predial').attachEvent('onItemClick', chk_config_item_click)
|
|
||||||
$$('chk_config_codigo_barras').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_usar_punto_de_venta').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_usar_punto_de_venta').attachEvent('onItemClick', chk_config_item_click)
|
||||||
$$('chk_ticket_pdf_show').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_ticket_pdf_show').attachEvent('onItemClick', chk_config_item_click)
|
||||||
$$('chk_ticket_direct_print').attachEvent('onItemClick', chk_config_item_click)
|
$$('chk_ticket_direct_print').attachEvent('onItemClick', chk_config_item_click)
|
||||||
|
@ -1277,6 +1280,7 @@ function tab_options_change(nv, ov){
|
||||||
var cv = {
|
var cv = {
|
||||||
tab_admin_templates: 'templates',
|
tab_admin_templates: 'templates',
|
||||||
tab_admin_partners: 'partners',
|
tab_admin_partners: 'partners',
|
||||||
|
tab_admin_products: 'admin_products',
|
||||||
tab_admin_complements: 'complements',
|
tab_admin_complements: 'complements',
|
||||||
tab_admin_otros: 'configotros',
|
tab_admin_otros: 'configotros',
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ var cfg_products = new Object()
|
||||||
|
|
||||||
|
|
||||||
function products_default_config(){
|
function products_default_config(){
|
||||||
webix.ajax().get('/config', {'fields': 'productos'}, {
|
webix.ajax().get('/config', {'fields': 'main_products'}, {
|
||||||
error: function(text, data, xhr) {
|
error: function(text, data, xhr) {
|
||||||
msg = 'Error al consultar'
|
msg = 'Error al consultar'
|
||||||
msg_error(msg)
|
msg_error(msg)
|
||||||
|
@ -18,6 +18,7 @@ function products_default_config(){
|
||||||
if(cfg_products['inventario']){
|
if(cfg_products['inventario']){
|
||||||
$$('grid_products').showColumn('existencia')
|
$$('grid_products').showColumn('existencia')
|
||||||
}
|
}
|
||||||
|
show('cant_by_packing', values.chk_use_packing)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -212,6 +213,11 @@ function cmd_save_product_click(id, e, node){
|
||||||
|
|
||||||
var values = form.getValues();
|
var values = form.getValues();
|
||||||
|
|
||||||
|
if(!isFinite(values.cant_by_packing)){
|
||||||
|
msg_error('La cantidad por empaque debe ser un número')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if(!validate_sat_key_product(values.clave_sat, false)){
|
if(!validate_sat_key_product(values.clave_sat, false)){
|
||||||
msg_error('La clave SAT no existe')
|
msg_error('La clave SAT no existe')
|
||||||
return
|
return
|
||||||
|
@ -422,4 +428,4 @@ function up_products_upload_complete(response){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -681,18 +681,6 @@ var options_admin_otros = [
|
||||||
labelRight: 'Ayuda para generar anticipos'},
|
labelRight: 'Ayuda para generar anticipos'},
|
||||||
{}]},
|
{}]},
|
||||||
{maxHeight: 20},
|
{maxHeight: 20},
|
||||||
{template: 'Productos y Servicios', type: 'section'},
|
|
||||||
{cols: [{maxWidth: 15},
|
|
||||||
{view: 'checkbox', id: 'chk_config_cuenta_predial', labelWidth: 0,
|
|
||||||
labelRight: 'Mostrar cuenta predial'},
|
|
||||||
{view: 'checkbox', id: 'chk_config_codigo_barras', labelWidth: 0,
|
|
||||||
labelRight: 'Mostrar código de barras'},
|
|
||||||
{view: 'checkbox', id: 'chk_config_precio_con_impuestos', labelWidth: 0,
|
|
||||||
labelRight: 'Mostrar precio con impuestos'},
|
|
||||||
{view: 'checkbox', id: 'chk_llevar_inventario', labelWidth: 0,
|
|
||||||
labelRight: 'Mostrar inventario'},
|
|
||||||
]},
|
|
||||||
{maxHeight: 20},
|
|
||||||
{template: 'Punto de venta', type: 'section'},
|
{template: 'Punto de venta', type: 'section'},
|
||||||
{cols: [{maxWidth: 15},
|
{cols: [{maxWidth: 15},
|
||||||
{view: 'checkbox', id: 'chk_usar_punto_de_venta', labelWidth: 0,
|
{view: 'checkbox', id: 'chk_usar_punto_de_venta', labelWidth: 0,
|
||||||
|
@ -733,6 +721,21 @@ var options_admin_partners = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
var options_admin_products = [
|
||||||
|
{maxHeight: 20},
|
||||||
|
{cols: [{view: 'checkbox', id: 'chk_config_cuenta_predial', labelWidth: 15,
|
||||||
|
labelRight: 'Mostrar cuenta predial'}]},
|
||||||
|
{cols: [{view: 'checkbox', id: 'chk_config_codigo_barras', labelWidth: 15,
|
||||||
|
labelRight: 'Mostrar código de barras'}]},
|
||||||
|
{cols: [{view: 'checkbox', id: 'chk_config_precio_con_impuestos', labelWidth: 15,
|
||||||
|
labelRight: 'Mostrar precio con impuestos'}]},
|
||||||
|
{cols: [{view: 'checkbox', id: 'chk_llevar_inventario', labelWidth: 15,
|
||||||
|
labelRight: 'Mostrar inventario'}]},
|
||||||
|
{cols: [{view: 'checkbox', id: 'chk_use_packing', labelWidth: 15,
|
||||||
|
labelRight: 'Usar empaques'}]},
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
var options_admin_complements = [
|
var options_admin_complements = [
|
||||||
{maxHeight: 20},
|
{maxHeight: 20},
|
||||||
{cols: [{maxWidth: 15},
|
{cols: [{maxWidth: 15},
|
||||||
|
@ -765,6 +768,8 @@ var tab_options = {
|
||||||
rows: options_templates}},
|
rows: options_templates}},
|
||||||
{header: 'Clientes y Proveedores', body: {id: 'tab_admin_partners',
|
{header: 'Clientes y Proveedores', body: {id: 'tab_admin_partners',
|
||||||
view: 'scrollview', body: {rows: options_admin_partners}}},
|
view: 'scrollview', body: {rows: options_admin_partners}}},
|
||||||
|
{header: 'Productos y Servicios', body: {id: 'tab_admin_products',
|
||||||
|
view: 'scrollview', body: {rows: options_admin_products}}},
|
||||||
{header: 'Complementos', body: {id: 'tab_admin_complements',
|
{header: 'Complementos', body: {id: 'tab_admin_complements',
|
||||||
view: 'scrollview', body: {rows: options_admin_complements}}},
|
view: 'scrollview', body: {rows: options_admin_complements}}},
|
||||||
{header: 'Otros', body: {id: 'tab_admin_otros', view: 'scrollview',
|
{header: 'Otros', body: {id: 'tab_admin_otros', view: 'scrollview',
|
||||||
|
|
|
@ -135,9 +135,13 @@ var controls_generals = [
|
||||||
{view: "richselect", id: "unidad", name: "unidad", label: "Unidad",
|
{view: "richselect", id: "unidad", name: "unidad", label: "Unidad",
|
||||||
width: 300, labelWidth: 130, labelAlign: "right", required: true,
|
width: 300, labelWidth: 130, labelAlign: "right", required: true,
|
||||||
invalidMessage: "La Unidad es requerida", options: []},
|
invalidMessage: "La Unidad es requerida", options: []},
|
||||||
{view: 'text', id: 'tags_producto', name: 'tags_producto',
|
{view: 'text', id: 'cant_by_packing', name: 'cant_by_packing',
|
||||||
labelAlign: 'right', label: 'Etiquetas',
|
labelAlign: 'right', labelWidth: 150, inputAlign: "right",
|
||||||
placeholder: 'Separadas por comas'}
|
label: 'Cantidad por empaque:'},
|
||||||
|
{},
|
||||||
|
//~ {view: 'text', id: 'tags_producto', name: 'tags_producto',
|
||||||
|
//~ labelAlign: 'right', label: 'Etiquetas',
|
||||||
|
//~ placeholder: 'Separadas por comas'}
|
||||||
]},
|
]},
|
||||||
{cols: [
|
{cols: [
|
||||||
{view: "currency", type: "text", id: "valor_unitario",
|
{view: "currency", type: "text", id: "valor_unitario",
|
||||||
|
|
Loading…
Reference in New Issue