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

Hello,

minimal example...

class School(models.Model):
related_student = fields.One2many('school.student', 'school_student_id')
related_book = fields.Many2many(related='related_student.related_book')


I can see all related students but only 1 book. I want to see all books of all students.


Thank you









アバター
破棄
最善の回答

self.related_student.mapped('books_field_in_student_model') // this returns all distinct books of this school.

アバター
破棄
関連投稿 返信 ビュー 活動
3
9月 25
2709
0
8月 25
314
1
8月 25
2326
2
7月 25
8136
2
7月 25
4576