跳至内容
菜单
此问题已终结
1 回复
1785 查看

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
2665
0
8月 25
239
1
8月 25
2235
2
7月 25
8103
2
7月 25
4548