示例#1
0
文件: hr_clock.py 项目: newmooncn/dm
 def refresh_clock_info(self, cr, uid, ids, context=None):  
     clock = clock_util.clock_obj()
     for clock_data in self.browse(cr, uid, ids, context=context):
         #connect clock
         clock_util.clock_connect(clock, clock_data.ip,clock_data.port)
         #download data
         clock_info = clock_util.clock_status(clock)
         #disconnect clock
         clock_util.clock_disconnect(clock)
         #update data
         self.write(cr, uid, clock_data.id, {'clock_info':clock_info},context=context)
         
     return True
示例#2
0
文件: hr_clock.py 项目: newmooncn/dm
 def set_clock_time(self, cr, uid, ids, clock_time = None, context=None):  
     clock = clock_util.clock_obj()
     for clock_data in self.browse(cr, uid, ids, context=context):
         #connect clock
         clock_util.clock_connect(clock, clock_data.ip,clock_data.port)
         #set clock time
         if not clock_time:
             clock_time = fields.datetime.context_timestamp(cr, uid, datetime.utcnow(), context)
         clock_util.clock_time_set(clock,clock_time)
         #refresh data including time
         clock_info = clock_util.clock_status(clock)
         #disconnect clock
         clock_util.clock_disconnect(clock)
         #update data
         self.write(cr, uid, clock_data.id, {'clock_info':clock_info},context=context)
     return True
示例#3
0
    def refresh_clock_info(self, cr, uid, ids, context=None):
        clock = clock_util.clock_obj()
        for clock_data in self.browse(cr, uid, ids, context=context):
            #connect clock
            clock_util.clock_connect(clock, clock_data.ip, clock_data.port)
            #download data
            clock_info = clock_util.clock_status(clock)
            #disconnect clock
            clock_util.clock_disconnect(clock)
            #update data
            self.write(cr,
                       uid,
                       clock_data.id, {'clock_info': clock_info},
                       context=context)

        return True
示例#4
0
 def set_clock_time(self, cr, uid, ids, clock_time=None, context=None):
     clock = clock_util.clock_obj()
     for clock_data in self.browse(cr, uid, ids, context=context):
         #connect clock
         clock_util.clock_connect(clock, clock_data.ip, clock_data.port)
         #set clock time
         if not clock_time:
             clock_time = fields.datetime.context_timestamp(
                 cr, uid, datetime.utcnow(), context)
         clock_util.clock_time_set(clock, clock_time)
         #refresh data including time
         clock_info = clock_util.clock_status(clock)
         #disconnect clock
         clock_util.clock_disconnect(clock)
         #update data
         self.write(cr,
                    uid,
                    clock_data.id, {'clock_info': clock_info},
                    context=context)
     return True