OCA / manufacture

Odoo Manufacturing Addons
GNU Affero General Public License v3.0
169 stars 479 forks source link

qc.test.object_id selection only offers invalid choices #1286

Open cparadis777 opened 3 months ago

cparadis777 commented 3 months ago

Module

quality_control_oca

Describe the bug

The first selection menu of the qc.test.object_id field has 5 "empty" (no selection text) choices: "S", "e", "t", "(", ")". No matter which value is selected, trying to select a model from the second selection menu causes an Odoo server error to appear.

To Reproduce

Affected versions: 14, 15, 16, 17 The same bug was reported previously, but marked stale: V14: #823 V12: #562 I have reproduced the bug in runboat for V14, V15, V16 and V17 myself.

Steps to reproduce the behavior:

  1. Create a new related test
  2. Set the first selection of the object_id field
  3. Try to selected a related model

Expected behavior The user should be able to select a model from the second selection menu, and the options in the first selection menu should be visible.

Additional context

I don't have much experience with the module, but I checked the code and it seems the error would be located in QcTest.objectSelectionValue() method: https://github.com/OCA/manufacture/blob/4d44182ab4e5c5cbe5bb63e25d2281ed15f472e2/quality_control_oca/models/qc_test.py#L21

Odoo server error trace: Traceback (most recent call last): File "/opt/odoo/odoo/http.py", line 1748, in _serve_db return service_model.retrying(self._serve_ir_http, self.env) File "/opt/odoo/odoo/service/model.py", line 133, in retrying result = func() File "/opt/odoo/odoo/http.py", line 1775, in _serve_ir_http response = self.dispatcher.dispatch(rule.endpoint, args) File "/opt/odoo/odoo/http.py", line 1979, in dispatch result = self.request.registry['ir.http']._dispatch(endpoint) File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 222, in _dispatch result = endpoint(*request.params) File "/opt/odoo/odoo/http.py", line 725, in route_wrapper result = endpoint(self, args, **params_ok) File "/opt/odoo/addons/web/controllers/dataset.py", line 24, in call_kw return self._call_kw(model, method, args, kwargs) File "/opt/odoo/addons/web/controllers/dataset.py", line 20, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/opt/odoo/odoo/api.py", line 534, in getitem return self.registry[model_name](self, (), ()) File "/opt/odoo/odoo/modules/registry.py", line 213, in getitem return self.models[model_name] KeyError: 't'

The above server error caused the following client error: RPC_ERROR: Odoo Server Error RPCError@http://oca-manufacture-17-0-4d44182ab4e5.runboat.odoo-community.org/web/assets/debug/web.assets_web.js:27806:9 (/web/static/src/core/network/rpc_service.js:11) makeErrorFromResponse@http://oca-manufacture-17-0-4d44182ab4e5.runboat.odoo-community.org/web/assets/debug/web.assets_web.js:27832:19 (/web/static/src/core/network/rpc_service.js:37) jsonrpc/promise</<@http://oca-manufacture-17-0-4d44182ab4e5.runboat.odoo-community.org/web/assets/debug/web.assets_web.js:27880:48 (/web/static/src/core/network/rpc_service.js:85)