跳至内容
菜单
此问题已终结
1 回复
3441 查看

I hope someone guides me on how to fix this ValueError.


Can't save My Time off Request here's the error:


RPC_ERROR

Odoo Server Error

Traceback (most recent call last):

File "/opt/odoo16/odoo/api.py", line 984, in get

cache_value = field_cache[record._ids[0]]

KeyError: 30


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

File "/opt/odoo16/odoo/fields.py", line 1160, in __get__

value = env.cache.get(record, self)

File "/opt/odoo16/odoo/api.py", line 991, in get

raise CacheMiss(record, field)

odoo.exceptions.CacheMiss: 'hr.employee(30,).department_id'


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

File "/opt/odoo16/odoo/http.py", line 1584, in _serve_db

return service_model.retrying(self._serve_ir_http, self.env)

File "/opt/odoo16/odoo/service/model.py", line 133, in retrying

result = func()

File "/opt/odoo16/odoo/http.py", line 1611, in _serve_ir_http

response = self.dispatcher.dispatch(rule.endpoint, args)

File "/opt/odoo16/odoo/http.py", line 1815, in dispatch

result = self.request.registry['ir.http']._dispatch(endpoint)

File "/opt/odoo16/addons/website/models/ir_http.py", line 235, in _dispatch

response = super()._dispatch(endpoint)

File "/opt/odoo16/odoo/addons/base/models/ir_http.py", line 154, in _dispatch

result = endpoint(**request.params)

File "/opt/odoo16/odoo/http.py", line 697, in route_wrapper

result = endpoint(self, *args, **params_ok)

File "/opt/odoo16/addons/web/controllers/dataset.py", line 42, in call_kw

return self._call_kw(model, method, args, kwargs)

File "/opt/odoo16/addons/web/controllers/dataset.py", line 33, in _call_kw

return call_kw(request.env[model], method, args, kwargs)

File "/opt/odoo16/odoo/api.py", line 459, in call_kw

result = _call_kw_model_create(method, model, args, kwargs)

File "/opt/odoo16/odoo/api.py", line 439, in _call_kw_model_create

result = method(recs, *args, **kwargs)

File "", line 2, in create

File "/opt/odoo16/odoo/api.py", line 409, in _model_create_multi

return create(self, [arg])

File "/opt/odoo16/addons/hr_holidays_attendance/models/hr_leave.py", line 26, in create

res = super().create(vals_list)

File "", line 2, in create

File "/opt/odoo16/odoo/api.py", line 410, in _model_create_multi

return create(self, arg)

File "/opt/odoo16/addons/hr_holidays/models/hr_leave.py", line 945, in create

values.update({'department_id': employees.filtered(lambda emp: emp.id == employee_id).department_id.id})

File "/opt/odoo16/odoo/fields.py", line 2795, in __get__

return super().__get__(records, owner)

File "/opt/odoo16/odoo/fields.py", line 1186, in __get__

recs._fetch_field(self)

File "/opt/odoo16/odoo/models.py", line 3172, in _fetch_field

self._read(fnames)

File "/opt/odoo16/addons/hr/models/hr_employee.py", line 194, in _read

public.read(fields)

File "/opt/odoo16/odoo/models.py", line 2968, in read

raise ValueError("Invalid field %r on model %r" % (name, self._name))

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


The above server error caused the following client error:

null

形象
丢弃
编写者

hi @Niyas Raphy I have updated and copied the full error here.

did you get a chance to see from where the certificates coming from

编写者

Hi Niyas Raphy, I viewed the source code and I don't see any term certificates. 
I checked on Settings -> Technical -> User Interface -> Views all that have term certificates and set them to inactive. 
Also, there is a field 'certificates' in Settings -> Technical -> Database Structure -> Model -> hr.employee which I added and can't remove because it says 'This column contains module data and cannot be removed!' when try to save the changes.  I also removed the fields 'certificates' in 'hr.employee'  table through Webmin interface.

can you check your custom addons and see from which this field get added

编写者

Hi Niyas Raphy! 

It was the custom module 'employee_orientation' where the field gets added. 
I have uninstalled it and it works. Thank you for your help!

最佳答案

Hi,
It seems you have got third party apps or custom codes in your odoo instance. Check your source code to see the usage of term certificates in it.  

Also see the odoo log and see if you can get more information regarding this error. If you believe this as a bug in standard version of odoo, please provide the steps to reproduce the same in Odoo runbot

Thanks

形象
丢弃
相关帖文 回复 查看 活动
1
11月 22
4227
1
2月 25
852
1
5月 24
2103
0
1月 24
1121
1
4月 23
3779