diff --git a/addons/hr_holidays/models/hr_leave.py b/addons/hr_holidays/models/hr_leave.py index c354e1ed583..a5c3fe9674f 100644 --- a/addons/hr_holidays/models/hr_leave.py +++ b/addons/hr_holidays/models/hr_leave.py @@ -749,12 +749,13 @@ Attempting to double-book your time off won't magically make your vacation 2x be leave_type = leave.holiday_status_id if leave_type.requires_allocation == 'no': continue - employee = leave.employee_id + employees = leave._get_employees_from_holiday_type() date_from = leave.date_from.date() - leave_data = leave_type.get_allocation_data(employee, date_from) + leave_data = leave_type.get_allocation_data(employees, date_from) max_excess = leave_type.max_allowed_negative if leave_type.allows_negative else 0 - if leave_data[employee][0][1]['total_virtual_excess'] > max_excess: - raise ValidationError(_("You don't have a valid allocation to cover that request.")) + for employee in employees: + if leave_data[employee][0][1]['total_virtual_excess'] > max_excess: + raise ValidationError(_("There is no valid allocation to cover that request.")) #################################################### # ORM Overrides methods diff --git a/addons/l10n_fr_hr_holidays/models/hr_leave.py b/addons/l10n_fr_hr_holidays/models/hr_leave.py index 3e552b03a9c..098c0e7973f 100644 --- a/addons/l10n_fr_hr_holidays/models/hr_leave.py +++ b/addons/l10n_fr_hr_holidays/models/hr_leave.py @@ -80,7 +80,7 @@ class HrLeave(models.Model): else: leave.l10n_fr_date_to_changed = False - def _get_duration(self, resource_calendar=None): + def _get_duration(self, check_leave_type=True, resource_calendar=None): """ In french time off laws, if an employee has a part time contract, when taking time off before one of his off day (compared to the company's calendar) it should also count the time