Facturar mismo producto varias veces
This commit is contained in:
commit
89098eb21a
|
@ -246,6 +246,7 @@ def config_timbrar():
|
|||
'cfdi_tax_locales': Configuracion.get_bool('chk_config_tax_locales'),
|
||||
'cfdi_tax_decimals': Configuracion.get_bool('chk_config_tax_decimals'),
|
||||
'cfdi_with_taxes': Configuracion.get_bool('chk_config_price_with_taxes_in_invoice'),
|
||||
'cfdi_add_same_product': Configuracion.get_bool('chk_config_add_same_product'),
|
||||
}
|
||||
|
||||
return conf
|
||||
|
@ -333,6 +334,7 @@ class Configuracion(BaseModel):
|
|||
'chk_config_tax_locales',
|
||||
'chk_config_tax_decimals',
|
||||
'chk_config_price_with_taxes_in_invoice',
|
||||
'chk_config_add_same_product',
|
||||
'chk_config_anticipo',
|
||||
'chk_config_cuenta_predial',
|
||||
'chk_config_codigo_barras',
|
||||
|
@ -2748,7 +2750,7 @@ class Productos(BaseModel):
|
|||
clave = values.get('key', '')
|
||||
row = (Productos
|
||||
.select(
|
||||
Productos.id,
|
||||
Productos.id.alias('id_product'),
|
||||
Productos.clave,
|
||||
Productos.clave_sat,
|
||||
Productos.descripcion,
|
||||
|
@ -2761,7 +2763,7 @@ class Productos(BaseModel):
|
|||
.dicts()
|
||||
)
|
||||
if len(row):
|
||||
id = row[0]['id']
|
||||
id = row[0]['id_product']
|
||||
model_pt = Productos.impuestos.get_through_model()
|
||||
taxes = tuple(model_pt
|
||||
.select(
|
||||
|
@ -3567,8 +3569,7 @@ class Facturas(BaseModel):
|
|||
locales_retenciones = 0
|
||||
|
||||
for product in products:
|
||||
# ~ print ('\n', product['descripcion'])
|
||||
id_product = product.pop('id')
|
||||
id_product = product.pop('id_product')
|
||||
id_student = product.pop('id_student', 0)
|
||||
p = Productos.get(Productos.id==id_product)
|
||||
|
||||
|
@ -4467,7 +4468,7 @@ class PreFacturas(BaseModel):
|
|||
locales_retenciones = 0
|
||||
|
||||
for product in products:
|
||||
id_product = product.pop('id')
|
||||
id_product = product.pop('id_product')
|
||||
p = Productos.get(Productos.id==id_product)
|
||||
|
||||
product['unidad'] = p.unidad.key
|
||||
|
@ -4717,7 +4718,7 @@ class PreFacturasDetalle(BaseModel):
|
|||
PreFacturasDetalle.factura==id)
|
||||
|
||||
for p in reversed(productos):
|
||||
row = {'id': p.producto.id}
|
||||
row = {'id_product': p.producto.id}
|
||||
row['clave'] = p.producto.clave
|
||||
row['descripcion'] = p.descripcion
|
||||
row['unidad'] = p.producto.unidad.name
|
||||
|
@ -4726,7 +4727,7 @@ class PreFacturasDetalle(BaseModel):
|
|||
row['descuento'] = p.descuento
|
||||
pf = p.valor_unitario - p.descuento
|
||||
row['importe'] = round(pf * p.cantidad, DECIMALES)
|
||||
impuestos = cls._get_impuestos(cls, row['id'])
|
||||
impuestos = cls._get_impuestos(cls, row['id_product'])
|
||||
data.append({'row': row, 'taxes': impuestos})
|
||||
|
||||
return {'rows': data, 'receptor': receptor}
|
||||
|
|
|
@ -63,6 +63,7 @@ var controllers = {
|
|||
$$('chk_config_tax_locales').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_config_tax_decimals').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_config_price_with_taxes_in_invoice').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_config_add_same_product').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_config_anticipo').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_config_ine').attachEvent('onItemClick', chk_config_item_click)
|
||||
$$('chk_config_edu').attachEvent('onItemClick', chk_config_item_click)
|
||||
|
|
|
@ -167,6 +167,7 @@ function default_config(){
|
|||
cfg_invoice['tax_locales'] = values.cfdi_tax_locales
|
||||
cfg_invoice['tax_decimals'] = values.cfdi_tax_decimals
|
||||
cfg_invoice['with_taxes'] = values.cfdi_with_taxes
|
||||
cfg_invoice['add_same_product'] = values.cfdi_add_same_product
|
||||
if(values.cfdi_show_pedimento){
|
||||
$$('grid_details').showColumn('pedimento')
|
||||
}
|
||||
|
@ -558,6 +559,7 @@ function guardar_y_timbrar(values){
|
|||
|
||||
var rows = grid.data.getRange()
|
||||
for (i = 0; i < rows.length; i++) {
|
||||
delete rows[i]['id']
|
||||
delete rows[i]['delete']
|
||||
delete rows[i]['clave']
|
||||
delete rows[i]['clave_sat']
|
||||
|
@ -808,7 +810,7 @@ function calcular_impuestos(){
|
|||
var import2 = (valor_unitario * cantidad).round(DECIMALES)
|
||||
var importe = parseFloat(product.importe)
|
||||
subtotal += importe
|
||||
query = table_pt.chain().find({'product': product.id}).data()
|
||||
query = table_pt.chain().find({'product': product.id_product}).data()
|
||||
for(var tax of query){
|
||||
impuesto = table_taxes.findOne({'id': tax.tax})
|
||||
if(impuesto.tipo == 'E'){
|
||||
|
@ -867,7 +869,16 @@ function set_product(values){
|
|||
var taxes = values.taxes
|
||||
var values = values.row
|
||||
var form = $$('form_invoice')
|
||||
var row = grid.getItem(values.id)
|
||||
var row = undefined
|
||||
|
||||
if(!cfg_invoice['add_same_product']){
|
||||
for(var id in grid.data.pull){
|
||||
if(grid.getItem(id).id_product == values.id_product){
|
||||
row = grid.getItem(id)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
values['delete'] = '-'
|
||||
if (row == undefined){
|
||||
|
@ -1358,6 +1369,7 @@ function cmd_prefactura_click(){
|
|||
|
||||
var rows = grid.data.getRange()
|
||||
for (i = 0; i < rows.length; i++) {
|
||||
delete rows[i]['id']
|
||||
delete rows[i]['delete']
|
||||
delete rows[i]['clave']
|
||||
delete rows[i]['unidad']
|
||||
|
|
|
@ -599,6 +599,8 @@ var options_admin_otros = [
|
|||
labelRight: 'Calcular impuestos con 4 decimales'},
|
||||
{view: 'checkbox', id: 'chk_config_price_with_taxes_in_invoice', labelWidth: 0,
|
||||
labelRight: 'Precio incluye impuestos'},
|
||||
{view: 'checkbox', id: 'chk_config_add_same_product', labelWidth: 0,
|
||||
labelRight: 'Permitir agregar el mismo producto'},
|
||||
]},
|
||||
{maxHeight: 20},
|
||||
{template: 'Ayudas varias', type: 'section'},
|
||||
|
|
|
@ -277,7 +277,7 @@ var grid_invoices = {
|
|||
|
||||
|
||||
var grid_details_cols = [
|
||||
{id: "id", header:"ID", hidden: true},
|
||||
{id: 'id_product', header: 'id_product', hidden: true},
|
||||
{id: 'delete', header: '', width: 30, css: 'delete'},
|
||||
{id: "clave", header:{text: 'Clave', css: 'center'}, width: 100,
|
||||
adjust: 'data'},
|
||||
|
|
Loading…
Reference in New Issue