mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-03 08:32:24 +00:00
refactor: parse native JSON request args in stock/get_item_details.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:
@@ -90,8 +90,7 @@ def get_item_details(
|
|||||||
item = frappe.get_cached_doc("Item", ctx.item_code)
|
item = frappe.get_cached_doc("Item", ctx.item_code)
|
||||||
validate_item_details(ctx, item)
|
validate_item_details(ctx, item)
|
||||||
|
|
||||||
if isinstance(doc, str):
|
doc = frappe.parse_json(doc)
|
||||||
doc = json.loads(doc)
|
|
||||||
|
|
||||||
if doc:
|
if doc:
|
||||||
ctx.transaction_date = doc.get("transaction_date") or doc.get("posting_date")
|
ctx.transaction_date = doc.get("transaction_date") or doc.get("posting_date")
|
||||||
|
|||||||
Reference in New Issue
Block a user