Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4074 มุมมอง

hi, 

The code that I have is this : 

'class_ids': fields.many2many('class.class', 'discipline_class_rel', 'discipline_id', 'class_id', 'Class',),

 

'student_id': fields.related('class_ids','student', type="many2many", relation="res.partner", string="Student", store=True)

 

Is it possible to the first parameter ('class_ids') of a fields.related() to be a fields.many2many ? 

For some reason I get this error:

cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" %s' % (self._table, k, get_pg_type(f)[1]))
TypeError: 'NoneType' object is unsubscriptable

Is it possible to do this ? 

Thanks

 

 

 

อวตาร
ละทิ้ง

Maybe you could expand and explain better what Models you are using and how they relate between them. My suspicions is that you don't actually need a "fields.related"...

ผู้เขียน

I used a workaround, thanks!

คำตอบที่ดีที่สุด

Hi

Try this code

'class_ids': fields.many2many('class.class', 'discipline_class_rel', 'discipline_id', 'class_id', 'Class',),
'student_id': fields.related('class_ids','student_id', type="many2many", relation="res.partner", string="Student")

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
พ.ค. 16
3112
0
มี.ค. 15
6870
2
มี.ค. 15
9628
2
มี.ค. 15
8020
1
มี.ค. 15
7516