跳至內容
選單
此問題已被標幟
1 回覆
1768 瀏覽次數

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
2659
0
8月 25
215
1
8月 25
2192
2
7月 25
8080
2
7月 25
4540