forked from elmau/empresa-libre
Filtro de facturas incluye cliente
This commit is contained in:
parent
8d7b42e368
commit
da41bb272e
|
@ -3,6 +3,7 @@ v 1.28.0 [17-feb-2019]
|
|||
- Mejora: Manejo de empaques para mensajeria
|
||||
- Mejora: Usar concepto personalizado en deducciones de nómina 004 Otros
|
||||
- Mejora: Búsqueda en notas
|
||||
- Mejora: Soporte para el complemento de Divisas
|
||||
|
||||
* IMPORTANTE:
|
||||
Es necesario realizar una migración, despues de actualizar.
|
||||
|
|
|
@ -3741,11 +3741,7 @@ class Facturas(BaseModel):
|
|||
|
||||
return filters
|
||||
|
||||
def _get_by_notes(self, filters):
|
||||
notes = filters['notes']
|
||||
filters = self._get_filters(self, filters)
|
||||
filters &= (Facturas.notas.contains(notes))
|
||||
|
||||
def _get_invoices(self, filters):
|
||||
rows = tuple(Facturas.select(
|
||||
Facturas.id,
|
||||
Facturas.serie,
|
||||
|
@ -3766,9 +3762,18 @@ class Facturas(BaseModel):
|
|||
.join(Socios)
|
||||
.switch(Facturas).dicts()
|
||||
)
|
||||
|
||||
return {'ok': True, 'rows': rows}
|
||||
|
||||
def _get_by_dates(self, filters):
|
||||
filters = self._get_filters(self, filters)
|
||||
return self._get_invoices(self, filters)
|
||||
|
||||
def _get_by_notes(self, filters):
|
||||
notes = filters['notes']
|
||||
filters = self._get_filters(self, filters)
|
||||
filters &= (Facturas.notas.contains(notes))
|
||||
return self._get_invoices(self, filters)
|
||||
|
||||
@classmethod
|
||||
def get_by(cls, filters):
|
||||
return getattr(cls, f"_get_by_{filters['by']}")(cls, filters)
|
||||
|
|
|
@ -1381,20 +1381,23 @@ function cmd_invoice_cancelar_click(){
|
|||
}
|
||||
|
||||
|
||||
function get_invoices(rango){
|
||||
if(rango == undefined){
|
||||
var fy = $$('filter_year')
|
||||
var fm = $$('filter_month')
|
||||
function get_filters_invoices(){
|
||||
var filters = $$('filter_dates').getValue()
|
||||
filters['year'] = $$('filter_year').getValue()
|
||||
filters['month'] = $$('filter_month').getValue()
|
||||
filters['client'] = $$('grid_invoices').getFilter('cliente').value
|
||||
return filters
|
||||
}
|
||||
|
||||
var y = fy.getValue()
|
||||
var m = fm.getValue()
|
||||
rango = {'year': y, 'month': m}
|
||||
}
|
||||
|
||||
function get_invoices(){
|
||||
var filters = get_filters_invoices()
|
||||
filters['by'] = 'dates'
|
||||
|
||||
var grid = $$('grid_invoices')
|
||||
grid.showProgress({type: 'icon'})
|
||||
|
||||
webix.ajax().get('/invoices', rango, {
|
||||
webix.ajax().get('/invoices', filters, {
|
||||
error: function(text, data, xhr) {
|
||||
msg_error('Error al consultar')
|
||||
},
|
||||
|
@ -1421,7 +1424,7 @@ function filter_month_change(nv, ov){
|
|||
|
||||
function filter_dates_change(range){
|
||||
if(range.start != null && range.end != null){
|
||||
get_invoices(range)
|
||||
get_invoices()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2272,15 +2275,6 @@ function txt_folio_custom_lost_focus(prev){
|
|||
}
|
||||
|
||||
|
||||
function get_filters_invoices(){
|
||||
var filters = $$('filter_dates').getValue()
|
||||
filters['year'] = $$('filter_year').getValue()
|
||||
filters['month'] = $$('filter_month').getValue()
|
||||
filters['client'] = $$('grid_invoices').getFilter('cliente').value
|
||||
return filters
|
||||
}
|
||||
|
||||
|
||||
function search_by(value){
|
||||
var filters = get_filters_invoices()
|
||||
filters['by'] = 'notes'
|
||||
|
|
Loading…
Reference in New Issue