Annulation des reventes

- On peut annuler des reventes à tout point du processus
- Le formulaire d'annulation donne plus d'informations
This commit is contained in:
Ludovic Stephan 2018-04-13 10:54:45 +02:00
parent 6c983e16e5
commit fc37c5a8a0
3 changed files with 25 additions and 39 deletions

View file

@ -55,12 +55,16 @@ class ReventeModelMultipleChoiceField(forms.ModelMultipleChoiceField):
label = "{show}{suffix}"
suffix = ""
if self.own:
# C'est notre propre revente : pas besoin de spécifier le vendeur
# C'est notre propre revente : informations sur le statut
if obj.soldTo is not None:
suffix = " -- Vendue à {firstname} {lastname}".format(
firstname=obj.soldTo.user.first_name,
lastname=obj.soldTo.user.last_name,
)
elif obj.shotgun:
suffix = " -- Tirage infructueux"
elif obj.notif_sent:
suffix = " -- Inscriptions au tirage en cours"
else:
# Ce n'est pas à nous : on ne voit jamais l'acheteur
suffix = " -- Vendue par {firstname} {lastname}".format(
@ -103,10 +107,10 @@ class AnnulForm(forms.Form):
self.fields['reventes'].queryset = (
participant.original_shows
.filter(attribution__spectacle__date__gte=timezone.now(),
notif_sent=False,
soldTo__isnull=True)
.select_related('attribution__spectacle',
'attribution__spectacle__location')
.order_by('-date')
)