コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
4172 ビュー

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")

アバター
破棄
関連投稿 返信 ビュー 活動
0
5月 16
3215
0
3月 15
6938
2
3月 15
9698
2
3月 15
8093
1
3月 15
7597