In Odoo 17, to ensure that One2many records are deleted when the parent record is deleted, you need to configure the One2many field with the proper on delete attribute. This attribute controls the behavior of related records when the parent record is deleted.