[IMP] hr_timesheet: add index in project_id on timesheets model
Before this commit, a search to find the timesheets is slow because the model containing the timesheets contained also the basic AAL and so many records could be stored into that model. This commit adds an index on project_id field in that model to search quicker than before the timesheets since a AAL is a timesheet when the `project_id` field is set. Closes #85513 X-original-commit: 8cc4006 Part-of: odoo/odoo#85968 Co-authored-by: Yannick Tivisse <yti@odoo.com> Co-authored-by: Laurent Stukkens (LTU) <ltu@odoo.com>
This commit is contained in:
committed by
Laurent Stukkens (LTU)
co-authored by
Yannick Tivisse
Laurent Stukkens
parent
57346c85f8
commit
ed484ba8bc
@@ -44,7 +44,7 @@ class AccountAnalyticLine(models.Model):
|
||||
compute='_compute_task_id', store=True, readonly=False,
|
||||
domain="[('company_id', '=', company_id), ('project_id.allow_timesheets', '=', True), ('project_id', '=?', project_id)]")
|
||||
project_id = fields.Many2one(
|
||||
'project.project', 'Project', domain=_domain_project_id,
|
||||
'project.project', 'Project', domain=_domain_project_id, index=True,
|
||||
compute='_compute_project_id', store=True, readonly=False)
|
||||
user_id = fields.Many2one(compute='_compute_user_id', store=True, readonly=False)
|
||||
employee_id = fields.Many2one('hr.employee', "Employee", domain=_domain_employee_id, context={'active_test': False})
|
||||
|
||||
Reference in New Issue
Block a user