Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
1766 Vistas

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
Descartar
Mejor respuesta

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

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
3
sept 25
2659
0
ago 25
215
1
ago 25
2192
2
jul 25
8080
2
jul 25
4540