This question has been flagged
2 Replies
3850 Views

Hello guys, I'm working in the event.event (Events) model in Odoo 9, I want to add inside the events a Many2many field with all  the attendees from event.registration that will go to that event, but I can't make it automatically, I tried this:


asistentes_de_eventos = fields.Many2many('event.registration', store=True, compute="_get_asistentes")

@api.multi

    def _get_asistentes(self):

        aux_ids = self.env['event.registration']

        for aux in aux_ids:

            self.asistentes_de_eventos = [(4,[aux.id])]

But my many2many field is empty, could anyone help me?


Thank You.


Avatar
Discard
Best Answer

Hi @Jorge, your question helped me solve a very simular problem, thanks!

I noticed you have `[(4,[aux.id])]` which has too many square brackets. Try `[(4, aux.id)]`

Avatar
Discard
Author Best Answer

With default option I can see all the records from event.registration model, but only when I create a new event, in events created before the many2many field is empty, I can't solve it.

Avatar
Discard