From c6a2f4f1b6ef32eaf9e844ff9d1b3b6dc90c13f6 Mon Sep 17 00:00:00 2001 From: Sabu Siyad Date: Fri, 13 Oct 2023 11:43:05 +0530 Subject: [PATCH] fix: sla: cover only `HD Ticket` --- .../hd_service_level_agreement.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/helpdesk/helpdesk/doctype/hd_service_level_agreement/hd_service_level_agreement.py b/helpdesk/helpdesk/doctype/hd_service_level_agreement/hd_service_level_agreement.py index 83ac35e90..17284bcc7 100644 --- a/helpdesk/helpdesk/doctype/hd_service_level_agreement/hd_service_level_agreement.py +++ b/helpdesk/helpdesk/doctype/hd_service_level_agreement/hd_service_level_agreement.py @@ -17,6 +17,8 @@ class HDServiceLevelAgreement(Document): + doctype_ticket = "HD Ticket" + def validate(self): self.validate_priorities() # To refactor self.validate_support_and_resolution() # To refactor @@ -93,10 +95,12 @@ def validate_condition(self): if not self.condition: return try: - temp_doc = frappe.new_doc(self.document_type) + temp_doc = frappe.new_doc(self.doctype_ticket) frappe.safe_eval(self.condition, None, get_context(temp_doc)) except Exception as e: - frappe.throw(_("The Condition '{0}' is invalid: {1}").format(self.condition, str(e))) + frappe.throw( + _("The Condition '{0}' is invalid: {1}").format(self.condition, str(e)) + ) # What? def get_hd_service_level_agreement_priority(self, priority):