Skip to content

[20.0][MIG] rpc_helper: Migration to 20.0 - #3874

Open
yabdelhamed wants to merge 19 commits into
OCA:20.0from
yabdelhamed:20.0-mig-rpc_helper
Open

yabdelhamed wants to merge 19 commits into
OCA:20.0from
yabdelhamed:20.0-mig-rpc_helper

Conversation

@yabdelhamed

Copy link
Copy Markdown

Migration of rpc_helper to 20.0, done with the format-patch procedure from the migration guide, so the history and authors are kept.

Changes for 20.0:

  • Version bumped to 20.0.1.0.0.
  • odoo.service.model.execute_cr no longer calls cr.reset(), and the cursor has no reset anymore, so every RPC call failed in the patched function. The patch now follows the 20.0 function.
  • Registry.clear_cache() is gone. Writing rpc_config_edit now calls env.transaction.invalidate_ormcache(), as ir.model itself does in 20.0, and _get_rpc_config uses api.ormcache.
  • test_decorator.py used a plain unittest.TestCase, which the Odoo test runner doesn't collect, so its 3 tests never ran. It now extends BaseCase.
  • Nested with blocks in test_xmlrpc.py are merged, as ruff on 20.0 requires (SIM117).

Tests, run locally with the CI images ghcr.io/oca/oca-ci/py3.12-odoo20.0 and py3.12-ocb20.0 against pgvector/pgvector:pg16, using oca_install_addons, oca_init_test_database and oca_run_tests:

  • With only the version bumped: 1 failed, 4 errors of 5 tests (cr.reset, Registry.clear_cache).
  • Odoo: 0 failed, 0 error(s) of 8 tests.
  • OCB: 0 failed, 0 error(s) of 8 tests.
  • With the _rpc_allowed check skipped in patch.py, 4 of the 8 fail, so the tests still cover the blocking.

pre-commit run -a passes.

Note, not changed here: the JSON-2 endpoint (/json/2/<model>/<method>, added in 19.0) calls the model method directly and doesn't go through execute_cr, so methods disabled with this module can still be called that way on 19.0 and 20.0. The caller still needs an API key and the user's access rights. I'm happy to send a follow-up PR that covers it if you want this module to handle JSON-2 too.

Part of #3772.

simahawk and others added 19 commits November 21, 2026 01:03
Currently translated at 100.0% (16 of 16 strings)

Translation: server-tools-14.0/server-tools-14.0-rpc_helper
Translate-URL: https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-rpc_helper/es_AR/
Currently translated at 100.0% (8 of 8 strings)

Translation: server-tools-16.0/server-tools-16.0-rpc_helper
Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-rpc_helper/es/

Added translation using Weblate (Spanish)
Currently translated at 100.0% (8 of 8 strings)

Translation: server-tools-16.0/server-tools-16.0-rpc_helper
Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-rpc_helper/it/
Currently translated at 100.0% (17 of 17 strings)

Translation: server-tools-16.0/server-tools-16.0-rpc_helper
Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-rpc_helper/es_AR/
Currently translated at 100.0% (17 of 17 strings)

Translation: server-tools-16.0/server-tools-16.0-rpc_helper
Translate-URL: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-rpc_helper/it/
Fixes
```
INFO odoo odoo.addons.rpc_helper.tests.test_xmlrpc: Starting TestXMLRPC.test_xmlrpc_can_search_create_blocked__ir_model ...
INFO odoo werkzeug: 127.0.0.1 - - [04/Feb/2025 13:39:13] "POST /xmlrpc/2/object HTTP/1.1" 200 - 22 0.006 0.437
WARNING odoo odoo.http: RPC call on res.partner is not allowed
```

New logging is due to odoo/odoo@a65b1d8
execute_cr no longer resets the cursor and the registry has no
clear_cache anymore, ormcache invalidation goes through the transaction.
The decorator tests now extend BaseCase so the test runner picks them up.
@yabdelhamed yabdelhamed mentioned this pull request Nov 20, 2026
3 of 30 tasks
@oca-cla-bot

oca-cla-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants