From c28a2673bb844a1da2a60bf42a39465756d5f547 Mon Sep 17 00:00:00 2001 From: dcz <dcz@ipipan.waw.pl> Date: Wed, 30 Oct 2024 09:52:14 +0100 Subject: [PATCH] Unified frame fin statement count bugfix (absent verified unified frames) --- financial_settlement/views.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/financial_settlement/views.py b/financial_settlement/views.py index ac02267..cdd88bb 100644 --- a/financial_settlement/views.py +++ b/financial_settlement/views.py @@ -1,5 +1,6 @@ from django.contrib.auth.decorators import permission_required from django.contrib.auth.decorators import permission_required +from django.db.models import Q from django.shortcuts import get_object_or_404, render, redirect from django.utils.translation import gettext_lazy as _ @@ -78,9 +79,11 @@ def statement_detail(request, pk): :return: Redirecting to fin_statement_details """ statement = get_object_or_404(FinStatement, pk=pk) - unified_frames = UnifiedFrame.objects.filter(fin_statement=statement, status=choices.FrameStatus.READY) - mappings = UnifiedFrame2SlowalFrameMapping.objects.filter(unified_frame__in=unified_frames.all(), - slowal_frame__status=choices.FrameStatus.READY) + unified_frames = UnifiedFrame.objects.filter(Q(Q(fin_statement=statement, status=choices.FrameStatus.READY) | + Q(fin_statement=statement, status=choices.FrameStatus.VERIFIED))) + mappings = UnifiedFrame2SlowalFrameMapping.objects.filter(Q(Q(unified_frame__in=unified_frames.all()) & + Q(Q(slowal_frame__status=choices.FrameStatus.READY) | + Q(slowal_frame__status=choices.FrameStatus.VERIFIED)))) free_lu_frames = Frame.objects.filter(free_lu_user_assignment=statement.user, fin_statement=statement) return render(request, 'fin_statement_details.html', -- GitLab