Exemplo n.º 1
0
 def get_moneys_for_account(self, account: Account) -> List[Money]:
     """ Returns a list of Money object that represents the impact
     of this transaction for an account. """
     acc_descendants_pks = list(
         account.get_descendants(True).values_list("pk", flat=True))
     return [
         x.money for x in self.get_movements_specs()
         if x.account.pk in acc_descendants_pks
     ]
Exemplo n.º 2
0
 def filter_by_account(self, acc: Account) -> TransactionQuerySet:
     """ Returns only transactions for which a movement uses an account """
     acc_descendants_pks = list(
         acc.get_descendants(True).values_list('pk', flat=True))
     return self.filter(movement__account__id__in=acc_descendants_pks)