[19.0][MIG] ai_oca_mcp - #102
Open
OmniaGit wants to merge 21 commits into
Open
Conversation
Currently translated at 50.0% (8 of 16 strings) Translation: ai-18.0/ai-18.0-ai_tool Translate-URL: https://translation.odoo-community.org/projects/ai-18-0/ai-18-0-ai_tool/es/
Currently translated at 100.0% (17 of 17 strings) Translation: ai-18.0/ai-18.0-ai_tool Translate-URL: https://translation.odoo-community.org/projects/ai-18-0/ai-18-0-ai_tool/it/
Currently translated at 81.2% (13 of 16 strings) Translation: ai-18.0/ai-18.0-ai_tool Translate-URL: https://translation.odoo-community.org/projects/ai-18-0/ai-18-0-ai_tool/es/
Currently translated at 100.0% (43 of 43 strings) Translation: ai-16.0/ai-16.0-ai_oca_mcp Translate-URL: https://translation.odoo-community.org/projects/ai-16-0/ai-16-0-ai_oca_mcp/it/
This was referenced Aug 13, 2026
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.
Migration of
ai_oca_mcpto 19.0.Depends on #101 (
[19.0][MIG] ai_tool) — until that one is merged this PR also carries theai_toolcommits; they disappear on rebase.The module is not on 18.0 yet, so the history replayed here is the one from #76: this builds directly on @angelmoya's 16.0 → 18.0 work rather than redoing it, and their commits are preserved as authored.
Three changes beyond the version bump.
_sql_constraints→models.ConstraintIn 19.0 the ORM logs "Model attribute '_sql_constraints' is no longer supported, please define models.Constraint on the model" (
odoo/orm/model_classes.py) and does not create the constraint. The unique keys onmcp.serverandmcp.server.keyare now declared asmodels.Constraint("unique (…)", …).expire_key()cache invalidation_get_mcp_server_by_keyis anormcache, andexpire_key()invalidated it throughself._get_mcp_server_by_key.clear_cache(self). In 19.0 the decorator only setslookup.__cache__, so that attribute no longer exists and the call raisesAttributeError— which rolls the transaction back, meaning the key is not revoked at all, and the controller path that expires a key past itsexpiration_dateanswers 500 instead of rejecting the request.The replacement is
self.env.registry.clear_cache(). Same scope as before, in both directions: the oldclear_cacheignored its arguments and calledmodel.pool._clear_cache(), and the new one defaults to thedefaultcache bucket, which is where thisormcachelives.readonly=Falseon the routeThis one is not specific to 19.0 and is worth a look on #76 as well.
Since 18.0, a route declared with
auth="none"is served with a read-only cursor unless it says otherwise:The MCP endpoint is
auth="none"and writes — it logs every call tomcp.server.log, and expires keys. So on 18.0 and 19.0 every request runs, fails on the firstINSERT, and is replayed from the top byservice_model.retryingwith a read/write cursor:It works — the retry is why the test suite is green either way — but every MCP call is executed twice and every call leaves two ERROR lines in the log. Declaring the route
readonly=Falsefixes it; the module's own tests go from 131 to 119 queries.Testing
Odoo 19.0-20260803,
ai_toolandai_oca_mcpinstalled together: 15 tests, 0 failed, 0 errors, and no read-only retries left in the log.Not included, on purpose
This is a migration. The protocol version answered at
initializeis still the hardcoded2025-03-26andpingstill falls through to "Method not found" — both worth addressing, both in separate PRs.@etobella @angelmoya, in the context of #73.