I just need to insert into a table the results of a search into a one2many field.
It works, but only write the last record that match the search parameter and I want to write, all of them, not only the last one created.
This is my code.
@api.model
def create(self, vals):
domain =[('first_name','=','Luis')]
student = self.env['university.student'].search(domain)
for record in student:
vals.update({'participants_ids':[(0,0,{
'first_name_participant':record.first_name,
'last_name_participant':record.last_name,
})]})
return super(university_course,self).create(vals)