From 226ea7db8883e9e014f2ade9438de771291eef9a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 8 May 2017 17:34:07 +0530 Subject: [PATCH] Filter issue on timesheet calendar view (#8730) --- erpnext/projects/doctype/timesheet/timesheet.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.py b/erpnext/projects/doctype/timesheet/timesheet.py index 490a70721a..154f0d0f20 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.py +++ b/erpnext/projects/doctype/timesheet/timesheet.py @@ -382,9 +382,13 @@ def get_events(start, end, filters=None): def get_conditions(filters): conditions = [] - abbr = {'employee': 'tabTimesheet', 'project': 'tabTimesheet Detail'} for key in filters: if filters.get(key): - conditions.append("`%s`.%s = '%s'"%(abbr.get(key), key, filters.get(key))) + if frappe.get_meta("Timesheet").has_field(key): + dt = 'tabTimesheet' + elif frappe.get_meta("Timesheet Detail").has_field(key): + dt = 'tabTimesheet Detail' + + conditions.append("`%s`.%s = '%s'"%(dt, key, filters.get(key))) return " and {}".format(" and ".join(conditions)) if conditions else ""