diff --git a/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py b/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py index 4a5a91375..71c32390e 100644 --- a/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py +++ b/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py @@ -74,15 +74,19 @@ def get_list_filters(query: Query): ) query = query.where(Criterion.any(conditions)) - enable_restrictions, ignore_restrictions = frappe.get_value( + restrictions = frappe.get_value( doctype="HD Settings", fieldname=[ "restrict_tickets_by_agent_group", "do_not_restrict_tickets_without_an_agent_group", ], + as_dict=1 ) - enable_restrictions = bool(int(enable_restrictions)) - ignore_restrictions = bool(int(ignore_restrictions)) + enable_restrictions = ignore_restrictions = 0 + if restrictions: + enable_restrictions = bool(int(restrictions['restrict_tickets_by_agent_group'])) + ignore_restrictions = bool(int(restrictions['do_not_restrict_tickets_without_an_agent_group'])) + if not enable_restrictions: return query