Parcourir la source

Fix case when deleting payment/invoice not associated to a member

Alexandre Aubin il y a 7 ans
Parent
commit
3159779e8c
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  1. 3 0
      coin/billing/models.py

+ 3 - 0
coin/billing/models.py

@@ -619,6 +619,9 @@ def payment_deleted(sender, instance, **kwargs):
 
     member = instance.member
 
+    if member is None:
+        return
+
     this_member_invoices = [i for i in member.invoices.filter(validated=True).order_by("date")]
     this_member_payments = [p for p in member.payments.order_by("date")]