Steps : - On a new DB (no demo data). Say created at 15:00. - Go to planning. - Add a shift for today. - Set the dates from 08:00 to 17:00. Issue : The 'Allocated Time' = 02:00. Cause : We used to count from the resource creation min to the departure max. So, in this case, not from 08:00, but from 15:00. While this might seem logical, it confuses users in onboarding. Fix : Calculate the whole time, regardless of the resource lifespan. Notes : - Similar issues solved with this commit : > Once the shift validated, the avatar progress bar uses the same allocated time. > Same in Project Task gantt view. - When contract is installed, if the resource does not have a contract, the Allocated Time = 0. Now, it is calculated from the resource calendar. task-2983993 closes odoo/odoo#102732 X-original-commit: 6a61d1c4c56075ade36f6f32e7a61f1f6c771a6f Related: odoo/enterprise#32547 Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
15 lines
478 B
Python
15 lines
478 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
from pytz import utc, timezone
|
|
from datetime import datetime
|
|
|
|
from odoo import fields, models
|
|
from odoo.addons.resource.models.resource import Intervals
|
|
|
|
|
|
class ResourceResource(models.Model):
|
|
_inherit = "resource.resource"
|
|
|
|
user_id = fields.Many2one(copy=False)
|
|
employee_id = fields.One2many('hr.employee', 'resource_id', domain="[('company_id', '=', company_id)]")
|