summaryrefslogtreecommitdiff
path: root/addons/project
diff options
context:
space:
mode:
authorKevin Baptiste <kba@odoo.com>2020-11-23 08:39:53 +0000
committerKevin Baptiste <kba@odoo.com>2020-11-23 08:44:52 +0000
commit3fe5416f07e76ccca6c0bb05a6fa12d8e2ca0e6c (patch)
treef4c48b4bed8a78b3d1b727d67f77f7458693f636 /addons/project
parent9cfb82dd4a9f3bef94960abd40c648373eff4ea9 (diff)
[FIX] project: don't send rating email when disabled on project
The rating emails were still sent even if the rating feature was disabled on the specific project. This commit ensures the emails are only sent to project with the feature enabled. closes odoo/odoo#62145 Taskid: 2390802 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Diffstat (limited to 'addons/project')
-rw-r--r--addons/project/models/project.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/addons/project/models/project.py b/addons/project/models/project.py
index 3c6cc80471a..71c518a9174 100644
--- a/addons/project/models/project.py
+++ b/addons/project/models/project.py
@@ -519,7 +519,11 @@ class Project(models.Model):
# This method should be called once a day by the scheduler
@api.model
def _send_rating_all(self):
- projects = self.search([('rating_status', '=', 'periodic'), ('rating_request_deadline', '<=', fields.Datetime.now())])
+ projects = self.search([
+ ('rating_active', '=', True),
+ ('rating_status', '=', 'periodic'),
+ ('rating_request_deadline', '<=', fields.Datetime.now())
+ ])
for project in projects:
project.task_ids._send_task_rating_mail()
project._compute_rating_request_deadline()
@@ -1132,7 +1136,7 @@ class Task(models.Model):
result = super(Task, tasks).write(vals)
# rating on stage
if 'stage_id' in vals and vals.get('stage_id'):
- self.filtered(lambda x: x.project_id.rating_status == 'stage')._send_task_rating_mail(force_send=True)
+ self.filtered(lambda x: x.project_id.rating_active and x.project_id.rating_status == 'stage')._send_task_rating_mail(force_send=True)
return result
def update_date_end(self, stage_id):