From 889713f00e572db3ae2e00ca823052af8e2bb799 Mon Sep 17 00:00:00 2001 From: feng626 <1304903146@qq.com> Date: Thu, 10 Feb 2022 13:14:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E6=B5=81=E7=A8=8B=E8=AE=BE=E7=BD=AE=E6=98=BE=E7=A4=BA=E5=85=B6?= =?UTF-8?q?=E5=AE=83=E7=BB=84=E7=BB=87=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/tickets/models/flow.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/tickets/models/flow.py b/apps/tickets/models/flow.py index ae5eea0ff..69aa6c432 100644 --- a/apps/tickets/models/flow.py +++ b/apps/tickets/models/flow.py @@ -6,7 +6,8 @@ from django.utils.translation import ugettext_lazy as _ from users.models import User from common.mixins.models import CommonModelMixin from orgs.mixins.models import OrgModelMixin -from orgs.utils import tmp_to_root_org, tmp_to_org, get_current_org_id +from orgs.models import Organization +from orgs.utils import tmp_to_org, get_current_org_id from ..const import TicketType, TicketApprovalLevel, TicketApprovalStrategy __all__ = ['TicketFlow', 'ApprovalRule'] @@ -75,6 +76,7 @@ class TicketFlow(CommonModelMixin, OrgModelMixin): else: flows = cls.objects.all() cur_flow_types = flows.values_list('type', flat=True) - with tmp_to_root_org(): - diff_global_flows = cls.objects.exclude(type__in=cur_flow_types) + root_id = Organization.ROOT_ID + with tmp_to_org(root_id): + diff_global_flows = cls.objects.exclude(type__in=cur_flow_types).filter(org_id=root_id) return flows | diff_global_flows