mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 15:11:52 +00:00
refactor: parse native JSON request args in buying/doctype/purchase_order/purchase_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:
@@ -549,11 +549,11 @@ def item_last_purchase_rate(name, conversion_rate, item_code, conversion_factor=
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def close_or_unclose_purchase_orders(names: str, status: str):
|
||||
def close_or_unclose_purchase_orders(names: str | list, status: str):
|
||||
if not frappe.has_permission("Purchase Order", "write"):
|
||||
frappe.throw(_("Not permitted"), frappe.PermissionError)
|
||||
|
||||
names = json.loads(names)
|
||||
names = frappe.parse_json(names)
|
||||
for name in names:
|
||||
po = frappe.get_lazy_doc("Purchase Order", name)
|
||||
if po.docstatus == 1:
|
||||
|
||||
Reference in New Issue
Block a user