Add reimbursement claims endpoint for all reimbursement claims

This commit is contained in:
Yingtong Li 2020-07-26 03:55:47 +10:00
parent ae128d209c
commit b7d6d0c5d4
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -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,6 +744,9 @@ 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})
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', {