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.allocation

Compute Method: _compute_description

Inputs Method Outputs
self.check_access_rights('read')
self.check_access_rule('read')
for allocation in self:
            if not allocation.env.context.get('is_employee_allocation'):
                allocation.name = allocation.sudo().private_name
            elif not allocation.holiday_status_id:
                allocation.name = _("Allocation Request")
            elif allocation.type_request_unit == 'hour':
                allocation.name = _(
                    '%(name)s (%(duration)s hour(s))',
                    name=allocation.holiday_status_id.name,
                    duration=allocation.number_of_days * (
                        allocation.employee_id.sudo().resource_calendar_id.hours_per_day
                        or allocation.holiday_status_id.company_id.resource_calendar_id.hours_per_day
                        or HOURS_PER_DAY
                    ),
                )
            else:
                allocation.name = _(
                    '%(name)s (%(duration)s day(s))',
                    name=allocation.holiday_status_id.name,
                    duration=allocation.number_of_days,
                )

Back to entity