[FIX] project - send rating mail by project
opws: 2269230, 2248760 When a database has a lot of projects with many tasks, and needs to send a lot of feedback mails, the cron tries to send mails to all tasks at the same time, thus it times out. This fix will allow to treat projects one at a time so that when the cron times out, it will not restart from the beginning. closes odoo/odoo#53922 X-original-commit: 07c828b48741500573b4286480b23752a28163c7 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
@@ -483,8 +483,10 @@ class Project(models.Model):
|
||||
@api.model
|
||||
def _send_rating_all(self):
|
||||
projects = self.search([('rating_status', '=', 'periodic'), ('rating_request_deadline', '<=', fields.Datetime.now())])
|
||||
projects.mapped('task_ids')._send_task_rating_mail()
|
||||
projects._compute_rating_request_deadline()
|
||||
for project in projects:
|
||||
project.task_ids._send_task_rating_mail()
|
||||
project._compute_rating_request_deadline()
|
||||
self.env.cr.commit()
|
||||
|
||||
|
||||
class Task(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user