diff --git a/hr_employee_calendar_planning/models/hr_employee.py b/hr_employee_calendar_planning/models/hr_employee.py index ae4ca0cfe8a..2aa64463abd 100644 --- a/hr_employee_calendar_planning/models/hr_employee.py +++ b/hr_employee_calendar_planning/models/hr_employee.py @@ -188,9 +188,7 @@ class HrEmployeeCalendar(models.Model): string="End Date", ) employee_id = fields.Many2one( - comodel_name="hr.employee", - string="Employee", - required=True, + comodel_name="hr.employee", string="Employee", required=True, ondelete="cascade" ) company_id = fields.Many2one(related="employee_id.company_id") calendar_id = fields.Many2one( @@ -198,6 +196,7 @@ class HrEmployeeCalendar(models.Model): string="Working Time", required=True, check_company=True, + ondelete="restrict", ) _sql_constraints = [