表 x_giolam:
class x_giolam(osv.osv):
_name = 'x_giolam'
_description = 'Gio Lam'
_columns = {
'name': fields.integer('Lọai',size=64,required="true"),
'giolam' : fields.float('Gio lam',size=64,required="True"),
'time_in': fields.char('Gio vào',size=20),
'time_out' :fields.char('Gio về',size=20),
}
x_giolam()
表 x_luong:
class x_luong(osv.osv):
_name = 'x_luong'
_description = 'Luong'
_columns = {
'name': fields.many2one('x_nhanvien','Mã nhân viên',size=10,required='1'),
'ma_luong': fields.integer('ma luong',size=10,required='1'),
'giolam': fields.float('Giờ làm',size=100,required='1'),
'giolamthuc': fields.char('Gio lam thuc te',size=5,required='1'),
'time_in': fields.char('Gio vào',size=20),
'time_out' :fields.char('Gio về',size=20),
'state' :fields.selection([('dangnhap','Đẳng nhập.'),('rave','Ra về')]),
'test': fields.integer('Kiem tra',size=20),
'phutvao': fields.integer('Phut vao ',size=20),
'phutra': fields.integer('phut ra',size=20),
}
函数插入();
def insert(self,cr,uid,ids,context={}):
obj=self.browse(cr,uid,ids,context=context)
values={'name':obj.ma_luong.id,
'giolam':obj.giolam,
'time_in':obj.time_in,
'time_out':obj.time_out,
}
self.pool.get('x_giolam').create(cr,uid,values,context=context)
最后这是错误:
AttributeError: 'browse_record_list' object has no attribute 'ma_luong'
我在 x_luong 中的 openerp 和 self 函数中执行此操作
我想向表 x_giolam 插入一些属性,但有这个错误。请帮帮我谢谢!!!