OCA / hr-holidays

Human Resources Holidays OCA modules for Odoo
GNU Affero General Public License v3.0
36 stars 107 forks source link

Error message when applying for a vacation #8

Closed gradox2020 closed 3 years ago

gradox2020 commented 4 years ago

If I want to apply for a vacation in the dashboard, as it says in the description, I get the following error message: Fehler: Odoo Server Error

Traceback (most recent call last): File "/opt/odoo/odoo13/odoo/api.py", line 745, in get value = self._data[field][record._ids[0]] KeyError: <NewId 0x7f224c098048>

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/odoo/odoo13/odoo/fields.py", line 996, in get value = env.cache.get(record, self) File "/opt/odoo/odoo13/odoo/api.py", line 751, in get raise CacheMiss(record, field) odoo.exceptions.CacheMiss: ('hr.leave(<NewId 0x7f224c098048>,).number_of_hours_display', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/odoo/odoo13/odoo/api.py", line 745, in get value = self._data[field][record._ids[0]] KeyError: 7

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/odoo/odoo13/odoo/fields.py", line 996, in get value = env.cache.get(record, self) File "/opt/odoo/odoo13/odoo/api.py", line 751, in get raise CacheMiss(record, field) odoo.exceptions.CacheMiss: ('hr.employee(7,).resource_calendar_id', None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/odoo/odoo13/odoo/http.py", line 624, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/opt/odoo/odoo13/odoo/http.py", line 310, in _handle_exception raise pycompat.reraise(type(exception), exception, sys.exc_info()[2]) File "/opt/odoo/odoo13/odoo/tools/pycompat.py", line 14, in reraise raise value File "/opt/odoo/odoo13/odoo/http.py", line 669, in dispatch result = self._call_function(self.params) File "/opt/odoo/odoo13/odoo/http.py", line 350, in _call_function return checked_call(self.db, *args, *kwargs) File "/opt/odoo/odoo13/odoo/service/model.py", line 94, in wrapper return f(dbname, args, kwargs) File "/opt/odoo/odoo13/odoo/http.py", line 339, in checked_call result = self.endpoint(*a, kw) File "/opt/odoo/odoo13/odoo/http.py", line 915, in call return self.method(*args, *kw) File "/opt/odoo/odoo13/odoo/http.py", line 515, in response_wrap response = f(args, kw) File "/opt/odoo/odoo13/addons/web/controllers/main.py", line 1322, in call_kw return self._call_kw(model, method, args, kwargs) File "/opt/odoo/odoo13/addons/web/controllers/main.py", line 1314, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/opt/odoo/odoo13/odoo/api.py", line 387, in call_kw result = _call_kw_multi(method, model, args, kwargs) File "/opt/odoo/odoo13/odoo/api.py", line 374, in _call_kw_multi result = method(recs, *args, **kwargs) File "/opt/odoo/odoo13/odoo/models.py", line 6071, in onchange value = record[name] File "/opt/odoo/odoo13/odoo/models.py", line 5610, in getitem return self._fields[key].get(self, type(self)) File "/opt/odoo/odoo13/odoo/fields.py", line 1020, in get self.compute_value(recs) File "/opt/odoo/odoo13/odoo/fields.py", line 1105, in compute_value records._compute_field_value(self) File "/opt/odoo/odoo13/odoo/models.py", line 3915, in _compute_field_value getattr(self, field.compute)() File "/opt/odoo/odoo13/addons/hr_holidays/models/hr_leave.py", line 435, in _compute_number_of_hours_display calendar = holiday._get_calendar() File "/opt/odoo/odoo13/addons/hr_holidays/models/hr_leave.py", line 430, in _get_calendar return self.employee_id.resource_calendar_id or self.env.company.resource_calendar_id File "/opt/odoo/odoo13/odoo/fields.py", line 2294, in get return super().get(records, owner) File "/opt/odoo/odoo13/odoo/fields.py", line 1003, in get recs._fetch_field(self) File "/opt/odoo/odoo13/odoo/models.py", line 2944, in _fetch_field self._read(fnames) File "/opt/odoo/odoo13/addons/hr/models/hr_employee.py", line 133, in _read res = self.env['hr.employee.public'].browse(self.ids).read(fields) File "/opt/odoo/odoo13/odoo/models.py", line 2893, in read raise ValueError("Invalid field %r on model %r" % (name, self._name)) ValueError: Invalid field 'name_related' on model 'hr.employee.public'

