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

View 17.0 View 20.0
Inputs Method Outputs
  • holiday_status_id
  • type_request_unit
  • holiday_status_id.name
  • number_of_days
  • employee_id
  • holiday_status_id.company_id
  • holiday_status_id.company_id.resource_calendar_id
  • holiday_status_id.company_id.resource_calendar_id.hours_per_day
  • is_name_custom
- 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,
-                 )
+             if not allocation.is_name_custom:
+                 allocation.name = allocation._get_title()
  • name

Back to entity