Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Time Off

Entity: hr.leave

Compute Method: _compute_can_reschedule

Inputs Method Outputs
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

Back to entity