fix: get scripts api

(cherry picked from commit b03abdd2eb523e17b62c34a5e2610387480c3847)
This commit is contained in:
Shariq Ansari 2025-05-01 17:22:26 +05:30 committed by Mergify
parent c521ec299b
commit d1a15e97f1

17
crm/api/script.py Normal file
View File

@ -0,0 +1,17 @@
import frappe
from pypika import Criterion
@frappe.whitelist()
def get_scripts(doctype, view="Form"):
Script = frappe.qb.DocType("CRM Form Script")
query = (
frappe.qb.from_(Script)
.select("*")
.where(Script.dt == doctype)
.where(Script.view == view)
.where(Script.enabled == 1)
)
scripts = query.run(as_dict=True)
return scripts