From 9eebc7fb2285bc8dd940ab9041ce4ceef99445ca Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Thu, 23 Apr 2020 13:13:31 +0200 Subject: [PATCH] Fix: les transferts apparaissent dans l'historique perso --- kfet/views.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kfet/views.py b/kfet/views.py index 70e5d453..2d13b3d3 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -1404,8 +1404,8 @@ def history_json(request): to_date = request.POST.get("to", None) checkouts = request.POST.getlist("checkouts[]", None) accounts = request.POST.getlist("accounts[]", None) - transfers_only = request.POST.get("transfersonly", None) - opes_only = request.POST.get("opesonly", None) + transfers_only = request.POST.get("transfersonly", False) + opes_only = request.POST.get("opesonly", False) # Construction de la requête (sur les transferts) pour le prefetch @@ -1416,7 +1416,7 @@ def history_json(request): # Le check sur les comptes est dans le prefetch pour les transferts if accounts: transfer_queryset_prefetch = transfer_queryset_prefetch.filter( - Q(from_acc__trigramme__in=accounts) | Q(to_acc__trigramme__in=accounts) + Q(from_acc__in=accounts) | Q(to_acc__in=accounts) ) if not request.user.has_perm("kfet.is_team"): @@ -1458,14 +1458,14 @@ def history_json(request): opegroups = opegroups.filter(at__lt=to_date) transfergroups = transfergroups.filter(at__lt=to_date) if checkouts: - opegroups = opegroups.filter(checkout_id__in=checkouts) + opegroups = opegroups.filter(checkout__in=checkouts) transfergroups = TransferGroup.objects.none() if transfers_only: opegroups = OperationGroup.objects.none() if opes_only: transfergroups = TransferGroup.objects.none() if accounts: - opegroups = opegroups.filter(on_acc_id__in=accounts) + opegroups = opegroups.filter(on_acc__in=accounts) # Un non-membre de l'équipe n'a que accès à son historique if not request.user.has_perm("kfet.is_team"): opegroups = opegroups.filter(on_acc=request.user.profile.account_kfet)