[FIX] hr_holidays: Improve dashboard loading time

closes odoo/odoo#150857

Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Yannick Tivisse
2024-01-24 14:02:19 +00:00
parent 0818a8497f
commit 5e1a6e6a72
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ class Contract(models.Model):
name = fields.Char('Contract Reference', required=True)
active = fields.Boolean(default=True)
structure_type_id = fields.Many2one('hr.payroll.structure.type', string="Salary Structure Type", compute="_compute_structure_type_id", readonly=False, store=True)
employee_id = fields.Many2one('hr.employee', string='Employee', tracking=True, domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]")
employee_id = fields.Many2one('hr.employee', string='Employee', tracking=True, domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", index=True)
department_id = fields.Many2one('hr.department', compute='_compute_employee_contract', store=True, readonly=False,
domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", string="Department")
job_id = fields.Many2one('hr.job', compute='_compute_employee_contract', store=True, readonly=False,
+1 -1
View File
@@ -365,7 +365,7 @@ class HolidaysType(models.Model):
'|',
('company_id', 'in', self.env.context.get('allowed_company_ids')),
('company_id', '=', False),
])
], order='id')
employee = self.env['hr.employee']._get_contextual_employee()
if employee:
return leave_types.get_allocation_data(employee, target_date)[employee]