Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit 24cdc232 authored by Levy--Falk Hugo's avatar Levy--Falk Hugo

Autorise l'édition de facture si l'auto-souscription est interdite mais que...

Autorise l'édition de facture si l'auto-souscription est interdite mais que l'on peut créer des factures.
parent e0d71ed2
......@@ -99,22 +99,26 @@ def new_facture(request, user, userid):
)
# Building the invocie form and the article formset
is_self_subscription = False
if not request.user.has_perm('cotisations.add_facture') and OptionalUser.get_cached_value('allow_self_subscription'):
is_self_subscription = True
article_list = article_list.filter(allow_self_subscription=True)
allowed_payment = Paiement.objects.filter(allow_self_subscription=True)
invoice_form = NewFactureForm(request.POST or None, instance=invoice, allowed_payment=allowed_payment)
elif not OptionalUser.get_cached_value('allow_self_subscription'):
messages.error(
request,
_("You cannot subscribe. Please ask to the staff.")
)
return redirect(reverse(
'users:profil',
kwargs={'userid': userid}
))
can_create_invoice = request.user.has_perm('cotisations.add_facture')
allow_self_subscription = OptionalUser.get_cached_value('allow_self_subscription')
if not can_create_invoice:
if allow_self_subscription:
is_self_subscription = True
article_list = article_list.filter(allow_self_subscription=True)
allowed_payment = Paiement.objects.filter(allow_self_subscription=True)
invoice_form = NewFactureForm(request.POST or None, instance=invoice, allowed_payment=allowed_payment)
else:
messages.error(
request,
_("You cannot subscribe. Please ask to the staff.")
)
return redirect(reverse(
'users:profil',
kwargs={'userid': userid}
))
else:
invoice_form = NewFactureForm(request.POST or None, instance=invoice)
if request.user.is_class_club:
article_formset = formset_factory(SelectClubArticleForm)(
request.POST or None,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment