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.employee.base
Compute Method: _compute_allocation_count
| Inputs | Method | Outputs |
|---|---|---|
|
- current_date = date.today() - data = self.env['hr.leave.allocation']._read_group([ - ('employee_id', 'in', self.ids), - ('holiday_status_id.active', '=', True), - ('holiday_status_id.requires_allocation', '=', 'yes'), - ('state', '=', 'validate'), - ('date_from', '<=', current_date), - '|', - ('date_to', '=', False), - ('date_to', '>=', current_date), - ], ['employee_id'], ['__count', 'number_of_days:sum']) - rg_results = {employee.id: (count, days) for employee, count, days in data} - for employee in self: - count, days = rg_results.get(employee.id, (0, 0)) - employee.allocation_count = float_round(days, precision_digits=2) - employee.allocations_count = count |
|
