[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#62181 Taskid: 2390802 X-original-commit: 3fe5416f07e76ccca6c0bb05a6fa12d8e2ca0e6c Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com> Signed-off-by: Kevin Baptiste <kba@odoo.com>
This commit is contained in:
@@ -520,7 +520,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()
|
||||
@@ -1128,7 +1132,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):
|
||||
|
||||
Reference in New Issue
Block a user