2016-11-20 44 views
1

計時器(遞減計數/計數),我想創建在odoo視圖計時器支持運行/暫停類似足球比賽時間,分:秒格式創建odoo

我嘗試下面的代碼,但它產生的誤差

@api.one 
def timer_th(self): 
    timer_thread = Thread(target=self.timer) 
    timer_thread.start() 

def timer(self): 
    while self.current_time <= self.duration: 
     time.sleep(1) 
     self.current_time += 1 

它給了我AttributeError的:環境錯誤

但是當我使用的代碼,而無需線程它的工作原理,但GUI不響應

回答