Skip to Content
मेन्यू
This question has been flagged
1 Reply
1765 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
3
सित॰ 25
2658
0
अग॰ 25
212
1
अग॰ 25
2185
2
जुल॰ 25
8075
2
जुल॰ 25
4527