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_leaves

View 19.0 View 20.0
Inputs Method Outputs
  • employee_id
  • holiday_status_id
  • work_entry_type_id
- date_from = fields.Date.today()
- employee_days_per_allocation = self.employee_id._get_consumed_leaves(self.holiday_status_id, date_from)[0]
- for allocation in self:
-             origin = allocation._origin
-             virtual_leave = employee_days_per_allocation[origin.employee_id][origin.holiday_status_id][origin]
-             allocation.max_leaves = virtual_leave['max_leaves']
-             allocation.leaves_taken = virtual_leave['leaves_taken']
-             allocation.virtual_remaining_leaves = virtual_leave['virtual_remaining_leaves']
+ date_from = fields.Date.context_today(self)
+ employee_days_per_allocation = self.employee_id._get_consumed_leaves(self.work_entry_type_id, date_from)[0]
+ self._set_leaves_from_consumption_data(employee_days_per_allocation)
  • max_leaves
  • leaves_taken
  • virtual_remaining_leaves

Back to entity