mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
fix: handle an empty match query condition in leave application (#16931)
This commit is contained in:
committed by
Deepesh Garg
parent
40046721b2
commit
7fc1bc0b27
@@ -505,8 +505,6 @@ def add_department_leaves(events, start, end, employee, company):
|
|||||||
def add_leaves(events, start, end, filter_conditions=None):
|
def add_leaves(events, start, end, filter_conditions=None):
|
||||||
conditions = []
|
conditions = []
|
||||||
|
|
||||||
if filter_conditions:
|
|
||||||
conditions.append(filter_conditions)
|
|
||||||
|
|
||||||
if not cint(frappe.db.get_value("HR Settings", None, "show_leaves_of_all_department_members_in_calendar")):
|
if not cint(frappe.db.get_value("HR Settings", None, "show_leaves_of_all_department_members_in_calendar")):
|
||||||
from frappe.desk.reportview import build_match_conditions
|
from frappe.desk.reportview import build_match_conditions
|
||||||
@@ -520,11 +518,14 @@ def add_leaves(events, start, end, filter_conditions=None):
|
|||||||
from `tabLeave Application` where
|
from `tabLeave Application` where
|
||||||
from_date <= %(end)s and to_date >= %(start)s <= to_date
|
from_date <= %(end)s and to_date >= %(start)s <= to_date
|
||||||
and docstatus < 2
|
and docstatus < 2
|
||||||
and status!="Rejected" """
|
and status!='Rejected' """
|
||||||
|
|
||||||
if conditions:
|
if conditions:
|
||||||
query += ' and ' + ' and '.join(conditions)
|
query += ' and ' + ' and '.join(conditions)
|
||||||
|
|
||||||
|
if filter_conditions:
|
||||||
|
query += filter_conditions
|
||||||
|
|
||||||
for d in frappe.db.sql(query, {"start":start, "end": 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,
|
||||||
|
|||||||
Reference in New Issue
Block a user