refactor: parse native JSON request args in manufacturing/doctype/production_plan/services/planning_queries.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 3946bf5366
commit e14719b0ad

View File

@@ -24,8 +24,7 @@ def get_bin_details(
):
frappe.has_permission("Production Plan", "read", throw=True)
if isinstance(row, str):
row = frappe._dict(json.loads(row))
row = frappe._dict(frappe.parse_json(row))
bin = frappe.qb.DocType("Bin")
subquery = _bin_warehouse_subquery(bin, company, row, for_warehouse, all_warehouse)
@@ -65,8 +64,7 @@ def _bin_qty_columns(bin):
def get_warehouse_list(warehouses):
warehouse_list = []
if isinstance(warehouses, str):
warehouses = json.loads(warehouses)
warehouses = frappe.parse_json(warehouses)
for row in warehouses:
child_warehouses = frappe.db.get_descendants("Warehouse", row.get("warehouse"))