mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-26 13:25:20 +00:00
refactor: parse native JSON request args in selling/doctype/sales_order/sales_order.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:
@@ -711,11 +711,11 @@ def is_enable_cutoff_date_on_bulk_delivery_note_creation():
|
|||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def close_or_unclose_sales_orders(names: str, status: str):
|
def close_or_unclose_sales_orders(names: str | list, status: str):
|
||||||
if not frappe.has_permission("Sales Order", "write"):
|
if not frappe.has_permission("Sales Order", "write"):
|
||||||
frappe.throw(_("Not permitted"), frappe.PermissionError)
|
frappe.throw(_("Not permitted"), frappe.PermissionError)
|
||||||
|
|
||||||
names = json.loads(names)
|
names = frappe.parse_json(names)
|
||||||
for name in names:
|
for name in names:
|
||||||
so = frappe.get_lazy_doc("Sales Order", name)
|
so = frappe.get_lazy_doc("Sales Order", name)
|
||||||
if so.docstatus == 1:
|
if so.docstatus == 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user