[fix] calendar range fixes
This commit is contained in:
parent
eb2a98faca
commit
bb79fc5b0c
@ -408,13 +408,13 @@ def add_leaves(events, start, end, match_conditions=None):
|
||||
query = """select name, from_date, to_date, employee_name, half_day,
|
||||
status, employee, docstatus
|
||||
from `tabLeave Application` where
|
||||
(from_date between %s and %s or to_date between %s and %s)
|
||||
from_date <= %(end)s and to_date >= %(start)s <= to_date
|
||||
and docstatus < 2
|
||||
and status!="Rejected" """
|
||||
if match_conditions:
|
||||
query += " and " + match_conditions
|
||||
|
||||
for d in frappe.db.sql(query, (start, end, start, end), as_dict=True):
|
||||
for d in frappe.db.sql(query, {"start":start, "end": end}, as_dict=True):
|
||||
e = {
|
||||
"name": d.name,
|
||||
"doctype": "Leave Application",
|
||||
|
@ -523,9 +523,9 @@ def get_events(start, end, filters=None):
|
||||
planned_end_date, status
|
||||
from `tabProduction Order`
|
||||
where ((ifnull(planned_start_date, '0000-00-00')!= '0000-00-00') \
|
||||
and (planned_start_date between %(start)s and %(end)s) \
|
||||
or ((ifnull(planned_start_date, '0000-00-00')!= '0000-00-00') \
|
||||
and planned_end_date between %(start)s and %(end)s)) {conditions}
|
||||
and (planned_start_date <= %(end)s) \
|
||||
and ((ifnull(planned_start_date, '0000-00-00')!= '0000-00-00') \
|
||||
and planned_end_date >= %(start)s)) {conditions}
|
||||
""".format(conditions=conditions), {
|
||||
"start": start,
|
||||
"end": end
|
||||
|
@ -133,9 +133,9 @@ def get_events(start, end, filters=None):
|
||||
data = frappe.db.sql("""select name, exp_start_date, exp_end_date,
|
||||
subject, status, project from `tabTask`
|
||||
where ((ifnull(exp_start_date, '0000-00-00')!= '0000-00-00') \
|
||||
and (exp_start_date between %(start)s and %(end)s) \
|
||||
or ((ifnull(exp_start_date, '0000-00-00')!= '0000-00-00') \
|
||||
and exp_end_date between %(start)s and %(end)s))
|
||||
and (exp_start_date <= %(end)s) \
|
||||
or ((ifnull(exp_end_date, '0000-00-00')!= '0000-00-00') \
|
||||
and exp_end_date >= %(start)s))
|
||||
{conditions}""".format(conditions=conditions), {
|
||||
"start": start,
|
||||
"end": end
|
||||
|
@ -369,11 +369,11 @@ def get_events(start, end, filters=None):
|
||||
conditions = get_conditions(filters)
|
||||
return frappe.db.sql("""select `tabTimesheet Detail`.name as name,
|
||||
`tabTimesheet Detail`.docstatus as status, `tabTimesheet Detail`.parent as parent,
|
||||
from_time as start_date, hours, activity_type, project, to_time as end_date
|
||||
from_time, hours, activity_type, project, to_time
|
||||
from `tabTimesheet Detail`, `tabTimesheet`
|
||||
where `tabTimesheet Detail`.parent = `tabTimesheet`.name
|
||||
and `tabTimesheet`.docstatus < 2
|
||||
and (from_time between %(start)s and %(end)s) {conditions} {match_cond}
|
||||
and (from_time <= %(end)s and to_time >= %(start)s) {conditions} {match_cond}
|
||||
""".format(conditions=conditions, match_cond = get_match_cond('Timesheet')),
|
||||
{
|
||||
"start": start,
|
||||
|
@ -1,7 +1,7 @@
|
||||
frappe.views.calendar["Timesheet"] = {
|
||||
field_map: {
|
||||
"start": "start_date",
|
||||
"end": "end_date",
|
||||
"start": "from_time",
|
||||
"end": "to_time",
|
||||
"name": "parent",
|
||||
"id": "name",
|
||||
"title": "name",
|
||||
|
Loading…
Reference in New Issue
Block a user