Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
1772 Widoki

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









Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
3
wrz 25
2659
0
sie 25
215
1
sie 25
2192
2
lip 25
8080
2
lip 25
4540