From 83b11cd7224d66ae67ccf6df34d15ff915b2b8a7 2016-03-24 03:20:29 From: Christopher Neugebauer Date: 2016-03-24 03:20:29 Subject: [PATCH] Fixes invoicing payment logic --- diff --git a/registrasion/controllers/invoice.py b/registrasion/controllers/invoice.py index e9a654e4f968beeb7879694d6cf5a4b145143e79..b8087c989c94a8662f2c736e862c2a92db5e0e02 100644 --- a/registrasion/controllers/invoice.py +++ b/registrasion/controllers/invoice.py @@ -122,7 +122,7 @@ class InvoiceController(object): ) payment.save() - payments = rego.Payment.objects .filter(invoice=self.invoice) + payments = rego.Payment.objects.filter(invoice=self.invoice) agg = payments.aggregate(Sum("amount")) total = agg["amount__sum"] diff --git a/registrasion/templates/invoice.html b/registrasion/templates/invoice.html index a66132cf4a305027230e613f75998bd0c2d03ad0..bd5036574cd078b55689f052c70190339a5fe708 100644 --- a/registrasion/templates/invoice.html +++ b/registrasion/templates/invoice.html @@ -33,5 +33,19 @@ + + + + + + + {% for payment in invoice.payment_set.all %} + + + + + + {% endfor %} +
Payment timeReferenceAmount
{{payment.time}}{{payment.reference}}{{payment.amount}}
{% endblock %} diff --git a/registrasion/views.py b/registrasion/views.py index 6288f4b248a639dae3dbbdee1e64c335a99c683d..64f4e4b1d37dcf07997eb4ec3f9bb990e65b561f 100644 --- a/registrasion/views.py +++ b/registrasion/views.py @@ -217,7 +217,7 @@ def pay_invoice(request, invoice_id): invoice_id = int(invoice_id) inv = rego.Invoice.objects.get(pk=invoice_id) current_invoice = InvoiceController(inv) - if not inv.paid and not current_invoice.is_valid(): + if not inv.paid and current_invoice.is_valid(): current_invoice.pay("Demo invoice payment", inv.value) return redirect("invoice", current_invoice.invoice.id)