Itgenodo047 op hr.contract.employee.report bij openen database

Bij het openen van de Odoo-database krijg ik de volgende melding bij het ophalen van de beschikbare objecten:

itgenodo047
Odoo Server Error: hr.contract.employee.report (200).

Natuurlijke sleutel: builtins.KeyError

Call stack:

Invantive.Basics.InvantiveSqlException
   at Invantive.Basics.ValidationException..ctor(GlobalState owner, ExecutionOptions executionOptions, String messageCode, String errorMessage, String kindRequest, String localStackTrace, String nk, Exception innerException, Boolean inheritMessageCodeWhenPresent, Nullable`1 uid, Nullable`1 isRecoverable, String poolIdentityId, String url, Nullable`1 partyUid, String partitionCode, String tableName, String parameter1, String parameter2, String parameter3, String parameter4, String parameter5, String clientId)
   at Invantive.Basics.InvantiveSqlException..ctor(GlobalState owner, ExecutionOptions executionOptions, String validationCode, String errorMessage, String kindRequest, String stackTrace, String nk, Exception innerException, Boolean inheritMessageCodeWhenPresent, Nullable`1 uid, Boolean isRecoverable, String poolIdentityId, String partitionCode, String tableName, String parameter1, String parameter2, String parameter3, String parameter4, String parameter5, String clientId)
   at Invantive.Data.Providers.Odoo.OdooExtensionMethods.EnsureSuccessful(Error error, GlobalState owner, ExecutionOptions executionOptions, String messageCode, Root request, String responseJson, ObjectDefinition objectDefinition)
   at Invantive.Data.Providers.Odoo.OdooExtensionMethods.EnsureSuccessful(Root root, GlobalState owner, ExecutionOptions executionOptions, String messageCode, Root request, String responseJson, ObjectDefinition objectDefinition)
   at Invantive.Data.Providers.Odoo.OdooProvider.RegisterDataContainerMetadata(GlobalState owner, ExecutionOptions executionOptions, SqlExecutionStep sqlExecutionStep, IConnection connection, DataContainerMetadata dataContainerMetadata)
   at Invantive.Data.GenericProvider.GetDataContainerMetadata(GlobalState owner, ExecutionOptions executionOptions, SqlExecutionStep sqlExecutionStep)
   at Invantive.Data.GenericProvider.GetDatabaseMetadata(GlobalState owner, ExecutionOptions executionOptions, SqlExecutionStep sqlExecutionStep)
   at Invantive.Data.ConnectionManager.i(GlobalState owner, ExecutionOptions, SqlExecutionStep)
   at Invantive.Data.ConnectionManager.g(GlobalState owner, ExecutionOptions, SqlExecutionStep)
   at Invantive.Data.ConnectionManager.GetDatabaseMetadata(GlobalState owner, ExecutionOptions executionOptions)
   at Invantive.Cloud.Controllers.DevelopmentController.AvailableObjects(Int64 databaseId)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Invantive.Cloud.Controllers.DevelopmentController.AvailableObjects(Int64 databaseId)
   at lambda_method3173(Closure, Object, Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
...
at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at Invantive.Data.Providers.Odoo.OdooExtensionMethods.EnsureSuccessful(Error error, GlobalState owner, ExecutionOptions executionOptions, String messageCode, Root request, String responseJson, ObjectDefinition objectDefinition)
   at Invantive.Data.Providers.Odoo.OdooExtensionMethods.EnsureSuccessful(Root root, GlobalState owner, ExecutionOptions executionOptions, String messageCode, Root request, String responseJson, ObjectDefinition objectDefinition)
   at Invantive.Data.Providers.Odoo.OdooProvider.RegisterDataContainerMetadata(GlobalState owner, ExecutionOptions executionOptions, SqlExecutionStep sqlExecutionStep, IConnection connection, DataContainerMetadata dataContainerMetadata)
   at Invantive.Data.GenericProvider.GetDataContainerMetadata(GlobalState owner, ExecutionOptions executionOptions, SqlExecutionStep sqlExecutionStep)
   at Invantive.Data.GenericProvider.GetDatabaseMetadata(GlobalState owner, ExecutionOptions executionOptions, SqlExecutionStep sqlExecutionStep)
   at Invantive.Data.ConnectionManager.i(GlobalState owner, ExecutionOptions, SqlExecutionStep)
   at Invantive.Data.ConnectionManager.g(GlobalState owner, ExecutionOptions, SqlExecutionStep)
   at Invantive.Data.ConnectionManager.GetDatabaseMetadata(GlobalState owner, ExecutionOptions executionOptions)
   at Invantive.Cloud.Controllers.DevelopmentController.AvailableObjects(Int64 databaseId) in c:\smoke\ws-24.0\Invantive.Cloud\src\Invantive.Cloud\Controllers\DevelopmentController.cs:line 2377

De API-call naar Odoo bevat:

{"id":7,"jsonrpc":"2.0","method":"call","params":{"service":"object","method":"execute_kw","args":["odoo-ps-...-17-0-15335693",27,"secret","ir.model","search_read",[]]}}

Het antwoord is in JSON:

{"jsonrpc": "2.0", "id": 7, "error": {"code": 200, "message": "Odoo Server Error", "data": {"name": "builtins.KeyError", "debug": "Traceback (most recent call last):\n  File \"/home/odoo/src/odoo/odoo/http.py\", line 1782, in _serve_db\n    return service_model.retrying(self._serve_ir_http, self.env)\n  File \"/home/odoo/src/odoo/odoo/service/model.py\", line 133, in retrying\n    result = func()\n  File \"/home/odoo/src/odoo/odoo/http.py\", line 1809, in _serve_ir_http\n    response = self.dispatcher.dispatch(rule.endpoint, args)\n  File \"/home/odoo/src/odoo/odoo/http.py\", line 2013, in dispatch\n    result = self.request.registry['ir.http']._dispatch(endpoint)\n  File \"/home/odoo/src/odoo/addons/website/models/ir_http.py\", line 235, in _dispatch\n    response = super()._dispatch(endpoint)\n  File \"/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py\", line 221, in _dispatch\n    result = endpoint(**request.params)\n  File \"/home/odoo/src/odoo/odoo/http.py\", line 757, in route_wrapper\n    result = endpoint(self, *args, **params_ok)\n  File \"/home/odoo/src/odoo/odoo/addons/base/controllers/rpc.py\", line 155, in jsonrpc\n    return dispatch_rpc(service, method, args)\n  File \"/home/odoo/src/odoo/odoo/http.py\", line 389, in dispatch_rpc\n    return dispatch(method, params)\n  File \"/home/odoo/src/odoo/odoo/service/model.py\", line 37, in dispatch\n    res = execute_kw(db, uid, *params[3:])\n  File \"/home/odoo/src/odoo/odoo/service/model.py\", line 59, in execute_kw\n    return execute(db, uid, obj, method, *args, **kw or {})\n  File \"/home/odoo/src/odoo/odoo/service/model.py\", line 65, in execute\n    res = execute_cr(cr, uid, obj, method, *args, **kw)\n  File \"/home/odoo/src/odoo/odoo/service/model.py\", line 50, in execute_cr\n    result = retrying(partial(odoo.api.call_kw, recs, method, args, kw), env)\n  File \"/home/odoo/src/odoo/odoo/service/model.py\", line 133, in retrying\n    result = func()\n  File \"/home/odoo/src/odoo/odoo/api.py\", line 464, in call_kw\n    result = _call_kw_model(method, model, args, kwargs)\n  File \"/home/odoo/src/odoo/odoo/api.py\", line 435, in _call_kw_model\n    result = method(recs, *args, **kwargs)\n  File \"/home/odoo/src/odoo/odoo/models.py\", line 5768, in search_read\n    return records._read_format(fnames=fields, **read_kwargs)\n  File \"/home/odoo/src/odoo/odoo/models.py\", line 3770, in _read_format\n    vals[name] = convert(record[name], record, use_display_name)\n  File \"/home/odoo/src/odoo/odoo/models.py\", line 6650, in __getitem__\n    return self._fields[key].__get__(self, self.env.registry[self._name])\n  File \"/home/odoo/src/odoo/odoo/fields.py\", line 2907, in __get__\n    return super().__get__(records, owner)\n  File \"/home/odoo/src/odoo/odoo/fields.py\", line 1207, in __get__\n    self.compute_value(recs)\n  File \"/home/odoo/src/odoo/odoo/fields.py\", line 1389, in compute_value\n    records._compute_field_value(self)\n  File \"/home/odoo/src/odoo/odoo/models.py\", line 4894, in _compute_field_value\n    fields.determine(field.compute, self)\n  File \"/home/odoo/src/odoo/odoo/fields.py\", line 102, in determine\n    return needle(*args)\n  File \"/home/odoo/src/odoo/odoo/addons/base/models/ir_model.py\", line 221, in _inherited_models\n    parent_names = list(self.env[model.model]._inherits)\n  File \"/home/odoo/src/odoo/odoo/api.py\", line 534, in __getitem__\n    return self.registry[model_name](self, (), ())\n  File \"/home/odoo/src/odoo/odoo/modules/registry.py\", line 213, in __getitem__\n    return self.models[model_name]\nKeyError: 'hr.contract.employee.report'\n", "message": "hr.contract.employee.report", "arguments": ["hr.contract.employee.report"], "context": {}}}}

De daarin bevatte Odoo-call stack geeft een fout aan in hr.contract.employee.report:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/http.py", line 1782, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
  File "/home/odoo/src/odoo/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/home/odoo/src/odoo/odoo/http.py", line 1809, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
  File "/home/odoo/src/odoo/odoo/http.py", line 2013, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
  File "/home/odoo/src/odoo/addons/website/models/ir_http.py", line 235, in _dispatch
    response = super()._dispatch(endpoint)
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 221, in _dispatch
    result = endpoint(**request.params)
  File "/home/odoo/src/odoo/odoo/http.py", line 757, in route_wrapper
    result = endpoint(self, *args, **params_ok)
  File "/home/odoo/src/odoo/odoo/addons/base/controllers/rpc.py", line 155, in jsonrpc
    return dispatch_rpc(service, method, args)
  File "/home/odoo/src/odoo/odoo/http.py", line 389, in dispatch_rpc
    return dispatch(method, params)
  File "/home/odoo/src/odoo/odoo/service/model.py", line 37, in dispatch
    res = execute_kw(db, uid, *params[3:])
  File "/home/odoo/src/odoo/odoo/service/model.py", line 59, in execute_kw
    return execute(db, uid, obj, method, *args, **kw or {})
  File "/home/odoo/src/odoo/odoo/service/model.py", line 65, in execute
    res = execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/odoo/src/odoo/odoo/service/model.py", line 50, in execute_cr
    result = retrying(partial(odoo.api.call_kw, recs, method, args, kw), env)
  File "/home/odoo/src/odoo/odoo/service/model.py", line 133, in retrying
    result = func()
  File "/home/odoo/src/odoo/odoo/api.py", line 464, in call_kw
    result = _call_kw_model(method, model, args, kwargs)
  File "/home/odoo/src/odoo/odoo/api.py", line 435, in _call_kw_model
    result = method(recs, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/models.py", line 5768, in search_read
    return records._read_format(fnames=fields, **read_kwargs)
  File "/home/odoo/src/odoo/odoo/models.py", line 3770, in _read_format
    vals[name] = convert(record[name], record, use_display_name)
  File "/home/odoo/src/odoo/odoo/models.py", line 6650, in __getitem__
    return self._fields[key].__get__(self, self.env.registry[self._name])
  File "/home/odoo/src/odoo/odoo/fields.py", line 2907, in __get__
    return super().__get__(records, owner)
  File "/home/odoo/src/odoo/odoo/fields.py", line 1207, in __get__
    self.compute_value(recs)
  File "/home/odoo/src/odoo/odoo/fields.py", line 1389, in compute_value
    records._compute_field_value(self)
  File "/home/odoo/src/odoo/odoo/models.py", line 4894, in _compute_field_value
    fields.determine(field.compute, self)
  File "/home/odoo/src/odoo/odoo/fields.py", line 102, in determine
    return needle(*args)
  File "/home/odoo/src/odoo/odoo/addons/base/models/ir_model.py", line 221, in _inherited_models
    parent_names = list(self.env[model.model]._inherits)
  File "/home/odoo/src/odoo/odoo/api.py", line 534, in __getitem__
    return self.registry[model_name](self, (), ())
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 213, in __getitem__
    return self.models[model_name]
KeyError: 'hr.contract.employee.report'

Hoe los ik dit op?

Bij het openen van de Odoo-database worden de metadata verzameld, waaronder de lijst van Odoo-modellen. Zie ook Dynamische datamodellen: hoe omgaan met doorlopend nieuwe tabellen en kolommen.

Hierdoor toont de Odoo SQL-driver automatisch alle tabellen van de geinstalleerd Odoo apps, onafhankelijk van de Odoo-versie en configuratie.

In dit geval geeft de Odoo API-server hierop een foutmelding omdat hij intern vastloopt op het model hr.contract.employee.report. Dit zal primair door Odoo zelf opgelost moeten worden.

Als alternatief bieden we aan om e kijken of er een andere werkwijze mogelijk is om bij interne Odoo-crashes de lijst van tabellen te segmenteren in groepen die wel op te halen zijn en die dan te verwerken. Hiervoor zal tijdelijk toegang nodig zijn via Delegatie tot de omgeving zoals beschreven in Toegang via delegatie op Invantive Cloud voor consultants.

Op basis van een vergelijkbare bug in Listing models, Odoo Server Error - builtins.KeyError on "ir.min.cron.mixin" model · Issue #150334 · odoo/odoo · GitHub schijnt het dat splitsing hiervoor niet nodig is en dat volstaan kan worden met het gebruik van een not in op de getoonde API-call naar Odoo voor het ophalen van de metadata.

Vergelijkbare problemen zijn: