forked from DGNum/gestioCOF
Fix: les transferts apparaissent dans l'historique perso
This commit is contained in:
parent
2aa06d2954
commit
9eebc7fb22
1 changed files with 5 additions and 5 deletions
|
@ -1404,8 +1404,8 @@ def history_json(request):
|
||||||
to_date = request.POST.get("to", None)
|
to_date = request.POST.get("to", None)
|
||||||
checkouts = request.POST.getlist("checkouts[]", None)
|
checkouts = request.POST.getlist("checkouts[]", None)
|
||||||
accounts = request.POST.getlist("accounts[]", None)
|
accounts = request.POST.getlist("accounts[]", None)
|
||||||
transfers_only = request.POST.get("transfersonly", None)
|
transfers_only = request.POST.get("transfersonly", False)
|
||||||
opes_only = request.POST.get("opesonly", None)
|
opes_only = request.POST.get("opesonly", False)
|
||||||
|
|
||||||
# Construction de la requête (sur les transferts) pour le prefetch
|
# 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
|
# Le check sur les comptes est dans le prefetch pour les transferts
|
||||||
if accounts:
|
if accounts:
|
||||||
transfer_queryset_prefetch = transfer_queryset_prefetch.filter(
|
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"):
|
if not request.user.has_perm("kfet.is_team"):
|
||||||
|
@ -1458,14 +1458,14 @@ def history_json(request):
|
||||||
opegroups = opegroups.filter(at__lt=to_date)
|
opegroups = opegroups.filter(at__lt=to_date)
|
||||||
transfergroups = transfergroups.filter(at__lt=to_date)
|
transfergroups = transfergroups.filter(at__lt=to_date)
|
||||||
if checkouts:
|
if checkouts:
|
||||||
opegroups = opegroups.filter(checkout_id__in=checkouts)
|
opegroups = opegroups.filter(checkout__in=checkouts)
|
||||||
transfergroups = TransferGroup.objects.none()
|
transfergroups = TransferGroup.objects.none()
|
||||||
if transfers_only:
|
if transfers_only:
|
||||||
opegroups = OperationGroup.objects.none()
|
opegroups = OperationGroup.objects.none()
|
||||||
if opes_only:
|
if opes_only:
|
||||||
transfergroups = TransferGroup.objects.none()
|
transfergroups = TransferGroup.objects.none()
|
||||||
if accounts:
|
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
|
# Un non-membre de l'équipe n'a que accès à son historique
|
||||||
if not request.user.has_perm("kfet.is_team"):
|
if not request.user.has_perm("kfet.is_team"):
|
||||||
opegroups = opegroups.filter(on_acc=request.user.profile.account_kfet)
|
opegroups = opegroups.filter(on_acc=request.user.profile.account_kfet)
|
||||||
|
|
Loading…
Reference in a new issue