|
@@ -41,6 +41,7 @@ class PaymentStatusFilter(admin.SimpleListFilter):
|
|
|
)
|
|
|
|
|
|
def queryset(self, request, queryset):
|
|
|
+ # FIXME ne marche pas, les STOP sont inclus
|
|
|
actives = PaymentUpdate.objects.filter(validated=True).order_by('payment', '-start') \
|
|
|
.distinct('payment').exclude(payment_method=PaymentUpdate.STOP) \
|
|
|
.values_list('payment__pk', flat=True)
|
|
@@ -73,12 +74,14 @@ class PendingPaymentFilter(admin.SimpleListFilter):
|
|
|
class PendingPaymentUpdateFormSet(BaseInlineFormSet):
|
|
|
def save_new(self, form, commit=True):
|
|
|
obj = super().save_new(form, commit)
|
|
|
- notify_payment_update(self.request, obj)
|
|
|
+ if not obj.validated:
|
|
|
+ notify_payment_update(self.request, obj)
|
|
|
return obj
|
|
|
|
|
|
def save_existing(self, form, instance, commit=True):
|
|
|
old = PaymentUpdate.objects.get(pk=instance.pk)
|
|
|
- notify_payment_update(self.request, instance, old)
|
|
|
+ if not obj.validated:
|
|
|
+ notify_payment_update(self.request, instance, old)
|
|
|
return super().save_existing(form, instance, commit)
|
|
|
|
|
|
|