Hi everybody, I want to ask you a question. I have an error :TypeError: string indices must be integers
code .py
class danh_sach_nv(osv.Model):
_name = 'danh.sach.nv'
_rec_name = 'ma_nv'
_columns = {
'ma_nv':fields.char('Mã NV',size=30),
'luong_dc':fields.related('ma_nv', 'luong_dc', type='many2one', relation='dieu.chinh', store=True, string='Lương điều chỉnh', readonly = 'True'),
}
class dieu_chinh(osv.Model):
_name = 'dieu.chinh'
_columns = {
'state': fields.selection([('draft', 'Draft'),('cancel', 'Cancel'),('done', 'Confirmed') ], 'Status',readonly=True,track_visibility='onchange'),
'image_nv':fields.related('ma_nv', 'image_nv',readonly = 'True', type ='binary', string = 'Ảnh đại diện'),
'ma_nv':fields.many2one('danh.sach.nv', 'Mã NV'),
'luong_dc':fields.integer('Lương điều chỉnh'),
}
Can you help me?I dont understan I have why I have an error?
Thank all
Hi huongcute you must change this line: 'luong_dc':fields.related('ma_nv', 'luong_dc', type='many2one', relation='dieu.chinh', store=True, string='Lương điều chỉnh', readonly = 'True'), instead of ma_nv you must give the class name(many2one).Thats why the error occured...Thank u
Sorry other class's(dieu_chinh) field name