Skip to Content
Menu
This question has been flagged
1 Reply
1418 Views

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









Avatar
Discard
Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 24
1482
1
Nov 24
1188
2
Sep 24
1046
1
Aug 24
2450
3
Aug 24
2684