From fc3a993547ccd1baeb0b9c337e256f2b96bc9edf Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Thu, 30 Aug 2018 12:39:43 +0200 Subject: [PATCH] do not show the expense which represents the actual reimbursement, and do not count it towards the total --- src/backoffice/templates/reimbursement_list.html | 2 +- src/economy/models.py | 2 +- .../templates/includes/reimbursement_detail_panel.html | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/backoffice/templates/reimbursement_list.html b/src/backoffice/templates/reimbursement_list.html index b145ca6c..da716159 100644 --- a/src/backoffice/templates/reimbursement_list.html +++ b/src/backoffice/templates/reimbursement_list.html @@ -34,7 +34,7 @@ {{ reim.notes|default:"N/A" }} {{ reim.amount }} DKK {{ reim.paid }} - {% for expense in reim.expenses.all %}{{ expense.pk }}
{% endfor %} + {% for expense in reim.expenses.all %}{% if not expense.paid_by_bornhack %}{{ expense.pk }} - {{ expense.amount }} DKK - {{ expense.description }}
{% endif %}{% endfor %} Details diff --git a/src/economy/models.py b/src/economy/models.py index 2a22ef02..925c7acc 100644 --- a/src/economy/models.py +++ b/src/economy/models.py @@ -175,7 +175,7 @@ class Reimbursement(CampRelatedModel, UUIDModel): The total amount for a reimbursement is calculated by adding up the amounts for all the related expenses """ amount = 0 - for expense in self.expenses.all(): + for expense in self.expenses.filter(paid_by_bornhack=False): amount += expense.amount return amount diff --git a/src/economy/templates/includes/reimbursement_detail_panel.html b/src/economy/templates/includes/reimbursement_detail_panel.html index 4bd83f70..3eee6131 100644 --- a/src/economy/templates/includes/reimbursement_detail_panel.html +++ b/src/economy/templates/includes/reimbursement_detail_panel.html @@ -3,17 +3,13 @@
- + - - - -
AmountTotal Amount {{ reimbursement.amount }} DKK
Economy Team Notes {{ reimbursement.notes|default:"N/A" }}
Total amount{{ reimbursement.amount }} DKK
Paid {{ reimbursement.paid }}