def max_refund(self):
        aggregates = self.related_transfers.filter(
            source=self.destination).aggregate(sum=Sum('amount'))
        already_refunded = aggregates['sum']
        if already_refunded is None:
            return self.amount
        return self.amount - already_refunded
Return the maximum amount that can be refunded against this transfer
dataset/ETHPy150Open django-oscar/django-oscar-accounts/src/oscar_accounts/abstract_models.py/Transfer.max_refund