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