mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-26 07:02:24 +00:00
Fix payment group permission
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
0c45a88246
commit
1684c079e3
@ -460,7 +460,7 @@ class PaymentUpdateView(LoginRequiredMixin, UpdateView):
|
|||||||
context['title'] = _("Update payment")
|
context['title'] = _("Update payment")
|
||||||
# Grouping is only possible if there isn't any validated payment in the team
|
# Grouping is only possible if there isn't any validated payment in the team
|
||||||
context['can_group'] = all(p.valid is False for reg in self.object.team.students.all()
|
context['can_group'] = all(p.valid is False for reg in self.object.team.students.all()
|
||||||
for p in reg.payments.filter(valid=self.object.valid).all())
|
for p in reg.payments.filter(final=self.object.final).all())
|
||||||
context['bank_transfer_form'] = PaymentForm(payment_type='bank_transfer',
|
context['bank_transfer_form'] = PaymentForm(payment_type='bank_transfer',
|
||||||
data=self.request.POST or None,
|
data=self.request.POST or None,
|
||||||
instance=self.object)
|
instance=self.object)
|
||||||
@ -504,7 +504,7 @@ class PaymentUpdateGroupView(LoginRequiredMixin, DetailView):
|
|||||||
return self.handle_no_permission()
|
return self.handle_no_permission()
|
||||||
|
|
||||||
if any(p.valid is not False for reg in payment.team.students.all()
|
if any(p.valid is not False for reg in payment.team.students.all()
|
||||||
for p in reg.payments.filter(valid=payment.valid).all()):
|
for p in reg.payments.filter(final=payment.final).all()):
|
||||||
raise PermissionDenied(_("Since one payment is already validated, or pending validation, "
|
raise PermissionDenied(_("Since one payment is already validated, or pending validation, "
|
||||||
"grouping is not possible."))
|
"grouping is not possible."))
|
||||||
return super().dispatch(request, *args, **kwargs)
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user