工单聚合查询bug

This commit is contained in:
caoqianming 2021-10-20 14:38:00 +08:00
parent c5fc214c10
commit 526127b1e4
3 changed files with 4 additions and 2 deletions

View File

@ -65,5 +65,5 @@ class FIFODetail(CommonAModel):
"""
领料详细记录
"""

View File

@ -175,7 +175,7 @@ class TicketViewSet(OptimizationMixin, CreateUpdateCustomMixin, CreateModelMixin
queryset = Ticket.objects.filter(participant__contains=request.user.id, is_deleted=False)\
.exclude(act_state__in=[Ticket.TICKET_ACT_STATE_FINISH, Ticket.TICKET_ACT_STATE_CLOSED])
ret['total_count'] = queryset.count()
ret['details'] = list(queryset.annotate(count = Count('workflow')).values('workflow', 'workflow__name', 'count'))
ret['details'] = list(queryset.values('workflow', 'workflow__name').annotate(count = Count('workflow')))
return Response(ret)
@action(methods=['post'], detail=True, perms_map={'post':'*'})

View File

@ -6,6 +6,8 @@ from apps.pum.serializers import VendorSerializer
from apps.system.mixins import CreateUpdateModelAMixin, OptimizationMixin
# Create your views here.
class VendorViewSet(CreateUpdateModelAMixin, ModelViewSet):
"""