diff options
| author | Thibault Delavallée <tde@odoo.com> | 2019-11-21 15:27:40 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2019-12-05 15:21:28 +0000 |
| commit | 1e66894042a3920179f14f19b50b692845f3a004 (patch) | |
| tree | 8330ba699ada5672f85a5cc4683a9e503694965e | |
| parent | 7edeb24de91ade5e21ba7542d32e97f023ec0c1b (diff) | |
[REF] survey: on survey.survey, rename some fields to ease understanding
PURPOSE
As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.
SPECIFICATIONS: RENAME THANKS_YOU_MESSAGE ON SURVEY.SURVEY
On survey.survey, rename thanks_you_message to description_done
In this commit we rename thanks_you_message field. Indeed for certifications
or recruitment form, "thank you" is not really the unique content you
would get in a post-survey message. We therefore rename it to description_done
to better indicate its use.
SPECIFICATIONS: RENAME CERTIFICATE ON SURVEY.SURVEY
On survey.survey, rename certificate field to certification
All certification related fields on survey model begin with certification_ .
Only the boolean one telling if a survey is a certification or not is called
certificate. In order to ease grep and ordering it is renamed to certification.
SPECIFICATIONS: RENAME PASSING_SCORE ON SURVEY.SURVEY
on survey.survey, rename passing_score field to scoring_success_min
``passing_score`` field name is not really the best name we could find.
Renaming the field using a ``scoring_`` prefix allow to know this field
is linked to the scoring mechanism.
LINKS
[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)
PR #40765
22 files changed, 72 insertions, 70 deletions
diff --git a/addons/hr_recruitment_survey/data/survey_demo.xml b/addons/hr_recruitment_survey/data/survey_demo.xml index 11f02802989..485fcc98f3b 100644 --- a/addons/hr_recruitment_survey/data/survey_demo.xml +++ b/addons/hr_recruitment_survey/data/survey_demo.xml @@ -9,7 +9,7 @@ <p> Please answer those questions to help recruitment officers to preprocess your application. </p></field> - <field name="thank_you_message" type="html"> + <field name="description_done" type="html"> <p> Thank you for answering this survey. We will come back to you soon. </p></field> diff --git a/addons/hr_skills_survey/models/survey_user.py b/addons/hr_skills_survey/models/survey_user.py index 730e7ce82bc..e9cecf321e6 100644 --- a/addons/hr_skills_survey/models/survey_user.py +++ b/addons/hr_skills_survey/models/survey_user.py @@ -16,9 +16,9 @@ class SurveyUserInput(models.Model): super(SurveyUserInput, self)._mark_done() - certificate_user_inputs = self.filtered(lambda user_input: user_input.survey_id.certificate and user_input.quizz_passed) - partner_has_completed = {user_input.partner_id.id: user_input.survey_id for user_input in certificate_user_inputs} - employees = self.env['hr.employee'].sudo().search([('user_id.partner_id', 'in', certificate_user_inputs.mapped('partner_id').ids)]) + certification_user_inputs = self.filtered(lambda user_input: user_input.survey_id.certification and user_input.quizz_passed) + partner_has_completed = {user_input.partner_id.id: user_input.survey_id for user_input in certification_user_inputs} + employees = self.env['hr.employee'].sudo().search([('user_id.partner_id', 'in', certification_user_inputs.mapped('partner_id').ids)]) for employee in employees: line_type = self.env.ref('hr_skills_survey.resume_type_certification', raise_if_not_found=False) survey = partner_has_completed.get(employee.user_id.partner_id.id) diff --git a/addons/survey/controllers/main.py b/addons/survey/controllers/main.py index aa402560714..57cdb2692c4 100644 --- a/addons/survey/controllers/main.py +++ b/addons/survey/controllers/main.py @@ -449,7 +449,7 @@ class Survey(http.Controller): """ The certification document can be downloaded as long as the user has succeeded the certification """ survey = request.env['survey.survey'].sudo().search([ ('id', '=', survey_id), - ('certificate', '=', True) + ('certification', '=', True) ]) if not survey: @@ -574,7 +574,7 @@ class Survey(http.Controller): values = {'survey': survey, 'answer': answer} if token: values['token'] = token - if survey.scoring_type != 'no_scoring' and survey.certificate: + if survey.scoring_type != 'no_scoring' and survey.certification: answer_perf = survey._get_answers_correctness(answer)[answer] values['graph_data'] = json.dumps([ {"text": "Correct", "count": answer_perf['correct']}, diff --git a/addons/survey/data/mail_template_data.xml b/addons/survey/data/mail_template_data.xml index 13f09ecd752..8a7c0439a79 100644 --- a/addons/survey/data/mail_template_data.xml +++ b/addons/survey/data/mail_template_data.xml @@ -10,7 +10,7 @@ <div style="margin: 0px; padding: 0px; font-size: 13px;"> <p style="margin: 0px; padding: 0px; font-size: 13px;"> Dear ${object.partner_id.name or 'participant'}<br/><br/> - % if object.survey_id.certificate: + % if object.survey_id.certification: You have been invited to take a new certification. % else: We are conducting a survey and your response would be appreciated. @@ -18,7 +18,7 @@ <div style="margin: 16px 0px 16px 0px;"> <a href="${(object.get_start_url()) | safe}" style="background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;"> - % if object.survey_id.certificate: + % if object.survey_id.certification: Start Certification % else: Start Survey diff --git a/addons/survey/data/survey_demo_certification.xml b/addons/survey/data/survey_demo_certification.xml index 4c16664c273..7a59f6344d0 100644 --- a/addons/survey/data/survey_demo_certification.xml +++ b/addons/survey/data/survey_demo_certification.xml @@ -17,14 +17,13 @@ <field name="users_can_go_back" eval="True" /> <field name="users_login_required" eval="True" /> <field name="scoring_type" >scoring_with_answers</field> - <field name="certificate" eval="True"></field> + <field name="certification" eval="True"/> <field name="certification_mail_template_id" ref="mail_template_certification"></field> <field name="is_time_limited" >limited</field> <field name="time_limit" >10.0</field> <field name="is_attempts_limited" eval="True" /> <field name="attempts_limit">2</field> - <field name="description"><p>Test your vendor skills!</p></field> - <field name="thank_you_message"><p></p></field> + <field name="description" type="html"><p>Test your vendor skills!</p></field> <field name="certification_give_badge">True</field> <field name="certification_badge_id" ref="vendor_certification_badge"/> </record> @@ -35,7 +34,7 @@ <field name="sequence">1</field> <field name="is_page" eval="True"/> <field name="question_type" eval="False" /> - <field name="description"><p>Test your knowledge of your products!</p></field> + <field name="description" type="html"><p>Test your knowledge of your products!</p></field> </record> <!-- Question and predefined answer 1 --> <record model="survey.question" id="vendor_certification_page_1_question_1"> diff --git a/addons/survey/data/survey_demo_feedback.xml b/addons/survey/data/survey_demo_feedback.xml index 40467a2428c..da2e3edc825 100644 --- a/addons/survey/data/survey_demo_feedback.xml +++ b/addons/survey/data/survey_demo_feedback.xml @@ -11,7 +11,6 @@ <field name="description" type="html"> <p>This survey allows you to give a feedback about your experience with our eCommerce solution. Filling it helps us improving your experience.</p></field> - <field name="thank_you_message"><p></p></field> </record> <!-- Page1: general information --> diff --git a/addons/survey/models/survey_survey.py b/addons/survey/models/survey_survey.py index 590bc9c6072..b7476bd5364 100644 --- a/addons/survey/models/survey_survey.py +++ b/addons/survey/models/survey_survey.py @@ -26,11 +26,13 @@ class Survey(models.Model): # description title = fields.Char('Survey Title', required=True, translate=True) + color = fields.Integer('Color Index', default=0) 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") + description_done = fields.Html( + "End Message", translate=True, + help="This message will be displayed when survey is completed") active = fields.Boolean("Active", default=True) state = fields.Selection(selection=[ ('draft', 'Draft'), ('open', 'In Progress'), ('closed', 'Closed') @@ -67,18 +69,20 @@ class Survey(models.Model): answer_score_avg = fields.Float("Avg Score %", compute="_compute_survey_statistic") success_count = fields.Integer("Success", compute="_compute_survey_statistic") success_ratio = fields.Integer("Success Ratio", compute="_compute_survey_statistic") - # scoring / certification + # scoring scoring_type = fields.Selection([ ('no_scoring', 'No scoring'), ('scoring_with_answers', 'Scoring with answers at the end'), ('scoring_without_answers', 'Scoring without answers at the end')], string="Scoring", required=True, default='no_scoring') - passing_score = fields.Float('Passing score (%)', required=True, default=80.0) + scoring_success_min = fields.Float('Success %', default=80.0) + # attendees context: attempts and time limitation is_attempts_limited = fields.Boolean('Limited number of attempts', help="Check this option if you want to limit the number of attempts per user") attempts_limit = fields.Integer('Number of attempts', default=1) is_time_limited = fields.Boolean('The survey is limited in time') time_limit = fields.Float("Time limit (minutes)") - certificate = fields.Boolean('Certificate') + # certification + certification = fields.Boolean('Is a Certification') certification_mail_template_id = fields.Many2one( 'mail.template', 'Email Template', domain="[('model', '=', 'survey.user_input')]", @@ -102,7 +106,7 @@ class Survey(models.Model): _sql_constraints = [ ('access_token_unique', 'unique(access_token)', 'Access token should be unique'), - ('certificate_check', "CHECK( scoring_type!='no_scoring' OR certificate=False )", + ('certification_check', "CHECK( scoring_type!='no_scoring' OR certification=False )", 'You can only create certifications for surveys that have a scoring mechanism.'), ('time_limit_check', "CHECK( (is_time_limited=False) OR (time_limit is not null AND time_limit > 0) )", 'The time limit needs to be a positive number if the survey is time limited.'), @@ -151,15 +155,15 @@ class Survey(models.Model): survey.page_ids = survey.question_and_page_ids.filtered(lambda question: question.is_page) survey.question_ids = survey.question_and_page_ids - survey.page_ids - @api.onchange('passing_score') - def _onchange_passing_score(self): - if self.passing_score < 0 or self.passing_score > 100: - self.passing_score = 80.0 + @api.onchange('scoring_success_min') + def _onchange_scoring_success_min(self): + if self.scoring_success_min < 0 or self.scoring_success_min > 100: + self.scoring_success_min = 80.0 @api.onchange('scoring_type') def _onchange_scoring_type(self): if self.scoring_type == 'no_scoring': - self.certificate = False + self.certification = False self.is_time_limited = False @api.onchange('users_login_required', 'access_mode') @@ -181,9 +185,9 @@ class Survey(models.Model): selection = self.env['survey.survey'].fields_get(allfields=['state'])['state']['selection'] return [s[0] for s in selection] - @api.onchange('users_login_required', 'certificate') + @api.onchange('users_login_required', 'certification') def _onchange_set_certification_give_badge(self): - if not self.users_login_required or not self.certificate: + if not self.users_login_required or not self.certification: self.certification_give_badge = False # ------------------------------------------------------------ @@ -730,7 +734,7 @@ class Survey(models.Model): 'batch_user_expression': 'user.partner_id.id' }) challenge = self.env['gamification.challenge'].create({ - 'name': _('%s challenge certificate' % self.title), + 'name': _('%s challenge certification' % self.title), 'reward_id': self.certification_badge_id.id, 'state': 'inprogress', 'period': 'once', diff --git a/addons/survey/models/survey_user.py b/addons/survey/models/survey_user.py index c9dddf62ec0..0e0dd774a3d 100644 --- a/addons/survey/models/survey_user.py +++ b/addons/survey/models/survey_user.py @@ -63,10 +63,10 @@ class SurveyUserInput(models.Model): score = (sum(user_input.user_input_line_ids.mapped('answer_score')) / total_possible_score) * 100 user_input.quizz_score = round(score, 2) if score > 0 else 0 - @api.depends('quizz_score', 'survey_id.passing_score') + @api.depends('quizz_score', 'survey_id.scoring_success_min') def _compute_quizz_passed(self): for user_input in self: - user_input.quizz_passed = user_input.quizz_score >= user_input.survey_id.passing_score + user_input.quizz_passed = user_input.quizz_score >= user_input.survey_id.scoring_success_min @api.depends('start_datetime', 'survey_id.is_time_limited', 'survey_id.time_limit') def _compute_is_time_limit_reached(self): @@ -150,7 +150,7 @@ class SurveyUserInput(models.Model): Challenge = self.env['gamification.challenge'].sudo() badge_ids = [] for user_input in self: - if user_input.survey_id.certificate and user_input.quizz_passed: + if user_input.survey_id.certification and user_input.quizz_passed: if user_input.survey_id.certification_mail_template_id and not user_input.test_entry: user_input.survey_id.certification_mail_template_id.send_mail(user_input.id, notif_layout="mail.mail_notification_light") if user_input.survey_id.certification_give_badge: diff --git a/addons/survey/tests/test_certification_badge.py b/addons/survey/tests/test_certification_badge.py index 818045199a7..2b7348be427 100644 --- a/addons/survey/tests/test_certification_badge.py +++ b/addons/survey/tests/test_certification_badge.py @@ -15,7 +15,7 @@ class TestCertificationBadge(common.TestSurveyCommon): 'access_mode': 'public', 'users_login_required': True, 'scoring_type': 'scoring_with_answers', - 'certificate': True, + 'certification': True, 'state': 'open', }) @@ -24,7 +24,7 @@ class TestCertificationBadge(common.TestSurveyCommon): 'access_mode': 'public', 'users_login_required': True, 'scoring_type': 'scoring_with_answers', - 'certificate': True, + 'certification': True, 'state': 'open', }) @@ -167,7 +167,7 @@ class TestCertificationBadge(common.TestSurveyCommon): 'access_mode': 'public', 'users_login_required': True, 'scoring_type': 'scoring_with_answers', - 'certificate': True, + 'certification': True, 'certification_give_badge': True, 'certification_badge_id': self.certification_badge.id, 'state': 'open' diff --git a/addons/survey/tests/test_certification_flow.py b/addons/survey/tests/test_certification_flow.py index 4df1245d2c2..0e0b62fef99 100644 --- a/addons/survey/tests/test_certification_flow.py +++ b/addons/survey/tests/test_certification_flow.py @@ -28,7 +28,7 @@ class TestCertificationFlow(common.TestSurveyCommon, HttpCase): post_data.update(**additional_post_data) return post_data - def test_flow_certificate(self): + def test_flow_certification(self): # Step: survey user creates the certification # -------------------------------------------------- with self.with_user(self.survey_user): @@ -39,8 +39,8 @@ class TestCertificationFlow(common.TestSurveyCommon, HttpCase): 'questions_layout': 'page_per_question', 'users_can_go_back': True, 'scoring_type': 'scoring_with_answers', - 'passing_score': 85.0, - 'certificate': True, + 'scoring_success_min': 85.0, + 'certification': True, 'certification_mail_template_id': self.env.ref('survey.mail_template_certification').id, 'is_time_limited': True, 'time_limit': 10, diff --git a/addons/survey/tests/test_survey_ui_certification.py b/addons/survey/tests/test_survey_ui_certification.py index a98f8966e55..997c7e09147 100644 --- a/addons/survey/tests/test_survey_ui_certification.py +++ b/addons/survey/tests/test_survey_ui_certification.py @@ -1,8 +1,10 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. import odoo.tests + from odoo.addons.base.tests.common import HttpCaseWithUserDemo + @odoo.tests.common.tagged('post_install', '-at_install') class TestUiCertification(HttpCaseWithUserDemo): @@ -17,14 +19,13 @@ class TestUiCertification(HttpCaseWithUserDemo): 'users_can_go_back': True, 'users_login_required': True, 'scoring_type': 'scoring_with_answers', - 'certificate': True, + 'certification': True, 'certification_mail_template_id': self.env.ref('survey.mail_template_certification').id, 'is_time_limited': 'limited', 'time_limit': 10.0, 'is_attempts_limited': True, 'attempts_limit': 2, 'description': """<p>Test your vendor skills!.</p>""", - 'thank_you_message': """<p></p>""", 'question_and_page_ids': [ (0, 0, { 'title': 'Products', diff --git a/addons/survey/tests/test_survey_ui_feedback.py b/addons/survey/tests/test_survey_ui_feedback.py index 2447f7916dc..f3cec71aa91 100644 --- a/addons/survey/tests/test_survey_ui_feedback.py +++ b/addons/survey/tests/test_survey_ui_feedback.py @@ -1,8 +1,10 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. import odoo.tests + from odoo.addons.base.tests.common import HttpCaseWithUserDemo + @odoo.tests.common.tagged('post_install', '-at_install') class TestUiFeedback(HttpCaseWithUserDemo): @@ -17,7 +19,6 @@ class TestUiFeedback(HttpCaseWithUserDemo): 'questions_layout': 'page_per_section', 'description': """<p>This survey allows you to give a feedback about your experience with our eCommerce solution. Filling it helps us improving your experience.</p></field>""", - 'thank_you_message': """<p></p>""", 'question_and_page_ids': [ (0, 0, { 'title': 'General information', diff --git a/addons/survey/views/survey_survey_views.xml b/addons/survey/views/survey_survey_views.xml index d53dcfb8242..e369f760974 100644 --- a/addons/survey/views/survey_survey_views.xml +++ b/addons/survey/views/survey_survey_views.xml @@ -30,7 +30,7 @@ <button name="action_survey_user_input_certified" type="object" class="oe_stat_button" - attrs="{'invisible': [('certificate', '=', False)]}" + attrs="{'invisible': [('certification', '=', False)]}" icon="fa-trophy"> <field string="Certified" name="success_count" widget="statinfo"/> </button> @@ -94,17 +94,17 @@ </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')]}" /> - <field name="certification_mail_template_id" attrs="{'invisible': [('certificate', '=', False)]}" /> - <label for="certification_report_layout" string="Certification Template" attrs="{'invisible': [('certificate', '=', False)]}"/> - <div attrs="{'invisible': [('certificate', '=', False)]}" class="d-flex"> + <field name="scoring_success_min" attrs="{'invisible': [('scoring_type', '=', 'no_scoring')]}" /> + <field name="certification" attrs="{'invisible': [('scoring_type', '=', 'no_scoring')]}" /> + <field name="certification_mail_template_id" attrs="{'invisible': [('certification', '=', False)]}" /> + <label for="certification_report_layout" string="Certification Template" attrs="{'invisible': [('certification', '=', False)]}"/> + <div attrs="{'invisible': [('certification', '=', False)]}" class="d-flex"> <field name="certification_report_layout" class="oe_inline"/> <button name="action_survey_preview_certification_template" string="Preview" type="object" icon="fa-external-link" target="_blank" class="btn-link pt-0"/> </div> - <field name="certification_give_badge" attrs="{'invisible': ['|', ('certificate', '=', False), ('users_login_required', '=', False)]}" /> + <field name="certification_give_badge" attrs="{'invisible': ['|', ('certification', '=', False), ('users_login_required', '=', False)]}" /> <field name="certification_badge_id" attrs="{'invisible': ['|', ('certification_give_badge', '=', False), ('certification_badge_id', '!=', False)]}" domain="[('survey_id', '=', active_id), ('survey_id', '!=', False)]" context="{'default_name': title, @@ -135,7 +135,7 @@ <field name="arch" type="xml"> <tree string="Survey"> <field name="active" invisible="1"/> - <field name="certificate" invisible="1"/> + <field name="certification" invisible="1"/> <field name="title"/> <field name="state"/> <field name="answer_count"/> @@ -143,7 +143,7 @@ <field name="success_count"/> <field name="success_ratio"/> <field name="answer_score_avg"/> - <button name="certificate" icon="fa-trophy" title="Certificate" aria-label="Certificate" attrs="{'invisible': [('certificate', '=', False)]}"/> + <button name="certification" icon="fa-trophy" title="Certification" aria-label="Certification" attrs="{'invisible': [('certification', '=', False)]}"/> <!-- Tweak as icons aren't directly supported in xml --> </tree> </field> @@ -156,7 +156,7 @@ <field name="state" /> <field name="title" /> <field name="answer_done_count" /> - <field name="certificate" /> + <field name="certification" /> <field name="scoring_type" /> <field name="color" /> <field name="access_mode"/> @@ -167,7 +167,7 @@ <templates> <div t-name="kanban-box" t-attf-class="oe_kanban_color_#{kanban_getcolor(record.color.raw_value)} oe_kanban_card oe_kanban_global_click o_kanban_card_survey - #{record.certificate.raw_value ? 'o_kanban_card_survey_successed' : ''}"> + #{record.certification.raw_value ? 'o_kanban_card_survey_successed' : ''}"> <div class="o_dropdown_kanban dropdown" t-if="widget.editable"> <a role="button" class="dropdown-toggle o-no-caret btn" data-toggle="dropdown" data-display="static" href="#" aria-label="Dropdown menu" title="Dropdown menu"> @@ -198,7 +198,7 @@ <div class="col-4 p-0 border-left" t-if="record.scoring_type.raw_value != 'no_scoring'" > <a name="action_survey_user_input_certified" type="object" class="d-flex flex-column align-items-center"> <span class="font-weight-bold"><field name="success_count"/></span> - <span class="text-muted" t-if="!record.certificate.raw_value">Passed</span> + <span class="text-muted" t-if="!record.certification.raw_value">Passed</span> <span class="text-muted" t-else="">Certified</span> </a> </div> @@ -231,7 +231,7 @@ <field name="arch" type="xml"> <search string="Survey"> <field string="Survey" name="title"/> - <filter string="Certification" name="certificate" domain="[('certificate', '=', True)]"/> + <filter string="Certification" name="certification" domain="[('certification', '=', True)]"/> <separator/> <filter string="Archived" name="inactive" domain="[('active', '=', False)]"/> <separator/> diff --git a/addons/survey/views/survey_templates.xml b/addons/survey/views/survey_templates.xml index 78d5bdb3968..30dfc0ca485 100644 --- a/addons/survey/views/survey_templates.xml +++ b/addons/survey/views/survey_templates.xml @@ -7,8 +7,8 @@ <t t-call-assets="survey.survey_assets" lazy_load="True"/> </xpath> <xpath expr="//header" position="before"> - <t t-set="no_header" t-value="no_header or survey.certificate"/> - <t t-set="no_footer" t-value="no_footer or survey.certificate"/> + <t t-set="no_header" t-value="no_header or survey.certification"/> + <t t-set="no_footer" t-value="no_footer or survey.certification"/> </xpath> <xpath expr="//header" position="after"> <div id="wrap" class="oe_structure oe_empty"/> @@ -32,7 +32,7 @@ </p> </div> <a role="button" class="btn btn-primary btn-lg" t-att-href="'/survey/fill/%s/%s' % (survey.access_token, answer.token)"> - <t t-if="survey.certificate"> + <t t-if="survey.certification"> Start Certification </t> <t t-else=""> diff --git a/addons/survey/views/survey_templates_management.xml b/addons/survey/views/survey_templates_management.xml index 4d0a0662e71..055915be91a 100644 --- a/addons/survey/views/survey_templates_management.xml +++ b/addons/survey/views/survey_templates_management.xml @@ -77,7 +77,7 @@ <t t-if="answer.test_entry" t-call="survey.survey_button_form_view" /> <div class="jumbotron mt32"> <h1>Thank you!</h1> - <div t-field="survey.thank_you_message" class="oe_no_empty" /> + <div t-field="survey.description_done" class="oe_no_empty" /> <div class="row"> <div class="col"> <t t-if="survey.scoring_type != 'no_scoring'"> @@ -85,7 +85,7 @@ <t t-if="answer.quizz_passed"> <div>Congratulations, you have passed the test!</div> - <div t-if="survey.certificate" class="mt16 mb16"> + <div t-if="survey.certification" class="mt16 mb16"> <a role="button" class="btn btn-primary btn-lg" t-att-href="'/survey/%s/get_certification' % survey.id"> diff --git a/addons/survey/views/survey_templates_statistics.xml b/addons/survey/views/survey_templates_statistics.xml index 73bd99e867a..5e67ba98b1c 100644 --- a/addons/survey/views/survey_templates_statistics.xml +++ b/addons/survey/views/survey_templates_statistics.xml @@ -8,7 +8,7 @@ <t t-call="survey.survey_button_form_view" /> <div class="jumbotron mt32"> <h1><span t-field="survey.title" /> - <span style="font-size:1.5em;" t-attf-class="fa fa-bar-chart-o #{'fa-bar-chart-o' if survey.scoring_type == 'no_scoring' else 'fa-trophy' if survey.certificate else 'fa-question-circle-o'} float-right " role="img" aria-label="Chart" title="Chart"/></h1> + <span style="font-size:1.5em;" t-attf-class="fa fa-bar-chart-o #{'fa-bar-chart-o' if survey.scoring_type == 'no_scoring' else 'fa-trophy' if survey.certification else 'fa-question-circle-o'} float-right " role="img" aria-label="Chart" title="Chart"/></h1> <div t-field="survey.description" class="oe_no_empty" /> <h2 t-if="not answers"> Sorry, no one answered this survey yet. diff --git a/addons/test_website_slides_full/tests/test_ui_wslides.py b/addons/test_website_slides_full/tests/test_ui_wslides.py index 921ec175e8c..00fb8a5a157 100644 --- a/addons/test_website_slides_full/tests/test_ui_wslides.py +++ b/addons/test_website_slides_full/tests/test_ui_wslides.py @@ -59,12 +59,11 @@ class TestUi(TestUICommon): 'users_can_go_back': True, 'users_login_required': True, 'scoring_type': 'scoring_with_answers', - 'certificate': True, + 'certification': True, 'certification_mail_template_id': self.env.ref('survey.mail_template_certification').id, 'is_attempts_limited': True, 'attempts_limit': 3, 'description': "<p>Test your furniture knowledge!</p>", - 'thank_you_message': "<p></p>", 'question_and_page_ids': [ (0, 0, { 'title': 'Furniture', diff --git a/addons/website_slides_survey/controllers/main.py b/addons/website_slides_survey/controllers/main.py index 2a842790a81..cda54c29322 100644 --- a/addons/website_slides_survey/controllers/main.py +++ b/addons/website_slides_survey/controllers/main.py @@ -9,5 +9,5 @@ class WebsiteSlidesSurvey(http.Controller): @http.route(['/slides_survey/certification/search_read'], type='json', auth='user', methods=['POST'], website=True) def slides_certification_search_read(self, fields): return { - 'read_results': request.env['survey.survey'].search_read([('certificate', '=', True)], fields), + 'read_results': request.env['survey.survey'].search_read([('certification', '=', True)], fields), } diff --git a/addons/website_slides_survey/data/survey_demo.xml b/addons/website_slides_survey/data/survey_demo.xml index c1dc1400b5e..2cb6451cbcf 100644 --- a/addons/website_slides_survey/data/survey_demo.xml +++ b/addons/website_slides_survey/data/survey_demo.xml @@ -10,12 +10,11 @@ <field name="users_can_go_back" eval="True" /> <field name="users_login_required" eval="True" /> <field name="scoring_type" >scoring_with_answers</field> - <field name="certificate" eval="True"></field> + <field name="certification" eval="True"></field> <field name="certification_mail_template_id" ref="survey.mail_template_certification"></field> <field name="is_attempts_limited" eval="True" /> <field name="attempts_limit">3</field> <field name="description"><p>Test your furniture knowledge!.</p></field> - <field name="thank_you_message"><p></p></field> </record> <!-- Page 1 --> <record model="survey.question" id="furniture_certification_page_1"> diff --git a/addons/website_slides_survey/tests/test_course_certification_failure.py b/addons/website_slides_survey/tests/test_course_certification_failure.py index d4c32c4d4fc..1876ff8f6ae 100644 --- a/addons/website_slides_survey/tests/test_course_certification_failure.py +++ b/addons/website_slides_survey/tests/test_course_certification_failure.py @@ -14,9 +14,9 @@ class TestCourseCertificationFailureFlow(TestSurveyCommon): 'access_mode': 'public', 'users_login_required': True, 'scoring_type': 'scoring_with_answers', - 'certificate': True, + 'certification': True, 'is_attempts_limited': True, - 'passing_score': 100.0, + 'scoring_success_min': 100.0, 'attempts_limit': 2, 'state': 'open', }) diff --git a/addons/website_slides_survey/views/slide_slide_views.xml b/addons/website_slides_survey/views/slide_slide_views.xml index 57c802c65c8..483d003094f 100644 --- a/addons/website_slides_survey/views/slide_slide_views.xml +++ b/addons/website_slides_survey/views/slide_slide_views.xml @@ -8,7 +8,7 @@ <xpath expr="//field[@name='slide_type']" position="after"> <field name="survey_id" attrs="{'invisible': [('slide_type', '!=', 'certification')], 'required': [('slide_type', '=', 'certification')]}" - domain="[('certificate', '=', True)]"/> + domain="[('certification', '=', True)]"/> </xpath> </field> </record> diff --git a/addons/website_slides_survey/views/survey_survey_views.xml b/addons/website_slides_survey/views/survey_survey_views.xml index 93f7fe105ed..87eda55e778 100644 --- a/addons/website_slides_survey/views/survey_survey_views.xml +++ b/addons/website_slides_survey/views/survey_survey_views.xml @@ -4,8 +4,8 @@ <field name="name">Certifications</field> <field name="res_model">survey.survey</field> <field name="view_mode">kanban,tree,form</field> - <field name="domain">[('certificate', '=', True)]</field> - <field name="context">{'default_certificate': True, 'default_scoring_type': 'scoring_with_answers'}</field> + <field name="domain">[('certification', '=', True)]</field> + <field name="context">{'default_certification': True, 'default_scoring_type': 'scoring_with_answers'}</field> <field name="help" type="html"> <p class="o_view_nocontent_smiling_face"> Add a new certification @@ -17,8 +17,8 @@ <field name="name">Certifications</field> <field name="res_model">survey.survey</field> <field name="view_mode">tree,kanban,form,graph</field> - <field name="domain">[('certificate', '=', True)]</field> - <field name="context">{'default_certificate': True}</field> + <field name="domain">[('certification', '=', True)]</field> + <field name="context">{'default_certification': True}</field> <field name="help" type="html"> <p class="o_view_nocontent_smiling_face"> Add a new certification |
