mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-15 09:53:09 +00:00
refactor: parse native JSON request args in utilities/bulk_transaction.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:
@@ -13,13 +13,9 @@ def transaction_processing(
|
|||||||
frappe.has_permission(from_doctype, "read", throw=True)
|
frappe.has_permission(from_doctype, "read", throw=True)
|
||||||
frappe.has_permission(to_doctype, "create", throw=True)
|
frappe.has_permission(to_doctype, "create", throw=True)
|
||||||
|
|
||||||
if isinstance(data, str):
|
deserialized_data = frappe.parse_json(data)
|
||||||
deserialized_data = json.loads(data)
|
|
||||||
else:
|
|
||||||
deserialized_data = data
|
|
||||||
|
|
||||||
if isinstance(args, str):
|
args = frappe._dict(frappe.parse_json(args))
|
||||||
args = frappe._dict(json.loads(args))
|
|
||||||
|
|
||||||
skipped_records = [d for d in deserialized_data if d.get("status") in ("On Hold", "Closed")]
|
skipped_records = [d for d in deserialized_data if d.get("status") in ("On Hold", "Closed")]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user