fsm_visit_confirmation: only send email for top-level tasks
This commit is contained in:
parent
9859a3cf96
commit
055ceede53
1 changed files with 2 additions and 0 deletions
|
|
@ -13,9 +13,11 @@ class ProjectTask(models.Model):
|
||||||
|
|
||||||
# If stage changed and new stage has an approval template, send the email
|
# If stage changed and new stage has an approval template, send the email
|
||||||
if "stage_id" in vals:
|
if "stage_id" in vals:
|
||||||
|
# Only send email for top-level tasks
|
||||||
for task in self.filtered(
|
for task in self.filtered(
|
||||||
lambda task: task.stage_id != old_stages[task.id]
|
lambda task: task.stage_id != old_stages[task.id]
|
||||||
and task.stage_id.approval_template_id
|
and task.stage_id.approval_template_id
|
||||||
|
and not task.parent_id
|
||||||
):
|
):
|
||||||
task._portal_ensure_token()
|
task._portal_ensure_token()
|
||||||
task.stage_id.approval_template_id.send_mail(
|
task.stage_id.approval_template_id.send_mail(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue