Skip to content

Commit

Permalink
[IMP] resource: Index calendar/resources on calendar leaves
Browse files Browse the repository at this point in the history
Improves performances, notably on the method  https://github.com/odoo/odoo/blame/14.0/addons/resource/models/resource.py#L487

closes odoo#62791

Signed-off-by: Yannick Tivisse (yti) <[email protected]>
  • Loading branch information
tivisse committed Dec 3, 2020
1 parent def8eb4 commit fc962de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addons/resource/models/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)")
Expand Down

0 comments on commit fc962de

Please sign in to comment.