Conversation
Add a partial index on mail_followers (partner_id, res_id) for project.task rows. The project.task record rules check if the user follows the task, and with many followed tasks per user that subquery is most of the cost of task counts and searches.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
El cambio es acotado, coincide con la consulta objetivo y no presenta problemas bloqueantes; el incremento de versión está previsto al integrar.
Review effort: Balanced
Findings: None
What changed in this PR
Optimiza las consultas de tareas por seguidores sin modificar las reglas de acceso.
Cambios:
- Agrega un índice parcial sobre
(partner_id, res_id)para seguidores deproject.task. - Registra la extensión del modelo para crear el índice al instalar o actualizar el módulo.
| File | Description |
|---|---|
project_ux/models/mail_followers.py |
Crea el índice parcial desde init(). |
project_ux/models/__init__.py |
Importa la extensión de seguidores. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
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.

Tarea: https://www.adhoc.inc/odoo/project.task/72145
Índice parcial en
mail_followers (partner_id, res_id) WHERE res_model = 'project.task'. Las reglas de acceso deproject.taskbuscan las tareas que sigue el usuario en cada consulta; con usuarios que siguen decenas de miles, es la mayor parte del costo. No cambia la regla ni quién ve qué.Validación local: instalado desde
18.0sin índice; con-uen esta rama se creamail_followers_project_task_partner_id_res_id_indexy la regla lo usa. Con ~120.000 tareas y un usuario que sigue ~55.000, el botón "Tareas" de una orden pasa de ~40 a ~19 ms y contar todas las tareas, de ~72 a ~52 ms.Al mergear:
bump. El forward-port lo lleva a 19.0.Relacionado: #149, ingadhoc/sale#1880, ingadhoc/sale#1884.