Ditto for reimbursement claims

This commit is contained in:
Yingtong Li 2020-06-08 01:11:10 +10:00
parent a1aa2423ad
commit e28a814edf
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -285,8 +285,11 @@ class ReimbursementClaim(models.Model):
return False return False
def can_withdraw(self, user): def can_withdraw(self, user):
if not self.can_edit(user): if not self.can_view(user):
return False return False
if user != self.author and not user.groups.filter(name='Treasury').exists():
return False
if self.state == ClaimState.AWAIT_REVIEW.value or self.state == ClaimState.APPROVED.value: if self.state == ClaimState.AWAIT_REVIEW.value or self.state == ClaimState.APPROVED.value:
return True return True
return False return False