But if I do the same with the admin user then the error message does not come up Thanks a lot

pedrobaeza commented 4 years ago

Which module? Which version? Detailed steps to reproduce the problem?

gradox2020 commented 4 years ago

Module: hr_holiday_public Version: 13.0.1.0.1

Odoo 13.0 (Community Edition)

Step to reproduce the Problem: in all Leave Types I have checked "Exclude Public Holidays" to exclude public holidays.

I add public holidays in Leaves > Public Holidays > Public Holidays

in Leaves dashbord I selected the Days I want to be on leave.

Then I got the Error

pedrobaeza commented 4 years ago

Can you also indicate which public holidays and which leave (dates)?

gradox2020 commented 4 years ago

Bildschirmfoto vom 2020-05-11 14-02-44

gradox2020 commented 4 years ago

Bildschirmfoto vom 2020-05-11 14-04-49

gradox2020 commented 4 years ago

Bildschirmfoto vom 2020-05-11 14-05-25

gradox2020 commented 4 years ago

I uninstalled the module hr_attendance_report_theoretical_time then it worked as desired

Technical Name | hr_attendance_report_theoretical_time License | Affero GPL-3 Latest Version | 13.0.1.0.1

pedrobaeza commented 4 years ago

OK, thanks for digging about the reason.

@jarroyomorales maybe you can check for the problem?

gradox2020 commented 4 years ago

@pedrobaeza @jarroyomorales

I have solved the problem as follows: I created in Module hr_attendance_report_theoretical_time a new model in the modules folder (hr_employee_public.py) I have added the field theoretical_hours_start_date to the hr.emloyee.public as follows: from odoo import fields, models class HrEmployeePublic(models.Model): _inherit = "hr.employee.public"

theoretical_hours_start_date = fields.Date(
    help="Fill this field for setting a manual start date for computing "
    "the theoretical hours independently from the attendances. If "
    "not filled, employee creation date or the calendar start date "
    "will be used (the greatest of both)."
)

This solved the problem for me. Can you please check that it is correct Many thanks

pedrobaeza commented 3 years ago

This should be solved since a while.

jumans92 commented 3 years ago

Hi, I have a similar error. Odoo 13.0 (Community Edition)

In the selection process module, when I click on applications > create > skills, create a new entry I get this error. It also appears when I click on the skill_level_id field.

Odoo Server Error Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/models.py", line 5219, in _update_cache field_values = [(fields[name], value) for name, value in values.items()] File "/usr/lib/python3/dist-packages/odoo/models.py", line 5219, in field_values = [(fields[name], value) for name, value in values.items()] KeyError: 'stage_id'

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 1339, in call_kw return self._call_kw(model, method, args, kwargs) File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1331, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/usr/lib/python3/dist-packages/odoo/api.py", line 387, in call_kw result = _call_kw_multi(method, model, args, kwargs) File "/usr/lib/python3/dist-packages/odoo/api.py", line 374, in _call_kw_multi result = method(recs, *args, **kwargs) File "/usr/lib/python3/dist-packages/odoo/models.py", line 6225, in onchange record = self.new(initial_values, origin=self) File "/usr/lib/python3/dist-packages/odoo/models.py", line 5577, in new record._update_cache(values, validate=False) File "/usr/lib/python3/dist-packages/odoo/models.py", line 5225, in _update_cache cache.set(self, field, field.convert_to_cache(value, self, validate)) File "/usr/lib/python3/dist-packages/odoo/fields.py", line 2536, in convert_tocache id = comodel.new(value, origin=origin).id File "/usr/lib/python3/dist-packages/odoo/models.py", line 5577, in new record._update_cache(values, validate=False) File "/usr/lib/python3/dist-packages/odoo/models.py", line 5221, in _update_cache raise ValueError("Invalid field %r on model %r" % (e.args[0], self._name)) ValueError: Invalid field 'stage_id' on model 'hr.employee'

image