[19.0)[Fix]endpoint_route_handler: Restore registry._init_modules after mocked request - #150
Open
Camille0907 wants to merge 1 commit into
Open
[19.0)[Fix]endpoint_route_handler: Restore registry._init_modules after mocked request#150Camille0907 wants to merge 1 commit into
endpoint_route_handler: Restore registry._init_modules after mocked request#150Camille0907 wants to merge 1 commit into
Conversation
…fter mocked request `_get_mocked_request()` sets `registry._init_modules = set()` to simulate a minimal endpoint environment. Since registry is the real Odoo Registry singleton, this mutation persisted after the context exited. Odoo core `ir_http.py` uses `registry._init_modules` to build the routing map, so leaving it as set() caused post_install HttpCase tests from other modules to receive a routing map containing only server-wide modules, resulting in 404 errors on routes registered by those modules. Fix by saving and restoring _init_modules in a try/finally block.
Contributor
|
Hi @simahawk, |
simahawk
requested changes
Aug 18, 2026
simahawk
left a comment
Contributor
There was a problem hiding this comment.
Thanks for your fix.
Please, amend the commit msg to remove the odoo version and use the tag [FIX]
| yield mocked_request | ||
| registry = (env or self.env).registry | ||
| original_init_modules = registry._init_modules | ||
| try: |
Contributor
There was a problem hiding this comment.
IMO there's no need for a try/finally.
This is ctx manager, you can cleanup what you want after the yield statement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
_get_mocked_request()setsregistry._init_modules = set()to simulate a minimal endpoint environment. Since registry is the real Odoo Registry singleton, this mutation persisted after the context exited.Odoo core
ir_http.pyusesregistry._init_modulesto build the routing map, so leaving it as set() caused post_install HttpCase tests from other modules to receive a routing map containing only server-wide modules, resulting in 404 errors on routes registered by those modules.Fix by saving and restoring _init_modules in a try/finally block.