mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-16 08:05:00 +00:00
fix: added exception handling on service level agreement apply hook (#50096)
* fix: added exception handling on service level agreement apply hook
* Revert "fix: added exception handling on service level agreement apply hook"
This reverts commit dae93aa96f.
* fix: Ignore missing SLA table during install/uninstall
---------
Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
@@ -484,10 +484,16 @@ def get_documents_with_active_service_level_agreement():
|
||||
|
||||
|
||||
def set_documents_with_active_service_level_agreement():
|
||||
active = frozenset(
|
||||
sla.document_type for sla in frappe.get_all("Service Level Agreement", fields=["document_type"])
|
||||
)
|
||||
frappe.cache.set_value("doctypes_with_active_sla", active)
|
||||
try:
|
||||
active = frozenset(
|
||||
sla.document_type for sla in frappe.get_all("Service Level Agreement", fields=["document_type"])
|
||||
)
|
||||
frappe.cache.set_value("doctypes_with_active_sla", 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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user