summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorYannick Tivisse <yti@odoo.com>2020-12-03 09:55:31 +0000
committerYannick Tivisse <yti@odoo.com>2020-12-03 09:55:31 +0000
commitfc962de2b60adaa1ffa3bf70bfadc5c3d17867b3 (patch)
tree11cd25e12b9068acf1b6691edf51bfe6c614fb32 /addons
parentdef8eb4b51a80587f2b4a17da82ceb3abb7f017c (diff)
[IMP] resource: Index calendar/resources on calendar leaves
Improves performances, notably on the method https://github.com/odoo/odoo/blame/14.0/addons/resource/models/resource.py#L487 closes odoo/odoo#62791 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/resource/models/resource.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/resource/models/resource.py b/addons/resource/models/resource.py
index 6449665a7db..605eb8924db 100644
--- a/addons/resource/models/resource.py
+++ b/addons/resource/models/resource.py
@@ -990,11 +990,11 @@ class ResourceCalendarLeaves(models.Model):
company_id = fields.Many2one(
'res.company', related='calendar_id.company_id', string="Company",
readonly=True, store=True)
- calendar_id = fields.Many2one('resource.calendar', 'Working Hours')
+ calendar_id = fields.Many2one('resource.calendar', 'Working Hours', index=True)
date_from = fields.Datetime('Start Date', required=True)
date_to = fields.Datetime('End Date', required=True)
resource_id = fields.Many2one(
- "resource.resource", 'Resource',
+ "resource.resource", 'Resource', index=True,
help="If empty, this is a generic time off for the company. If a resource is set, the time off is only for this resource")
time_type = fields.Selection([('leave', 'Time Off'), ('other', 'Other')], default='leave',
help="Whether this should be computed as a time off or as work time (eg: formation)")