Cambiar unidad al facturar
This commit is contained in:
parent
89098eb21a
commit
6847222ed6
|
@ -2754,7 +2754,7 @@ class Productos(BaseModel):
|
|||
Productos.clave,
|
||||
Productos.clave_sat,
|
||||
Productos.descripcion,
|
||||
SATUnidades.name.alias('unidad'),
|
||||
SATUnidades.id.alias('unidad'),
|
||||
Productos.valor_unitario,
|
||||
Productos.descuento)
|
||||
.join(SATUnidades).switch(Productos)
|
||||
|
@ -3573,7 +3573,7 @@ class Facturas(BaseModel):
|
|||
id_student = product.pop('id_student', 0)
|
||||
p = Productos.get(Productos.id==id_product)
|
||||
|
||||
product['unidad'] = p.unidad.key
|
||||
product['unidad'] = SATUnidades.get(SATUnidades.id==product['unidad']).key
|
||||
product['clave'] = p.clave
|
||||
product['clave_sat'] = p.clave_sat
|
||||
product['cuenta_predial'] = p.cuenta_predial
|
||||
|
@ -3794,8 +3794,8 @@ class Facturas(BaseModel):
|
|||
'ClaveProdServ': row.producto.clave_sat,
|
||||
'NoIdentificacion': row.producto.clave,
|
||||
'Cantidad': FORMAT.format(row.cantidad),
|
||||
'ClaveUnidad': row.producto.unidad.key,
|
||||
'Unidad': row.producto.unidad.name[:20],
|
||||
'ClaveUnidad': row.unidad,
|
||||
'Unidad': SATUnidades.get(SATUnidades.key==row.unidad).name[:20],
|
||||
'Descripcion': row.descripcion,
|
||||
'ValorUnitario': FORMAT.format(row.valor_unitario),
|
||||
'Importe': FORMAT.format(row.importe),
|
||||
|
|
|
@ -563,7 +563,7 @@ function guardar_y_timbrar(values){
|
|||
delete rows[i]['delete']
|
||||
delete rows[i]['clave']
|
||||
delete rows[i]['clave_sat']
|
||||
delete rows[i]['unidad']
|
||||
//~ delete rows[i]['unidad']
|
||||
delete rows[i]['importe']
|
||||
delete rows[i]['student']
|
||||
rows[i]['valor_unitario'] = parseFloat(rows[i]['valor_unitario'])
|
||||
|
@ -957,7 +957,7 @@ function search_product_id_key_press(code, e){
|
|||
|
||||
|
||||
function grid_details_before_edit_start(id){
|
||||
var columns = ['', 'descripcion', 'pedimento','cantidad', 'valor_unitario', 'descuento']
|
||||
var columns = ['', 'unidad', 'descripcion', 'pedimento','cantidad', 'valor_unitario', 'descuento']
|
||||
if(!columns.indexOf(id.column)){
|
||||
return !this.getItem(id.row)[id.column]
|
||||
}
|
||||
|
@ -967,6 +967,10 @@ function grid_details_before_edit_start(id){
|
|||
function grid_details_before_edit_stop(state, editor){
|
||||
var row = grid.getItem(editor.row)
|
||||
|
||||
if(editor.column == 'unidad'){
|
||||
return true
|
||||
}
|
||||
|
||||
if(editor.column == 'descripcion'){
|
||||
if(!state.value.trim()){
|
||||
msg = 'La descripción no puede estar vacía'
|
||||
|
|
|
@ -287,7 +287,8 @@ var grid_details_cols = [
|
|||
{id: "pedimento", header: 'Pedimento', editor: 'text', hidden: true},
|
||||
{id: "id_student", header: 'ID_Alumno', hidden: true},
|
||||
{id: 'student', header: 'Alumno', hidden: true, width: 150},
|
||||
{id: "unidad", header:{text: 'Unidad', css: 'center'}, width: 100},
|
||||
{id: "unidad", header:{text: 'Unidad', css: 'center'}, width: 100,
|
||||
editor: 'select', options: 'values/unidades'},
|
||||
{id: 'cantidad', header: {text: 'Cantidad', css: 'center'}, width: 100,
|
||||
format: webix.i18n.numberFormat, css: 'right', editor: 'text'},
|
||||
{id: "valor_unitario", header:{text: 'Valor Unitario', css: 'center'},
|
||||
|
|
Loading…
Reference in New Issue