Exemplo n.º 1
0
 def getMoneyIOUserTypeChoices(self, user):
     moneyiotype_list = MoneyIOUserType.all()
     if user:
         moneyiotype_list = moneyiotype_list.filter('user', user)
         
     choices=[(moneytype.id, moneytype.display_name) for moneytype in moneyiotype_list]
     return choices
Exemplo n.º 2
0
 def getBaseMoneyIOUserType(self, moneyiousertype):
     isio = moneyiousertype.isio
     user = moneyiousertype.user
     if isio == 1:
         moneytypename = BASE_MONEY_INCOME_TYPE
     else:
         moneytypename = BASE_MONEY_EXPENSE_TYPE
     
     basemoneyiotype_list = MoneyIOUserType.all().filter('name', moneytypename).filter('user', user)
     if basemoneyiotype_list.count() == 0:
         basemoneyiotype = MoneyIOUserType(name=moneytypename, isio=isio, user=user)
         basemoneyiotype.put()
     else:
         basemoneyiotype = basemoneyiotype_list[0]
     
     return basemoneyiotype        
Exemplo n.º 3
0
    def getMoneyIOUserTypeChoices(self, user):
        moneyiotype_list = MoneyIOUserType.all()
        if user:
            moneyiotype_list = moneyiotype_list.filter('user', user)

        choices = [(moneytype.id, moneytype.display_name)
                   for moneytype in moneyiotype_list]
        return choices
Exemplo n.º 4
0
 def getMoneyIOUserType(self, id, user):
     moneyiousertype = None
     try:
         moneyiousertype = MoneyIOUserType.get_by_id(int(id))
         if moneyiousertype.user.id <> user.id:
             moneyiousertype = None
     except:
         moneyiousertype = None
     return moneyiousertype
Exemplo n.º 5
0
 def getMoneyIOUserType(self, id, user):
     moneyiousertype = None
     try:
         moneyiousertype = MoneyIOUserType.get_by_id(int(id))
         if moneyiousertype.user.id <> user.id:
             moneyiousertype = None
     except:
         moneyiousertype = None
     return moneyiousertype
Exemplo n.º 6
0
    def getMoneyIOUserTypeCount(self, user):
        moneyiousertype_list = MoneyIOUserType.all()
        if user:
            moneyiousertype_list = moneyiousertype_list.filter('user', user)

        if moneyiousertype_list:
            count = moneyiousertype_list.count()
        else:
            count = 0
        return count
Exemplo n.º 7
0
    def getBaseMoneyIOUserType(self, moneyiousertype):
        isio = moneyiousertype.isio
        user = moneyiousertype.user
        if isio == 1:
            moneytypename = BASE_MONEY_INCOME_TYPE
        else:
            moneytypename = BASE_MONEY_EXPENSE_TYPE

        basemoneyiotype_list = MoneyIOUserType.all().filter(
            'name', moneytypename).filter('user', user)
        if basemoneyiotype_list.count() == 0:
            basemoneyiotype = MoneyIOUserType(name=moneytypename,
                                              isio=isio,
                                              user=user)
            basemoneyiotype.put()
        else:
            basemoneyiotype = basemoneyiotype_list[0]

        return basemoneyiotype
Exemplo n.º 8
0
 def getMoneyIOUserTypeCount(self, user):
     moneyiousertype_list = MoneyIOUserType.all()
     if user:
         moneyiousertype_list = moneyiousertype_list.filter('user', user)
         
     if moneyiousertype_list:
         count = moneyiousertype_list.count()
     else:
         count = 0
     return count
Exemplo n.º 9
0
 def getMoneyIOUserTypeList(self, user):
     moneyiousertype_list = MoneyIOUserType.all().filter('name !=', BASE_MONEY_INCOME_TYPE).filter('name !=', BASE_MONEY_EXPENSE_TYPE)
     if user:
         moneyiousertype_list = moneyiousertype_list.filter('user', user)
     
     #moneyiousertype_list = moneyiousertype_list.order('-isio')
     if moneyiousertype_list.count() == 0:
         moneyiousertype_list = None
     
     return moneyiousertype_list
Exemplo n.º 10
0
 def checkMoneyIOUserTypeNameExist(self, name, id, user):
     moneyiousertype_list = MoneyIOUserType.all().filter('name', name).filter('user', user)
     if moneyiousertype_list.count() == 0:
         return False
     elif moneyiousertype_list.count() == 1:
         if id and moneyiousertype_list[0].id == id:
             return False
         else:
             return True
     else:
         return True 
Exemplo n.º 11
0
    def getMoneyIOUserTypeList(self, user):
        moneyiousertype_list = MoneyIOUserType.all().filter(
            'name !=', BASE_MONEY_INCOME_TYPE).filter('name !=',
                                                      BASE_MONEY_EXPENSE_TYPE)
        if user:
            moneyiousertype_list = moneyiousertype_list.filter('user', user)

        #moneyiousertype_list = moneyiousertype_list.order('-isio')
        if moneyiousertype_list.count() == 0:
            moneyiousertype_list = None

        return moneyiousertype_list
Exemplo n.º 12
0
 def checkMoneyIOUserTypeNameExist(self, name, id, user):
     moneyiousertype_list = MoneyIOUserType.all().filter('name',
                                                         name).filter(
                                                             'user', user)
     if moneyiousertype_list.count() == 0:
         return False
     elif moneyiousertype_list.count() == 1:
         if id and moneyiousertype_list[0].id == id:
             return False
         else:
             return True
     else:
         return True
Exemplo n.º 13
0
    def initMoneyIOUserTypeFromSystem(self, user):
        moneyiousertype_list = MoneyIOUserType.all().filter('user', user)
        for moneyiousertype in moneyiousertype_list:
            moneyiousertype.delete()

        moneyiosystype_list = MoneyIOSysType.all()
        for moneyiosystype in moneyiosystype_list:
            moneyiousertype = MoneyIOUserType(name=moneyiosystype.name)
            moneyiousertype.isio = moneyiosystype.isio
            moneyiousertype.user = user
            moneyiousertype.put()
Exemplo n.º 14
0
 def initMoneyIOUserTypeFromSystem(self, user):        
     moneyiousertype_list = MoneyIOUserType.all().filter('user', user)
     for moneyiousertype in moneyiousertype_list:
         moneyiousertype.delete()
     
     moneyiosystype_list = MoneyIOSysType.all()
     for moneyiosystype in moneyiosystype_list:
         moneyiousertype = MoneyIOUserType(name=moneyiosystype.name)
         moneyiousertype.isio = moneyiosystype.isio
         moneyiousertype.user = user
         moneyiousertype.put()
Exemplo n.º 15
0
 def addMoneyIOUserType(self, name, isio, user):
     moneyiousertype = MoneyIOUserType(name=name, isio=isio, user=user)
     moneyiousertype.put()
Exemplo n.º 16
0
 def addMoneyIOUserType(self, name, isio, user):
     moneyiousertype = MoneyIOUserType(name=name, isio=isio, user=user)
     moneyiousertype.put()