Hi!
I've got these 3 classes: shift.shift, shift.ticket and shift.registration.
Dans shift.shift, j'ai:
shift_ticket_ids = fields.One2many(
'shift.ticket', 'shift_id', string='Shift Ticket',
default=lambda rec: rec._default_shift_tickets())
et dans shift.ticket, j'ai:
registration_ids = fields.One2many(
'shift.registration', 'shift_ticket_id', 'Registrations')
In an onchange method on the shift.shift class, I'd like to create some shift ticket and shift.registration records.
    @api.onchange('shift_template_id')
    def _onchange_template_id(self):
       if self.shift_template_id:
            vals = []
           for ticket in self.shift_ticket_ids:
                ticket.unlink()
            for ticket in self.shift_template_id.shift_ticket_ids:
                attendee_vals = []
                for attendee in ticket.registration_ids:
                    attendee_vals.append((0, 0, {
                        'partner_id': attendee.partner_id.id,
                        'state': 'draft',
                        'email': attendee.email,
                        'phone': attendee.phone,
                        'name': attendee.name,
                    }))
                ticket_vals = {
                    'name': ticket.name,
                    'product_id': ticket.product_id.id,
                    'price': ticket.price,
                    'deadline': ticket.deadline,
                    'seats_availability': ticket.seats_availability,
                    'registration_ids': attendee_vals,
                }
                vals.append((0, 0, ticket_vals))
            self.shift_ticket_ids = vals
But this doesn't work: the shift_ticket records are created, but not the shift_registration records.
How could I manage this situation?
Thanks.
Julien
