Skip to content

Commit

Permalink
[REF] resource_work_time_from_contracts: add fixme comments
Browse files Browse the repository at this point in the history
  • Loading branch information
robinkeunen committed Feb 8, 2024
1 parent 8d6eb34 commit 7047976
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ class ResourceCalendarLeaves(models.Model):
# leaves for all resources are defined in the same resource calendar,
# which is needed to compute working hours while taking leaves into
# account.
# fixme A readonly related field without an inverse method should not have a
# default value, as it does not make sense.
# cf odoo/odoo/fields.py:626
calendar_id = fields.Many2one(
"resource.calendar",
related="resource_id.calendar_id",
Expand Down
4 changes: 1 addition & 3 deletions resource_work_time_from_contracts/models/resource_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from pytz import timezone, utc

from odoo import fields, models
from odoo import models
from odoo.tools import float_utils

from odoo.addons.resource.models.resource import ROUNDING_FACTOR
Expand All @@ -16,8 +16,6 @@ class ResourceMixin(models.AbstractModel):

_inherit = "resource.mixin"

resource_calendar_id = fields.Many2one("resource.calendar")

def list_work_time_per_day(
self,
from_datetime,
Expand Down
4 changes: 4 additions & 0 deletions resource_work_time_from_contracts/models/resource_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ class ResourceResource(models.Model):
_inherit = "resource.resource"

# force this field to be equal to the resource_calendar_id of the company.
# fixme A readonly related field without an inverse method should not have a
# default value, as it does not make sense.
# cf odoo/odoo/fields.py:626

calendar_id = fields.Many2one(
"resource.calendar",
related="company_id.resource_calendar_id",
Expand Down

0 comments on commit 7047976

Please sign in to comment.