From 8ca2e99cf22c98be290ffcbaf9da5fbe3e3d6811 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Wed, 24 Jun 2026 20:37:35 +0530 Subject: [PATCH] refactor: parse native JSON request args in stock/doctype/putaway_rule/putaway_rule.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. --- erpnext/stock/doctype/putaway_rule/putaway_rule.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/putaway_rule/putaway_rule.py b/erpnext/stock/doctype/putaway_rule/putaway_rule.py index b7dacb9c230..4f5967654ac 100644 --- a/erpnext/stock/doctype/putaway_rule/putaway_rule.py +++ b/erpnext/stock/doctype/putaway_rule/putaway_rule.py @@ -111,8 +111,7 @@ def apply_putaway_rule( purpose: Purpose of Stock Entry sync (optional): Sync with client side only for client side calls """ - if isinstance(items, str): - items = json.loads(items) + items = frappe.parse_json(items) items_not_accomodated, updated_table = [], [] item_wise_rules = defaultdict(list) @@ -198,7 +197,7 @@ def apply_putaway_rule( frappe.msgprint(_("Applied putaway rules."), alert=True) return updated_table - if sync and json.loads(sync): # sync with client side + if sync and frappe.parse_json(sync): # sync with client side return items