|
|
is_officer = self.env.user.has_group('hr_holidays.group_hr_holidays_user')
today = fields.Date.context_today(self)
for holiday in self:
if holiday.state in ('validate', 'validate1') and holiday.validation_type != 'no_validation':
holiday.can_reschedule = holiday._check_approval_update('confirm', raise_if_not_possible=False)
elif holiday.state in ('confirm', 'validate', 'validate1'):
began_in_past = holiday.date_from and holiday.date_from.date() < today
holiday.can_reschedule = (
(is_officer or not began_in_past or holiday.employee_id.leave_manager_id == self.env.user)
and holiday.has_access('write')
)
else:
holiday.can_reschedule = False
|
|