Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] resource: current_interval not converted into namedtuple #33406


None yet
2 participants
Copy link

commented May 15, 2019

Description of the issue/feature this PR addresses:
While merging (calendar) intervals, the code path "union of greater intervals" does not convert the current_interval into the namedtuple "Interval" before passing it to the next method which leads to the described behavior.

Current behavior before PR:
When entering the "union of greater intervals" code path the following Traceback will be raised:

Traceback (most recent call last):
  File "/opt/odoo/11.0/production/odoo/community/odoo/", line 651, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/11.0/production/odoo/community/odoo/", line 310, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/opt/odoo/11.0/production/odoo/community/odoo/tools/", line 87, in reraise
    raise value
  File "/opt/odoo/11.0/production/odoo/community/odoo/", line 693, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/11.0/production/odoo/community/odoo/", line 342, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/11.0/production/odoo/community/odoo/service/", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/11.0/production/odoo/community/odoo/", line 335, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo/11.0/production/odoo/community/odoo/", line 937, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/11.0/production/odoo/community/odoo/", line 515, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/11.0/production/odoo/community/addons/web/controllers/", line 934, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/11.0/production/odoo/community/addons/web/controllers/", line 926, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/11.0/production/odoo/community/odoo/", line 687, in call_kw
    return call_kw_model(method, model, args, kwargs)
  File "/opt/odoo/11.0/production/odoo/community/odoo/", line 672, in call_kw_model
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/11.0/production/addons/oca/hr/hr_attendance_report_theoretical_time/reports/", line 231, in read_group
  File "/opt/odoo/11.0/production/addons/oca/hr/hr_attendance_report_theoretical_time/reports/", line 199, in _theoretical_hours
    date_date, time(23, 59, 59, 99999, tzinfo=tz.gettz(utz))
  File "/opt/odoo/11.0/production/odoo/community/addons/resource/models/", line 57, in get_work_days_data
  File "/opt/odoo/11.0/production/odoo/community/addons/resource/models/", line 440, in _iter_work_intervals
  File "/opt/odoo/11.0/production/odoo/community/addons/resource/models/", line 365, in _get_day_work_intervals
    for interval in working_intervals
  File "/opt/odoo/11.0/production/odoo/community/addons/resource/models/", line 366, in <listcomp>
    for sub_interval in self._interval_remove_leaves(interval, leaves)]
  File "/opt/odoo/11.0/production/odoo/community/addons/resource/models/", line 170, in _interval_remove_leaves
    leave_intervals = self._interval_merge(leave_intervals)
  File "/opt/odoo/11.0/production/odoo/community/addons/resource/models/", line 156, in _interval_merge
    working_interval = self._interval_or(working_interval, current_interval)
  File "/opt/odoo/11.0/production/odoo/community/addons/resource/models/", line 127, in _interval_or
    interval.start_datetime < interval_dst.start_datetime and interval.start_datetime or interval_dst.start_datetime,
AttributeError: 'tuple' object has no attribute 'start_datetime'

Desired behavior after PR is merged:
No Traceback.

I confirm I have signed the CLA and read the PR guidelines at

@robodoo robodoo added the seen 🙂 label May 15, 2019


This comment has been minimized.

Copy link
Contributor Author

commented May 15, 2019

CLA was accepted here #33370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.