OCA/hr-attendance

Auto close breaks timeoff request

Closed this issue · 1 comments

Module

hr_attendance_autoclose

Describe the bug

ValueError: Invalid field 'no_autoclose' on model 'hr.employee.public'

To Reproduce

install timeoff and autoclose together and try to request timeoff with regular user.

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
Алдаа:
Odoo Server Error

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/api.py", line 748, in get
value = self._data[field][record._ids[0]]
KeyError: <NewId 0x7fbb2943fb00>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1038, in get
value = env.cache.get(record, self)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 754, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('hr.leave(<NewId 0x7fbb2943fb00>,).number_of_hours_display', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/api.py", line 748, in get
value = self._data[field][record._ids[0]]
KeyError: 369

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1038, in get
value = env.cache.get(record, self)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 754, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ('hr.employee(369,).resource_calendar_id', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 624, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/usr/lib/python3/dist-packages/odoo/http.py", line 669, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 350, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 915, in call
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 515, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1342, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1334, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 390, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 377, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 6265, in onchange
value = record[name]
File "/usr/lib/python3/dist-packages/odoo/models.py", line 5761, in getitem
return self._fields[key].get(self, type(self))
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1062, in get
self.compute_value(recs)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1147, in compute_value
records._compute_field_value(self)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 4018, in _compute_field_value
getattr(self, field.compute)()
File "/usr/lib/python3/dist-packages/odoo/addons/hr_holidays/models/hr_leave.py", line 457, in _compute_number_of_hours_display
calendar = holiday._get_calendar()
File "/usr/lib/python3/dist-packages/odoo/addons/hr_holidays/models/hr_leave.py", line 452, in _get_calendar
return self.employee_id.resource_calendar_id or self.env.company.resource_calendar_id
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 2370, in get
return super().get(records, owner)
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1045, in get
recs._fetch_field(self)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 3003, in _fetch_field
self._read(fnames)
File "/usr/lib/python3/dist-packages/odoo/addons/hr/models/hr_employee.py", line 133, in _read
res = self.env['hr.employee.public'].browse(self.ids).read(fields)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 2952, in read
raise ValueError("Invalid field %r on model %r" % (name, self._name))
ValueError: Invalid field 'no_autoclose' on model 'hr.employee.public'

Should be fixed by this commit

42dd6dc