Пример #1
0
    def search(self,
               cr,
               user,
               args,
               offset=0,
               limit=None,
               order=None,
               context=None,
               count=False):
        #deal the datetime field query
        new_args = deal_args_dt(cr, user, self, args,
                                ['create_date', 'write_date'], context)
        for arg in new_args:
            #add the category improving, search all child categories
            if arg[0] == 'categ_id' and arg[1] == '=' and isinstance(
                    arg[2], (int, long)):
                idx = new_args.index(arg)
                new_args.remove(arg)
                new_args.insert(idx, [arg[0], 'child_of', arg[2]])

            #add the multi part# query, user can enter default_code like: %code1%,%code2%...%coden%
            if arg[0] == 'default_code' and arg[1] == 'in' and isinstance(
                    arg[2], type(u' ')):
                part_nos = []
                for part_no in arg[2].split(','):
                    part_nos.append(part_no.strip())
                idx = new_args.index(arg)
                new_args.remove(arg)
                new_args.insert(idx, [arg[0], arg[1], part_nos])

        #get the search result
        ids = super(product_product, self).search(cr, user, new_args, offset,
                                                  limit, order, context, count)

        return ids
Пример #2
0
 def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
     #the day search support
     new_args = utils.deal_args_dt(cr, user, self, args,['name'],context=context)
     #the date_start/end parameter
     for arg in new_args:
         if arg[0] == 'date_search_from':
             arg[0] = 'name'
             arg[1] = '>='
         if arg[0] == 'date_search_to':
             arg[0] = 'name'
             arg[1] = '<='
             #for the end date, need add one day to use as the end day
             time_obj = datetime.strptime(arg[2],DEFAULT_SERVER_DATETIME_FORMAT)
             time_obj += relativedelta(days=1)                                
             arg[2] = time_obj.strftime(DEFAULT_SERVER_DATETIME_FORMAT)       
     return super(hr_attendance,self).search(cr, user, new_args, offset, limit, order, context, count)
Пример #3
0
 def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
     #deal the 'datetime' field query
     new_args = utils.deal_args_dt(cr, user, self, args,['date', 'date_done', 'mr_date_order'],context=context)
     #the date_start/end parameter
     for arg in new_args:
         if arg[0] == 'date_from':
             arg[0] = 'mr_date_order'
             arg[1] = '>='
         if arg[0] == 'date_to':
             arg[0] = 'mr_date_order'
             arg[1] = '<='
             #for the end date, need add one day to use as the end day
             time_obj = datetime.strptime(arg[2],DEFAULT_SERVER_DATETIME_FORMAT)
             time_obj += relativedelta(days=1)                                
             arg[2] = time_obj.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
                     
     return super(stock_mt_rpt,self).search(cr, user, new_args, offset, limit, order, context, count)
Пример #4
0
	def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
		#deal the datetime field query
		new_args = deal_args_dt(cr, user, self, args, ['create_date','write_date'], context)
		for arg in new_args:
			#add the category improving, search all child categories
			if arg[0] == 'categ_id' and arg[1] == '=' and isinstance(arg[2], (int,long)):
				idx = new_args.index(arg)
				new_args.remove(arg)
				new_args.insert(idx, [arg[0],'child_of',arg[2]])

			#add the multi part# query, user can enter default_code like: %code1%,%code2%...%coden%
			if arg[0] == 'default_code' and arg[1] == 'in' and isinstance(arg[2], type(u' ')):
				part_nos = []
				for part_no in arg[2].split(','):
					part_nos.append(part_no.strip())
				idx = new_args.index(arg)
				new_args.remove(arg)
				new_args.insert(idx, [arg[0],arg[1],part_nos])
							
		#get the search result		
		ids = super(product_product,self).search(cr, user, new_args, offset, limit, order, context, count)

		return ids
Пример #5
0
 def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
     #the day search support
     new_args = utils.deal_args_dt(cr, user, self, args,['last_punch_time'],context=context)
     return super(hr_employee,self).search(cr, user, new_args, offset, limit, order, context, count)