Skip to content

Commit 16a2c28

Browse files
committed
[FIX] survey: Use subject from template in surveys
When a user updates the subject on a template used for a survey, it does not pull the subject from the template. It uses the default subject that is used when computing the subject for a survey email that is sent out. This bug came as a part of [this commit]. Steps to reproduce on runbot: 1. Go to mail templates and search for Survey 2. Open the Survey: Invite template 3. Update the subject on this template 4. Open the Surveys app and select any survey 5. Click on Share and then enable send by email 6. The subject here will default to "Participate to {Survey Name}" [this commit]: odoo@220e027 opw-4654411 closes odoo#211153 Signed-off-by: Romain Derie (rde) <rde@odoo.com>
1 parent 23814f1 commit 16a2c28

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

addons/survey/tests/test_survey_invite.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def test_survey_invite(self):
139139
set([self.customer.email]))
140140
self.assertEqual(answers.mapped('partner_id'), self.customer)
141141
self.assertEqual(set(answers.mapped('deadline')), set([deadline]))
142+
self.assertEqual(invite.subject, self.env["mail.template"].browse(action["context"]["default_template_id"]).subject)
142143

143144
with self.subTest('Warning when inviting an already invited partner'):
144145
action = self.survey.action_send_survey()

addons/survey/wizard/survey_invite.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ def create(self, vals_list):
154154

155155
@api.depends('template_id', 'partner_ids')
156156
def _compute_subject(self):
157-
for invite in self:
158-
if invite.subject:
159-
continue
157+
for invite in self.filtered(lambda inv: not inv.subject):
158+
if invite.template_id and invite.template_id.subject:
159+
invite.subject = invite.template_id.subject
160160
else:
161161
invite.subject = _("Participate to %(survey_name)s", survey_name=invite.survey_id.display_name)
162162

0 commit comments

Comments
 (0)