Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
1 Responder
1767 Visualizações

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
Cancelar
Melhor resposta

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

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
3
set. 25
2659
0
ago. 25
215
1
ago. 25
2192
2
jul. 25
8080
2
jul. 25
4540