我的项目有问题:
def get_timein(self, cr, uid, ids, context={}):
obj = self.browse(cr, uid, ids, context=context)[0]
timein = str(datetime.now())
self.write(cr, uid, ids, {'time_in':timein }, context=context)
return 1
def get_timeout(self, cr, uid, ids, context={}):
obj=self.browse(cr, uid, ids, context=context)[0]
timeout=str(datetime.now())
self.write(cr, uid, ids, {'time_out':timeout }, context=context)
return 1
def cho_dangnhap(self, cr, uid, ids, context={}):
self.pool.get('x_luong').write(cr, uid, ids, {'state':'dangnhap'})
get_timein(cr,uid,ids)
return 1
def cho_rave(self, cr, uid, ids, context={}):
self.pool.get('x_luong').write(cr, uid, ids, {'state':'rave'})
get_timeout(cr, uid, ids)
我收到此错误:
NameError: global name 'get_timeout' is not defined
答案 0 :(得分:0)
def cho_dangnhap(self,cr,uid,ids,context={}):
self.pool.get('x_luong').write(cr,uid,ids,{'state':'dangnhap'})
self.get_timein(cr,uid,ids)
return 1
def cho_rave(self,cr,uid,ids,context={}):
self.pool.get('x_luong').write(cr,uid,ids,{'state':'rave'})
self.get_timeout(cr,uid,ids)
需要self.
方法之前的函数。