[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#62821 X-original-commit: fc962de2b60adaa1ffa3bf70bfadc5c3d17867b3 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
@@ -1005,11 +1005,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)")
|
||||
|
||||
Reference in New Issue
Block a user