Beispiel #1
0
 def saveNewTransaction(self, account, transaction_type, transaction_amount, memo):
   transaction = AccountTransaction(parent=account.key)
   # TODO(jgessner): remove the extra savings_account field.
   transaction.savings_account = account.key
   transaction.transaction_type = transaction_type
   transaction.amount = int(float(transaction_amount) * 1000000)
   transaction.transaction_local_date = util.getTodayForTimezone(account.timezone_name)
   transaction.memo = memo
   transaction.put()
   return transaction.key
Beispiel #2
0
  def get(self):
    self.response.headers['Content-Type'] = 'text/plain' 
    if not users.get_current_user():
      self.redirect(users.create_login_url(self.request.uri))
    t_query = AccountTransaction.query()

    for t in t_query:
      self.response.out.write('Transaction: %s\n' % t.key)
      if not t.key.parent():
        self.response.out.write('No parent for this transaction, making a copy\n')
        t2 = AccountTransaction(parent=t.savings_account)
        t2.savings_account = t.savings_account
        t2.transaction_type = t.transaction_type
        t2.transaction_time = t.transaction_time
        t2.transaction_local_date = t.transaction_local_date
        t2.amount = t.amount
        t2.memo = t.memo
        t2.put()
        self.response.out.write('  New transaction key: %s\n' % t2.key)
        self.response.out.write('  Deleting %s\n' % t.key)
        t.key.delete()