refactor: parse native JSON request args in manufacturing/doctype/job_card/job_card.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 5a1abf6138
commit 6b1e18f79e

View File

@@ -1685,8 +1685,7 @@ class JobCard(Document):
@frappe.whitelist()
def make_time_log(kwargs: str | dict):
if isinstance(kwargs, str):
kwargs = json.loads(kwargs)
kwargs = frappe.parse_json(kwargs)
kwargs = frappe._dict(kwargs)
doc = frappe.get_doc("Job Card", kwargs.job_card_id)
@@ -1761,8 +1760,7 @@ def get_job_card_filter_conditions(jc, filters):
Replaces the previous raw SQL ``get_filters_cond`` based filtering so that all
user supplied values are passed as bound parameters via the query builder.
"""
if isinstance(filters, str):
filters = json.loads(filters)
filters = frappe.parse_json(filters)
if not filters:
return []