[REF] survey: rename invitation wizard to better match its business use
Purpose is to have a somehow cleaner name for this wizard as its purpose is to send invitations. Email and composer are details on how it works. This commit is linked to task ID 1909804 and PR #28783.
This commit is contained in:
@@ -31,7 +31,7 @@ sent mails with personal token for the invitation of the survey.
|
||||
'views/survey_question_views.xml',
|
||||
'views/survey_page_views.xml',
|
||||
'views/survey_templates.xml',
|
||||
'wizard/survey_mail_compose_message_views.xml',
|
||||
'wizard/survey_invite_views.xml',
|
||||
],
|
||||
'demo': [
|
||||
'data/survey_demo_user.xml',
|
||||
|
||||
@@ -302,7 +302,7 @@ class Survey(models.Model):
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'survey.mail.compose.message',
|
||||
'res_model': 'survey.invite',
|
||||
'target': 'new',
|
||||
'context': local_context,
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class TestSurvey(TransactionCase):
|
||||
'type': 'ir.actions.act_window',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'survey.mail.compose.message',
|
||||
'res_model': 'survey.invite',
|
||||
'target': 'new',
|
||||
'context': ctx,
|
||||
})
|
||||
@@ -150,15 +150,15 @@ class TestSurvey(TransactionCase):
|
||||
def test_07_survey_email_message(self):
|
||||
# Case-1: Executing send_mail with correct data.
|
||||
partner = self.env['res.partner'].create({'name': 'Marie De Cock', 'email': 'marie.de.cock@gmail.com'})
|
||||
survey_mail_message = self.env['survey.mail.compose.message'].sudo(self.survey_manager).create({
|
||||
survey_mail_message = self.env['survey.invite'].sudo(self.survey_manager).create({
|
||||
'survey_id': self.survey1.id, 'public': 'email_public_link', 'body': '__URL__', 'partner_ids': [(4, partner.id)]})
|
||||
survey_mail_message.send_mail()
|
||||
|
||||
# Case-2: Executing send_mail with incorrect data.
|
||||
mail_messages = [
|
||||
self.env['survey.mail.compose.message'].sudo(self.survey_manager).create({ # Mail Message without __URL__ in body.
|
||||
self.env['survey.invite'].sudo(self.survey_manager).create({ # Mail Message without __URL__ in body.
|
||||
'survey_id': self.survey1.id, 'public': 'email_public_link'}),
|
||||
self.env['survey.mail.compose.message'].sudo(self.survey_manager).create({ # Mail Message without recipents.
|
||||
self.env['survey.invite'].sudo(self.survey_manager).create({ # Mail Message without recipents.
|
||||
'survey_id': self.survey1.id, 'public': 'email_public_link', 'body': "__URL__"})]
|
||||
for message in mail_messages:
|
||||
self.assertRaises(UserError, message.send_mail)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import survey_mail_compose_message
|
||||
from . import survey_invite
|
||||
|
||||
+4
-4
@@ -18,9 +18,9 @@ emails_split = re.compile(r"[;,\n\r]+")
|
||||
email_validator = re.compile(r"[^@]+@[^@]+\.[^@]+")
|
||||
|
||||
|
||||
class SurveyMailComposeMessage(models.TransientModel):
|
||||
_name = 'survey.mail.compose.message'
|
||||
_description = 'Email composition wizard for Survey'
|
||||
class SurveyInvite(models.TransientModel):
|
||||
_name = 'survey.invite'
|
||||
_description = 'Survey Invitation Wizard'
|
||||
|
||||
def default_survey_id(self):
|
||||
context = self.env.context
|
||||
@@ -78,7 +78,7 @@ class SurveyMailComposeMessage(models.TransientModel):
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
res = super(SurveyMailComposeMessage, self).default_get(fields)
|
||||
res = super(SurveyInvite, self).default_get(fields)
|
||||
context = self.env.context
|
||||
if context.get('active_model') == 'res.partner' and context.get('active_ids'):
|
||||
res.update({'partner_ids': context['active_ids']})
|
||||
+3
-6
@@ -1,13 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- Replace the default mass-mailing wizard in base with the composition wizard -->
|
||||
|
||||
<!-- Composition form (context['survey_resent_token'], if True, hide share option, emails list and partner_ids) -->
|
||||
<record model="ir.ui.view" id="survey_email_compose_message">
|
||||
<field name="name">survey.mail.compose.message.form</field>
|
||||
<field name="model">survey.mail.compose.message</field>
|
||||
<record model="ir.ui.view" id="survey_invite_view_form">
|
||||
<field name="name">survey.invite.view.form</field>
|
||||
<field name="model">survey.invite</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Compose Email">
|
||||
<group col="2">
|
||||
Reference in New Issue
Block a user