Exemple #1
0
    def get_account_transaction_history(self,
                                        acc_name,
                                        paginate=False,
                                        coords=None,
                                        user_values=False):
        """If paginate is true, coords must contain
           the keys 'begin' and 'end'.
        """

        account = managers.AccountManager().get_account(acc_name)
        if paginate:
            acc_entries = account.entries.all()[coords['begin']:coords['end']]
        else:
            acc_entries = account.entries.all()
        return [{
            "tid":
            x.transaction.tid,
            "amount":
            x.amount if not (account.positive_credit and user_values) else
            x.amount * -1,
            "timestamp":
            x.transaction.t_stamp,
            "description":
            x.transaction.description
        } for x in acc_entries]
Exemple #2
0
 def allowed(self, request, datum):
     self.account_manager = managers.AccountManager()
     self.sufficient_money = self.account_manager.has_sufficient_balance(
         self.table.request.user.tenant_id)
     if self.sufficient_money:
         self.classes = ('btn-launch', 'ajax-modal')
     else:
         self.classes = ('btn-launch')
     return super(CustomLaunchLink, self).allowed(request, datum)
Exemple #3
0
 def setUp(self):
     self.account_manager = managers.AccountManager()
     self.book_manager = managers.BookManager()
     self.user_transactions = transactions.UserTransactions()
     self.transaction_history = transactions.TransactionHistory()
     self.user_id = "{0:032x}".format(random.getrandbits(128))
     self.user_account = self.account_manager.get_user_account(
         self.user_id)
     self.asset_source_account = self.account_manager.get_account(
         settings.ACCOUNTING_ASSET_SOURCES[0])
     self.revenue_account = self.account_manager.get_account(
         settings.ACCOUNTING_REVENUE_ACCOUNT)
     self.promotions_account = self.account_manager.get_account(
         settings.ACCOUNTING_PROMOTIONS_ACCOUNT)
     super(AccountingTests, self).setUp()
Exemple #4
0
 def __init__(self, *args, **kwargs):
     self.account_manager = managers.AccountManager()
Exemple #5
0
 def get_user_account_transaction_history(self, account, **kwargs):
     return self.get_account_transaction_history(
         managers.AccountManager().format_user_account(account), **kwargs)
Exemple #6
0
 def __init__(self):
     self.account_manager = managers.AccountManager()
Exemple #7
0
 def get_data(self, *args, **kwargs):
     am = managers.AccountManager()
     data = super(CustomIndexView, self).get_data(*args, **kwargs)
     for obj in data:
         setattr(obj, 'balance', am.get_user_account(obj.id).balance())
     return data
Exemple #8
0
 def __init__(self, *args, **kwargs):
     super(CustomLaunchInstanceView, self).__init__(*args, **kwargs)
     self.account_manager = managers.AccountManager()