mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-01 07:37:04 +00:00
refactor: parse native JSON request args in stock/doctype/pick_list/mapper.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:
@@ -113,8 +113,7 @@ def create_dn_for_pick_lists(
|
|||||||
"""Get Items from Multiple Pick Lists and create a Delivery Note for filtered customer"""
|
"""Get Items from Multiple Pick Lists and create a Delivery Note for filtered customer"""
|
||||||
if kwargs is None:
|
if kwargs is None:
|
||||||
kwargs = {}
|
kwargs = {}
|
||||||
if isinstance(kwargs, str):
|
kwargs = frappe.parse_json(kwargs)
|
||||||
kwargs = json.loads(kwargs)
|
|
||||||
|
|
||||||
pick_list = frappe.get_doc("Pick List", source_name)
|
pick_list = frappe.get_doc("Pick List", source_name)
|
||||||
validate_item_locations(pick_list)
|
validate_item_locations(pick_list)
|
||||||
@@ -282,8 +281,8 @@ def add_product_bundles_to_target(pick_list, target_doc, item_mapper, sales_orde
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def create_stock_entry(pick_list: str):
|
def create_stock_entry(pick_list: str | dict):
|
||||||
pick_list = frappe.get_doc(json.loads(pick_list))
|
pick_list = frappe.get_doc(frappe.parse_json(pick_list))
|
||||||
validate_item_locations(pick_list)
|
validate_item_locations(pick_list)
|
||||||
|
|
||||||
if stock_entry_exists(pick_list.get("name")):
|
if stock_entry_exists(pick_list.get("name")):
|
||||||
|
|||||||
Reference in New Issue
Block a user