Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
1777 Prikazi

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
Opusti
Best Answer

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

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
3
sep. 25
2662
0
avg. 25
219
1
avg. 25
2207
2
jul. 25
8093
2
jul. 25
4545