1
0
forked from test/crm

fix: removed unnessary permission check

This commit is contained in:
Shariq Ansari 2024-03-19 22:31:20 +05:30
parent 951494a21c
commit 2e577db7cb

View File

@ -5,8 +5,6 @@ from frappe.utils.safe_exec import get_safe_globals
from frappe.utils import now_datetime
from pypika import Criterion
DOCTYPE = "CRM Service Level Agreement"
def get_sla(doc: Document) -> Document:
"""
Get Service Level Agreement for `doc`
@ -14,8 +12,7 @@ def get_sla(doc: Document) -> Document:
:param doc: Lead/Deal to use
:return: Applicable SLA
"""
check_permissions(DOCTYPE, None)
SLA = frappe.qb.DocType(DOCTYPE)
SLA = frappe.qb.DocType("CRM Service Level Agreement")
Priority = frappe.qb.DocType("CRM Service Level Priority")
now = now_datetime()
priority = doc.communication_status
@ -50,17 +47,6 @@ def get_sla(doc: Document) -> Document:
break
return res
def check_permissions(doctype, parent):
user = frappe.session.user
permissions = ("select", "read")
has_select_permission, has_read_permission = [
frappe.has_permission(doctype, perm, user=user, parent_doctype=parent)
for perm in permissions
]
if not has_select_permission and not has_read_permission:
frappe.throw(f"Insufficient Permission for {doctype}", frappe.PermissionError)
def get_context(d: Document) -> dict:
"""
Get safe context for `safe_eval`