mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-30 15:09:47 +00:00
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:
@@ -111,8 +111,7 @@ def apply_putaway_rule(
|
|||||||
purpose: Purpose of Stock Entry
|
purpose: Purpose of Stock Entry
|
||||||
sync (optional): Sync with client side only for client side calls
|
sync (optional): Sync with client side only for client side calls
|
||||||
"""
|
"""
|
||||||
if isinstance(items, str):
|
items = frappe.parse_json(items)
|
||||||
items = json.loads(items)
|
|
||||||
|
|
||||||
items_not_accomodated, updated_table = [], []
|
items_not_accomodated, updated_table = [], []
|
||||||
item_wise_rules = defaultdict(list)
|
item_wise_rules = defaultdict(list)
|
||||||
@@ -198,7 +197,7 @@ def apply_putaway_rule(
|
|||||||
frappe.msgprint(_("Applied putaway rules."), alert=True)
|
frappe.msgprint(_("Applied putaway rules."), alert=True)
|
||||||
return updated_table
|
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
|
return items
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user