|
@@ -599,6 +599,17 @@ def invoice_changed(sender, instance, created, **kwargs):
|
|
|
accounting_log.info("Updating invoice %s (Member: %s, Total amount: %s, Amount paid: %s)."
|
|
|
% (instance.number, instance.member, instance.amount(), instance.amount_paid() ))
|
|
|
|
|
|
+@receiver(post_delete, sender=PaymentAllocation)
|
|
|
+def paymentallocation_deleted(sender, instance, **kwargs):
|
|
|
+
|
|
|
+ invoice = instance.invoice
|
|
|
+
|
|
|
+ # Reopen invoice if relevant
|
|
|
+ if (invoice.amount_remaining_to_pay() > 0) and (invoice.status == "closed"):
|
|
|
+ accounting_log.info("Reopening invoice %s ..." % invoice.number)
|
|
|
+ invoice.status = "open"
|
|
|
+ invoice.save()
|
|
|
+
|
|
|
|
|
|
@receiver(post_delete, sender=Payment)
|
|
|
def payment_deleted(sender, instance, **kwargs):
|