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.
This commit is contained in:
Mihir Kandoi
2026-06-24 20:37:35 +05:30
parent a11eb741e5
commit 8ca2e99cf2

View File

@@ -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