Skip to Content
Menu
This question has been flagged
1 Atsakyti
1782 Rodiniai

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









Portretas
Atmesti
Best Answer

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

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
3
rugs. 25
2664
0
rugp. 25
224
1
rugp. 25
2223
2
liep. 25
8098
2
liep. 25
4548