Filtro por rango de fechas en facturas
This commit is contained in:
parent
2f62a2debe
commit
63c7b4e458
|
@ -1036,6 +1036,13 @@ def get_path_temp():
|
||||||
return tempfile.mkstemp()[1]
|
return tempfile.mkstemp()[1]
|
||||||
|
|
||||||
|
|
||||||
|
def get_date(value, next_day=False):
|
||||||
|
d = parser.parse(value)
|
||||||
|
if next_day:
|
||||||
|
return d + datetime.timedelta(days=1)
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
class ImportFacturaLibre(object):
|
class ImportFacturaLibre(object):
|
||||||
|
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
|
|
|
@ -1187,10 +1187,11 @@ class Facturas(BaseModel):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_(cls, values):
|
def get_(cls, values):
|
||||||
print (values)
|
if 'start' in values:
|
||||||
|
filters = Facturas.fecha.between(
|
||||||
if 'dates' in values:
|
util.get_date(values['start']),
|
||||||
print (values)
|
util.get_date(values['end'], True)
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
if values['year'] == '-1':
|
if values['year'] == '-1':
|
||||||
fy = (Facturas.fecha.year > 0)
|
fy = (Facturas.fecha.year > 0)
|
||||||
|
@ -1200,8 +1201,7 @@ class Facturas(BaseModel):
|
||||||
fm = (Facturas.fecha.month > 0)
|
fm = (Facturas.fecha.month > 0)
|
||||||
else:
|
else:
|
||||||
fm = (Facturas.fecha.month == int(values['month']))
|
fm = (Facturas.fecha.month == int(values['month']))
|
||||||
|
filters = (fy & fm)
|
||||||
filters = (fy & fm)
|
|
||||||
|
|
||||||
rows = tuple(Facturas
|
rows = tuple(Facturas
|
||||||
.select(Facturas.id, Facturas.serie, Facturas.folio, Facturas.uuid,
|
.select(Facturas.id, Facturas.serie, Facturas.folio, Facturas.uuid,
|
||||||
|
|
|
@ -771,5 +771,7 @@ function filter_month_change(nv, ov){
|
||||||
|
|
||||||
|
|
||||||
function filter_dates_change(range){
|
function filter_dates_change(range){
|
||||||
show(range)
|
if(range.start != null && range.end != null){
|
||||||
|
get_invoices(range)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ var toolbar_invoices_filter = [
|
||||||
{view: 'richselect', id: 'filter_month', label: 'Mes', labelAlign: 'right',
|
{view: 'richselect', id: 'filter_month', label: 'Mes', labelAlign: 'right',
|
||||||
labelWidth: 50, width: 200, options: months},
|
labelWidth: 50, width: 200, options: months},
|
||||||
{view: 'daterangepicker', id: 'filter_dates', label: 'Fechas',
|
{view: 'daterangepicker', id: 'filter_dates', label: 'Fechas',
|
||||||
labelAlign: 'right', width: 300, hidden: true},
|
labelAlign: 'right', width: 300},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue