fix: removed unnessary permission check
This commit is contained in:
parent
951494a21c
commit
2e577db7cb
@ -5,8 +5,6 @@ from frappe.utils.safe_exec import get_safe_globals
|
|||||||
from frappe.utils import now_datetime
|
from frappe.utils import now_datetime
|
||||||
from pypika import Criterion
|
from pypika import Criterion
|
||||||
|
|
||||||
DOCTYPE = "CRM Service Level Agreement"
|
|
||||||
|
|
||||||
def get_sla(doc: Document) -> Document:
|
def get_sla(doc: Document) -> Document:
|
||||||
"""
|
"""
|
||||||
Get Service Level Agreement for `doc`
|
Get Service Level Agreement for `doc`
|
||||||
@ -14,8 +12,7 @@ def get_sla(doc: Document) -> Document:
|
|||||||
:param doc: Lead/Deal to use
|
:param doc: Lead/Deal to use
|
||||||
:return: Applicable SLA
|
:return: Applicable SLA
|
||||||
"""
|
"""
|
||||||
check_permissions(DOCTYPE, None)
|
SLA = frappe.qb.DocType("CRM Service Level Agreement")
|
||||||
SLA = frappe.qb.DocType(DOCTYPE)
|
|
||||||
Priority = frappe.qb.DocType("CRM Service Level Priority")
|
Priority = frappe.qb.DocType("CRM Service Level Priority")
|
||||||
now = now_datetime()
|
now = now_datetime()
|
||||||
priority = doc.communication_status
|
priority = doc.communication_status
|
||||||
@ -50,17 +47,6 @@ def get_sla(doc: Document) -> Document:
|
|||||||
break
|
break
|
||||||
return res
|
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:
|
def get_context(d: Document) -> dict:
|
||||||
"""
|
"""
|
||||||
Get safe context for `safe_eval`
|
Get safe context for `safe_eval`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user