fix: added exception handling on service level agreement apply hook (#50096) (#54192)

Co-authored-by: Ankush Menat <ankush@frappe.io>
(cherry picked from commit 21311dab86)
This commit is contained in:
diptanilsaha
2026-04-10 17:01:25 +05:30
committed by Mergify
parent 5bbfb79cdc
commit 12b27883f6

View File

@@ -449,10 +449,16 @@ def get_documents_with_active_service_level_agreement():
def set_documents_with_active_service_level_agreement():
active = [
sla.document_type for sla in frappe.get_all("Service Level Agreement", fields=["document_type"])
]
frappe.cache().hset("service_level_agreement", "active", active)
try:
active = frozenset(
sla.document_type for sla in frappe.get_all("Service Level Agreement", fields=["document_type"])
)
frappe.cache().hset("service_level_agreement", "active", active)
except (frappe.DoesNotExistError, frappe.db.TableMissingError):
# This happens during install / uninstall when wildcard hook for SLA intercepts some doc action.
# In both cases, the error can be safely ignored.
active = frozenset()
return active