refactor: parse native JSON request args in projects/doctype/timesheet/timesheet.py

Use frappe.parse_json instead of json.loads so the whitelisted endpoints
accept native JSON types (list/dict/bool) in addition to JSON strings.
This commit is contained in:
Mihir Kandoi
2026-06-24 20:37:33 +05:30
parent 5629f81809
commit cb236dedfc

View File

@@ -497,7 +497,7 @@ def get_activity_cost(
@frappe.whitelist()
def get_events(start: str, end: str, filters: str | None = None):
def get_events(start: str, end: str, filters: str | dict | None = None):
"""Returns events for Gantt / Calendar view rendering.
:param start: Start date-time.
:param end: End date-time.
@@ -505,7 +505,7 @@ def get_events(start: str, end: str, filters: str | None = None):
"""
from erpnext.utilities.query import get_event_conditions_qb
filters = json.loads(filters) if filters else {}
filters = frappe.parse_json(filters) if filters else {}
tsd = frappe.qb.DocType("Timesheet Detail")
ts = frappe.qb.DocType("Timesheet")