[IMP] survey: improve survey form usability

Task #1949652

Some fields were renamed/moved around to improve the survey.survey
form usability.

closes odoo/odoo#31775

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Aurélien Warnon
2019-04-08 07:09:01 +00:00
parent 85b0b37dcc
commit 4b7fb75bc2
4 changed files with 30 additions and 25 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ class SurveyQuestion(models.Model):
('datetime', 'Datetime'),
('simple_choice', 'Multiple choice: only one answer'),
('multiple_choice', 'Multiple choice: multiple answers allowed'),
('matrix', 'Matrix')], string='Type of Question',
('matrix', 'Matrix')], string='Question Type',
default='free_text', required=True, oldname='type')
# simple choice / multiple choice / matrix
labels_ids = fields.One2many(
+5 -4
View File
@@ -29,7 +29,8 @@ class Survey(models.Model):
# description
title = fields.Char('Title', required=True, translate=True)
description = fields.Html("Description", translate=True, help="A long description of the purpose of the survey")
description = fields.Html("Description", translate=True,
help="The description will be displayed on the home page of the survey. You can use this to give the purpose and guidelines to your candidates before they start it.")
color = fields.Integer('Color Index', default=0)
thank_you_message = fields.Html("Thanks Message", translate=True, help="This message will be displayed when survey is completed")
active = fields.Boolean("Active", default=True)
@@ -62,7 +63,7 @@ class Survey(models.Model):
('token', 'Invited people only')], string='Access Mode',
default='public', required=True)
access_token = fields.Char('Access Token', default=lambda self: self._get_default_access_token(), copy=False)
users_login_required = fields.Boolean('Login required', help="If checked, users have to login before answering even with a valid token.")
users_login_required = fields.Boolean('Login Required', help="If checked, users have to login before answering even with a valid token.")
users_can_go_back = fields.Boolean('Users can go back', help="If checked, users can go back to previous pages.")
users_can_signup = fields.Boolean('Users can signup', compute='_compute_users_can_signup')
public_url = fields.Char("Public link", compute="_compute_survey_url")
@@ -86,7 +87,7 @@ class Survey(models.Model):
time_limit = fields.Float("Time limit (minutes)")
certificate = fields.Boolean('Certificate')
certification_mail_template_id = fields.Many2one(
'mail.template', 'Certification Email Template',
'mail.template', 'Email Template',
domain="[('model', '=', 'survey.user_input')]",
help="Automated email sent to the user when he succeeds the certification, containing his certification document.")
@@ -155,7 +156,7 @@ class Survey(models.Model):
@api.onchange('scoring_type')
def _onchange_scoring_type(self):
if self.scoring_type != 'no_scoring':
if self.scoring_type == 'no_scoring':
self.certificate = False
@api.onchange('users_login_required', 'access_mode')
+23 -19
View File
@@ -9,10 +9,10 @@
<field name="id" invisible="1"/>
<field name="is_closed" invisible="1"/>
<header>
<button name="action_send_survey" string="Share" type="object" class="oe_highlight" attrs="{'invisible': [('id', '=', False)]}"/>
<button name="action_result_survey" string="View results" type="object" attrs="{'invisible': [('id', '=', False)]}"/>
<button name="action_test_survey" string="Test" type="object" attrs="{'invisible': [('id', '=', False)]}"/>
<button name="action_print_survey" string="Print" type="object" attrs="{'invisible': [('id', '=', False)]}"/>
<button name="action_send_survey" string="Invite" type="object" class="oe_highlight" attrs="{'invisible': [('id', '=', False)]}"/>
<button name="action_result_survey" string="View results" type="object" class="oe_highlight" attrs="{'invisible': [('id', '=', False)]}"/>
<field name="stage_id" widget="statusbar" options="{'clickable': '1'}"/>
</header>
<sheet>
@@ -47,15 +47,11 @@
</div>
<group>
<group>
<field name="access_mode"/>
<field name="public_url" readonly="1"
attrs="{'invisible': [('access_mode', '!=', 'public')]}"
widget="CopyClipboardChar"/>
<field name="category" invisible="1"/>
</group>
</group>
<notebook>
<page string="Edit Pages and Questions">
<page string="Questions">
<field name="question_and_page_ids" mode="tree" context="{'default_survey_id': active_id, 'default_questions_selection': questions_selection}" class="o_survey_questions_and_pages">
<tree decoration-bf="is_page==True">
<control>
@@ -64,30 +60,38 @@
</control>
<field name="sequence" widget="handle"/>
<field name="title"/>
<field name="question_type" attrs="{'invisible': [('is_page', '=', True)]}"/>
<field name="is_page" invisible="1"/>
<field name="questions_selection" invisible="1"/>
<field name="random_questions_count" attrs="{'column_invisible': [('parent.questions_selection', '=', 'all')], 'invisible': [('is_page', '=', False)]}" />
</tree>
</field>
<group string="Description" name="description" >
<field name="description" nolabel="1"></field>
</group>
</page>
<page string="Description">
<field name="description" nolabel="1"></field>
</page>
<page string="Options">
<group name="options">
<group string="Candidates" name="candidates">
<field name="users_login_required"/>
<field name="is_attempts_limited" attrs="{'invisible': [('access_mode', '=', 'public'), ('users_login_required', '=', False)]}" />
<field name="attempts_limit" attrs="{'invisible': [('is_attempts_limited', '=', False)]}" />
</group>
<group string="Questions" name="questions">
<field name="users_can_go_back" string="Enable back button"/>
<field name="questions_layout" widget="radio" />
<field name="is_time_limited" attrs="{'invisible': [('scoring_type', '=', 'no_scoring')]}" string="Time limit" />
<field name="time_limit" widget="float_time" nolabel="1" attrs="{'invisible': [('is_time_limited', '=', False)]}" /><span attrs="{'invisible': [('is_time_limited', '=', False)]}"> minutes</span>
<label for="is_time_limited" string="Time Limit"/>
<div>
<field name="is_time_limited" nolabel="1"/>
<field name="time_limit" widget="float_time" attrs="{'invisible': [('is_time_limited', '=', False)]}" nolabel="1" class="oe_inline" /> <span attrs="{'invisible': [('is_time_limited', '=', False)]}"> minutes</span>
</div>
<field name="questions_selection" widget="radio" />
<field name="users_can_go_back" string="Back Button" attrs="{'invisible': [('questions_layout', '=', 'one_page')]}"/>
</group>
<group string="Scoring Informations" name="scoring">
<group string="Candidates" name="candidates">
<field name="access_mode"/>
<field name="users_login_required"/>
<label for="is_attempts_limited" string="Attempts Limit" attrs="{'invisible': [('access_mode', '=', 'public'), ('users_login_required', '=', False)]}"/>
<div attrs="{'invisible': [('access_mode', '=', 'public'), ('users_login_required', '=', False)]}">
<field name="is_attempts_limited" nolabel="1"/>
<field name="attempts_limit" attrs="{'invisible': [('is_attempts_limited', '=', False)]}" nolabel="1" class="oe_inline" /> <span attrs="{'invisible': [('is_attempts_limited', '=', False)]}"> attempts</span>
</div>
</group>
<group string="Scoring" name="scoring">
<field name="scoring_type" widget="radio" />
<field name="passing_score" attrs="{'invisible': [('scoring_type', '=', 'no_scoring')]}" />
<field name="certificate" attrs="{'invisible': [('scoring_type', '=', 'no_scoring')]}" />
+1 -1
View File
@@ -110,7 +110,7 @@
<t t-if="answer.test_entry" t-call="survey.back" />
<div class="jumbotron mt32">
<h1><span t-field="survey.title"/> survey is void</h1>
<p>This survey has no question defined currently.<br />
<p>Please make sure you have at least one question in your survey. You also need at least one section if you chose the "Page per section" layout.<br />
<a t-att-href="'/web#view_type=form&amp;model=survey.survey&amp;id=%s&amp;action=survey.action_survey_form' % survey.id"
class="btn btn-secondary"
groups="survey.group_survey_manager">Edit in backend</a>