diff options
| author | snd <snd@odoo.com> | 2020-07-01 09:32:04 +0000 |
|---|---|---|
| committer | snd <snd@odoo.com> | 2020-07-01 15:36:56 +0000 |
| commit | cb26f1aabdbd53f1ce9650659a256ce9c994391d (patch) | |
| tree | 02cab0ce3f13e6f232ee839c0e20dbc2f66326f0 /addons/project/models/project.py | |
| parent | 5e3d73bdeb6cd45ca2b6e16241c2981f0c738ac0 (diff) | |
[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>
Diffstat (limited to 'addons/project/models/project.py')
| -rw-r--r-- | addons/project/models/project.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 8c05f3228d3..2355eba348f 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -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): |
