mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-14 09:23:09 +00:00
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:
@@ -24,8 +24,7 @@ def get_bin_details(
|
|||||||
):
|
):
|
||||||
frappe.has_permission("Production Plan", "read", throw=True)
|
frappe.has_permission("Production Plan", "read", throw=True)
|
||||||
|
|
||||||
if isinstance(row, str):
|
row = frappe._dict(frappe.parse_json(row))
|
||||||
row = frappe._dict(json.loads(row))
|
|
||||||
|
|
||||||
bin = frappe.qb.DocType("Bin")
|
bin = frappe.qb.DocType("Bin")
|
||||||
subquery = _bin_warehouse_subquery(bin, company, row, for_warehouse, all_warehouse)
|
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):
|
def get_warehouse_list(warehouses):
|
||||||
warehouse_list = []
|
warehouse_list = []
|
||||||
|
|
||||||
if isinstance(warehouses, str):
|
warehouses = frappe.parse_json(warehouses)
|
||||||
warehouses = json.loads(warehouses)
|
|
||||||
|
|
||||||
for row in warehouses:
|
for row in warehouses:
|
||||||
child_warehouses = frappe.db.get_descendants("Warehouse", row.get("warehouse"))
|
child_warehouses = frappe.db.get_descendants("Warehouse", row.get("warehouse"))
|
||||||
|
|||||||
Reference in New Issue
Block a user