fix: set/apply sla only if sla is enabled
This commit is contained in:
parent
346310a878
commit
512783e7af
@ -55,16 +55,19 @@ class CRMDeal(Document):
|
||||
"""
|
||||
Find an SLA to apply to the deal.
|
||||
"""
|
||||
if sla := get_sla("CRM Deal"):
|
||||
if not sla:
|
||||
return
|
||||
self.sla = sla.name
|
||||
sla = get_sla("CRM Deal")
|
||||
if not sla:
|
||||
return
|
||||
self.sla = sla.name
|
||||
|
||||
def apply_sla(self):
|
||||
"""
|
||||
Apply SLA if set.
|
||||
"""
|
||||
if sla := frappe.get_last_doc("CRM Service Level Agreement", {"name": self.sla}):
|
||||
if not self.sla:
|
||||
return
|
||||
sla = frappe.get_last_doc("CRM Service Level Agreement", {"name": self.sla})
|
||||
if sla:
|
||||
sla.apply(self)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@ -131,16 +131,19 @@ class CRMLead(Document):
|
||||
"""
|
||||
Find an SLA to apply to the lead.
|
||||
"""
|
||||
if sla := get_sla("CRM Lead"):
|
||||
if not sla:
|
||||
return
|
||||
self.sla = sla.name
|
||||
sla = get_sla("CRM Lead")
|
||||
if not sla:
|
||||
return
|
||||
self.sla = sla.name
|
||||
|
||||
def apply_sla(self):
|
||||
"""
|
||||
Apply SLA if set.
|
||||
"""
|
||||
if sla := frappe.get_last_doc("CRM Service Level Agreement", {"name": self.sla}):
|
||||
if not self.sla:
|
||||
return
|
||||
sla = frappe.get_last_doc("CRM Service Level Agreement", {"name": self.sla})
|
||||
if sla:
|
||||
sla.apply(self)
|
||||
|
||||
@staticmethod
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user