From d1a15e97f103de62f011ee3906f67696f270c59d Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Thu, 1 May 2025 17:22:26 +0530 Subject: [PATCH] fix: get scripts api (cherry picked from commit b03abdd2eb523e17b62c34a5e2610387480c3847) --- crm/api/script.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 crm/api/script.py diff --git a/crm/api/script.py b/crm/api/script.py new file mode 100644 index 00000000..bfbfa405 --- /dev/null +++ b/crm/api/script.py @@ -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