summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYingtong Li <runassudo@yingtongli.me>2020-07-26 03:55:47 +1000
committerYingtong Li <runassudo@yingtongli.me>2020-07-26 03:55:47 +1000
commitb7d6d0c5d41a75c960f7242281e75f6d0cf802fe (patch)
tree68203f152468b09f877f5448445ec2c15096d693
parentae128d209c9e9e40aab7fb95f4e11f2ef0f917c8 (diff)
Add reimbursement claims endpoint for all reimbursement claims
-rw-r--r--sstreasury/views.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/sstreasury/views.py b/sstreasury/views.py
index 24d49a2..7badcb5 100644
--- a/sstreasury/views.py
+++ b/sstreasury/views.py
@@ -675,7 +675,8 @@ def claim_processing(request):
if request.method == 'POST':
if request.POST['action'] == 'Export':
- claims = models.ReimbursementClaim.objects.filter(state=models.ClaimState.APPROVED.value).all()
+ #claims = models.ReimbursementClaim.objects.filter(state=models.ClaimState.APPROVED.value).all()
+ claims = models.ReimbursementClaim.objects.all()
claims = [c for c in claims if request.POST.get('claim_{}'.format(c.id), False)]
claims.sort(key=lambda c: '{}/{}{}/{}'.format(c.payee_name.strip(), c.payee_bsb.strip()[:3], c.payee_bsb.strip()[-3:], c.payee_account.strip()))
@@ -708,7 +709,8 @@ def claim_processing(request):
return response
if request.POST['action'] == 'ExportXero':
- claims = models.ReimbursementClaim.objects.filter(state=models.ClaimState.APPROVED.value).all()
+ #claims = models.ReimbursementClaim.objects.filter(state=models.ClaimState.APPROVED.value).all()
+ claims = models.ReimbursementClaim.objects.all()
claims = [c for c in claims if request.POST.get('claim_{}'.format(c.id), False)]
# Export CSV
@@ -742,7 +744,10 @@ def claim_processing(request):
emailer = Emailer()
emailer.send_mail([claim.author.email], 'Claim paid: {} (RE-{})'.format(claim.purpose, claim.id), 'sstreasury/email/claim_paid.md', {'claim': claim})
- claims = models.ReimbursementClaim.objects.filter(state=models.ClaimState.APPROVED.value).all()
+ if request.GET.get('view', '') == 'all':
+ claims = models.ReimbursementClaim.objects.all()
+ else:
+ claims = models.ReimbursementClaim.objects.filter(state=models.ClaimState.APPROVED.value).all()
return render(request, 'sstreasury/claim_processing.html', {
'claims': claims
Contact (issues, pull requests, etc.) at git@yingtongli.me. Generated by cgit.