mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
[Fix] Filter on child table not working in Calendar (#11824)
* use the new get_events method * using the common get_events method for calendar_view * using add_fetch to fill customer_name
This commit is contained in:
@@ -148,30 +148,6 @@ def check_if_child_exists(name):
|
||||
return frappe.db.sql("""select name from `tabTask`
|
||||
where parent_task = %s""", name)
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_events(start, end, filters=None):
|
||||
"""Returns events for Gantt / Calendar view rendering.
|
||||
|
||||
:param start: Start date-time.
|
||||
:param end: End date-time.
|
||||
:param filters: Filters (JSON).
|
||||
"""
|
||||
from frappe.desk.calendar import get_event_conditions
|
||||
conditions = get_event_conditions("Task", filters)
|
||||
|
||||
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 <= %(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
|
||||
}, as_dict=True, update={"allDay": 0})
|
||||
|
||||
return data
|
||||
|
||||
def get_project(doctype, txt, searchfield, start, page_len, filters):
|
||||
from erpnext.controllers.queries import get_match_cond
|
||||
return frappe.db.sql(""" select name from `tabProject`
|
||||
|
||||
@@ -19,5 +19,5 @@ frappe.views.calendar["Task"] = {
|
||||
"label": __("Project")
|
||||
}
|
||||
],
|
||||
get_events_method: "erpnext.projects.doctype.task.task.get_events"
|
||||
get_events_method: "frappe.desk.calendar.get_events"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user