Before this commit when the user wants to see the burndown chart of a old large project then the report could take more than 20 sec to be loaded. This commit adds 2 indexes one on `mail_tracking_value` table (`mail.tracking.value` model) and the other one on `mail_message` table (`mail.message` model) to reduce the load of that report to less than 10 sec. task-3177072 closes odoo/odoo#114114 X-original-commit: c6b355d471889634ae26a020e14c81e9a315b3de Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com> Co-authored-by: Yannick Tivisse <yti@odoo.com>
19 lines
501 B
Python
19 lines
501 B
Python
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models
|
|
from odoo.tools.sql import create_index
|
|
|
|
|
|
class MailMessage(models.Model):
|
|
_inherit = 'mail.message'
|
|
|
|
def init(self):
|
|
super().init()
|
|
create_index(
|
|
self._cr,
|
|
'mail_message_date_res_id_id_for_burndown_chart',
|
|
self._table,
|
|
['date', 'res_id', 'id'],
|
|
where="model='project.task' AND message_type='notification'"
|
|
)
|