Files
odoo_source/addons/survey/data/mail_template_data.xml
T
Aurélien Warnon afb1abbb60 [IMP] survey: scoring & certification
Task #1902306

Purpose
=======

This commit adds certification capabilities to the survey module.

A certification is a survey with the "certification" flag set to true than can be linked
to a certification email template that contains a certification document (PDF).
This template can be edited by the user in the technical settings to customize the certification email/document.

To be able to implement this certification concept, we also have to add scoring mechanisms to surveys.
survey.questions of type 'simple_choice' and 'multiple_choice' now have scores for the suggested answers.
These question scores allow to compute a global score that is used to determine whether the user has successfully
passed the certification or not.

As additional features, we also have:
- A time limit with an interface timer that limits the test to X minutes
  When reached, the survey is automatically submitted and unregistered (= unsubmitted) answers are not taken into account.
- A limited number of attempts for the survey/certification
  If reached, the user can't take the survey/certification anymore

The 'survey result' layout was adapted accordingly to show the success rate of participants and the correct answers
to the survey questions.

Specs
=======
- Create a new survey :
  - Add a description field for the survey

- Options on a survey :
  - Passing score : (sum of all good answers) in %
  - If No scoring => No passing score, no certificate
  - If Scoring with answers => Passing score and can see the answers (can create certificate)
  - If Scoring without answers => Passing score but can't review the answers at the end (can create certificate)
  - for the questions, if "no scoring" selected, can 't see the option "good answer" and "score" on the questions
  - If the 2 others options, can see the options "good answer" and "score" on the questions
  - all the types of questions are available for each option.

- Questions
  - Add the option correct answer on the multiples questions (one or more good answers)

- Certifications
  - If scoring, force "mandatory" for "mutliple choices (1or multiple answers)"
  - On the dashboard => visual information that this specific survey is a certification
  - Time Limit : The student is informed on the home screen of the survey of the time limit.
    The clock start when he clicks on "start survey"
  - Template of the certificate : send email with attachment PDF

- Front-end :
  - Add some margin
  - Replace "Back to survey" with the blue-bar from the portal
  - Add a timer (start when the survey starts)
  - Add a progress bar (number of section and number of question inside the section)

- Analyse of the results :
  - First a global graph with the number of people who''ve participated and passed the test

- Stages of a survey :
  - Remove the stage "Permanent"
  - 3 stages :
    - draft : not on-line but can be tested (with phantom token)
    - In progress : on-line
    - closed : not on-line
  - Who can test a survey : the manager and the user. Add this condition to the phantom token.
2019-02-06 10:34:40 +00:00

69 lines
3.8 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="mail_template_user_input_invite" model="mail.template">
<field name="name">Survey: Send by email</field>
<field name="model_id" ref="model_survey_user_input" />
<field name="subject">Participate to ${object.survey_id.title} survey</field>
<field name="body_html" type="html">
<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/>
We are conducting a survey and your response would be appreciated.
<div style="margin: 16px 0px 16px 0px;">
<a href="${('%s?answer_token=%s' % (object.survey_id.public_url, object.token)) | safe}"
style="background-color: #875A7B; padding: 8px 16px 8px 16px; text-decoration: none; color: #fff; border-radius: 5px; font-size:13px;">
Start Survey
</a>
</div>
% if object.deadline:
Please answer the survey for ${format_date(object.deadline)}.<br/><br/>
% endif
Thank you for your participation.
</p>
</div>
</field>
<field name="auto_delete" eval="True"/>
<field name="user_signature" eval="False"/>
</record>
<!-- Certification Email template -->
<record id="mail_template_certification" model="mail.template">
<field name="name">Certification: Send by email</field>
<field name="model_id" ref="survey.model_survey_user_input"/>
<field name="email_to">${(object.partner_id.email_formatted or object.email) |safe}</field>
<field name="partner_to">${object.partner_id.id}</field>
<field name="subject">Certification: ${object.survey_id.display_name}</field>
<field name="report_template" ref="certification_report"/>
<field name="report_name">Certification Document</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="auto_delete" eval="True"/>
<field name="body_html" type="xml">
<div style="background:#F0F0F0;color:#515166;padding:10px 0px;font-family:Arial,Helvetica,sans-serif;font-size:14px;">
<table style="width:600px;margin:5px auto;">
<tbody>
<tr><td>
<!-- We use the logo of the company that created the survey (to handle multi company cases) -->
<a href="/"><img src="/logo.png?company=${object.survey_id.create_uid.company_id.id}" style="vertical-align:baseline;max-width:100px;" /></a>
</td><td style="text-align:right;vertical-align:middle;">
Certification: ${object.survey_id.display_name}
</td></tr>
</tbody>
</table>
<table style="width:600px;margin:0px auto;background:white;border:1px solid #e1e1e1;">
<tbody>
<tr><td style="padding:15px 20px 10px 20px;">
<p>Dear <span>${object.partner_id.name or 'participant'}</span></p>
<p>
Here is, in attachment, your certification document for
<strong>${object.survey_id.display_name}</strong>
</p>
<p>Congratulations for succeeding the test!</p>
</td></tr>
</tbody>
</table>
</div>
</field>
</record>
</data>
</odoo>