Commit Graph
83 Commits
Author SHA1 Message Date
wde-odoo 1fb99d79b1 [IMP] survey: improve survey usability in backend
PURPOSE

This commit globally improves the backend survey module usability, notably by
renaming labels, moving menu items around and cleaning unused features.

SPECIFICATIONS

These changes include (non-exhaustive list):

On questions

  - Changing labels, action helpers and modules description to be clearer;
  - Re-organizing the survey.question form view, notably to clearly distinguish
    fields related to answers and validation options;
  - Removing the "Clean test answers" server action as it can be done through
    a search + unlink;
  - Removing the allow_value_image field as we now always display the
    image field. Users simply choose to let it blank;

On surveys

  - Re-organizing the survey.survey form view fields to get a clear view of
    the various options;
  - automatically update scoring type when checking certification: if not one
    linked to scoring, update to scoring without answers;
  - set create as create_multi to speedup batch creation;
  - Changes ACL rights for user_input_line. Now, only Survey Managers can
    change answers. Survey users keep only a read access on answers, meaning
    changing what customers / people answered is now limited to managers;

Globally

  - Moving menu items and make them visible outside debug mode;
  - Answer recap on print frontend page is now visible whenever a scoring is
    applied, not only for certification, as if scoring is activated seeing
    answers is probably wanted;

Task-2600241

closes odoo/odoo#79813

Related: odoo/upgrade#3033
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-12-01 18:39:45 +00:00
David Beguin d393f98a81 [IMP] survey: add question placeholder
Purpose
=======

As an Interviewer, I want my questions to be as clear as possible. To this end
I would like to be able to detail a bit which kind of answers I expect.

Specifications
============

For all the question types that require an input, display a char field
"Placeholder" in the Answers tab with an helper that says:
"When set, this text will appear in the field to help participants answer."
Then on the survey, display the placeholder in the question input zone.

Task-2671388

closes odoo/odoo#78682

Related: odoo/upgrade#2998
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-26 10:31:41 +00:00
Nicolas Bayet 4813f42997 [IMP] mail,*: replace jinja with qweb
Jinja as a templating engine was problematic in differents respect:
- introduce external dependency to Odoo (less controll)
- add another templating mechanism in the stack
- specific feature in qweb cannot be reused
- difficulty in rendering easily editable templates
- more knowledge required with no betterment

By replacing jinja with qweb we can now build tools to edit a qweb
that will work with the previously jinja encoded document
(essentially `mail.template` records).

There is a catch however. Some email fields (eg. email_to) used jinja
syntax for rendering dynamic variables (ie. ${object.something} and
${object.something_that_should_not_be_escaped | safe}).

We still want user to use dynamic variables for some char fields (eg.
subject, from, to, ...). We made a new rendering engine called
"inline_template" that will render an expression enclosed by `{{` and
`}}`.

To be able to edit the templates from the backend interface, a
plugin to the Odoo editor has been made for seamlessly edit the
document.

This qweb plugin includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
  (for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif, and t-else)
  in order to see only one at once
- a floating select input to switch visibility of a particular logical
  branching

Task-27033

X-original-commit: odoo/odoo@68182baff4
Part-of: odoo/odoo#77377
2021-09-28 23:42:54 +00:00
52fedc8e91 [IMP] survey: add average duration on survey
Average duration of each survey is added. To avoid performance issues value
is not stored, and calculated with raw SQL. It requires to have an end
datetime on survey user inputs, allowing to compute average duration it
took people to complete survey.

Live surveys now open in a new tab instead of in-place.

Also rename some css / scss files to ease understanding. Remove unnecessary
class on survey form view.

Task-2634805
PR odoo#72298

Part-of: odoo/odoo#72298
Co-authored-by: David Beguin <dbe@odoo.com>
Co-authored-by: Mariska Archielli <ram@odoo.com>
Co-authored-by: Thibault Delavallee <tde@odoo.com>
2021-08-31 23:34:55 +00:00
Thibault Delavallée 18b555bbf8 [IMP] survey: reorganize (and fix) demo data
Purpose is to clearly separate various available demo surveys, their user
inputs and input lines. It is easier to update and maintain those demo
data in several files than hidden in big files or CSV files. No change
should occur with this commit as this is only some data manipulation.

We also quickly cleanup some demo data in this commit. Notably

  * remove unnecessary user inputs;
  * improve passed / succeeded statistics by improving or adding right
    answers;
  * fix some typos;

Task-2634805
PR odoo/odoo#72298
2021-08-31 23:34:54 +00:00
Thibault Delavallée 1766e0147d [MOV] various: reorganize templates into their right files
Purpose is to have all mail template into a mail_template_data.xml file
when possible. It eases maintenance and update when having to work globally
on template records.

Also update some ``body_html`` declarations still using ``xml`` instead of
``html``.

Task ID-2534550 (Template usage improvement)
Task ID-2477164 (Composer mixin)
Prepares Task ID-27033 (QWeb in templates)
COM PR odoo/odoo#70889
ENT PR odoo/enterprise#18352
2021-06-01 09:19:45 +00:00
Thibault Delavallée bfbd42c5f4 [FIX] survey, website_slides: make invite coherent and improve templates
In this commit we fix some glitches in slide invite process

  * prevent from sending without recipients as it makes no sense;
  * hide Invite link in kanban like Invite button on form view, when not
    being invite-based;
  * fix small issues in various templates, notably escaping in subject;

Task ID-2534550 (Template usage improvement)
Task ID-2477164 (Composer mixin)
COM PR odoo/odoo#70889
2021-06-01 09:06:07 +00:00
Dharmraj Jhala f8738b70f4 [IMP] {hr_recruitment_,website_slides_}survey: add 'user_id' field
This commit enable users to set a 'Responsible' for the survey by
adding 'user_id' field. Demo data for the same is also updated.

Task ID-2389434
COM PR odoo/odoo#62712
ENT PR odoo/enterprise#15217
UPG PR odoo/upgrade#2006
2021-02-10 17:03:59 +00:00
ijas ahammed 3010751e95 [IMP] {hr_recruitment_,website_slides_}survey: remove 'state' field
The goal of the draft state on survey is to have the survey under edition
mode before before sending it to participants. Under this mode:
  - the responsible can test it (can be done with "In Progress" mode)
  - the survey can't be answered (same as the state closed)

The risk that the survey can be leaked before being ready is really
limited. If it's a live survey, participants will have to guess the
4 digits access code and wait for the host to go to the next question.
Else, participant will have to guess the token.

Considering these facts, the use of the draft state is very limited so
'draft' state can be dropped. If we do so, we are left with only two
stages that are 'open' and 'closed'. But whether to consider survey
open or closed can be simply achieved with active field we already
have (if active=False, survey is closed, otherwise it's considered
as open).

So with this commit, we remove the state field from survey and thus
simplify the flow. It means that we no longer require 'Start Survey'
button, and so that button is also removed, and for the closed surveys,
instead of the button 'Set to draft', now we have a 'Reopen' button
which will activate the survey. And instead of displaying few buttons
after saving a record, we now display all the buttons from beginning.

Task ID-2389434
COM PR odoo/odoo#62712
ENT PR odoo/enterprise#15217
UPG PR odoo/upgrade#2006
2021-02-10 17:03:03 +00:00
Martin Trigaux e433bc57ff [FIX] *: rephrase, correct typos
Courtesy of Transifex's translators for reporting bad/unclear sentences.

closes odoo/odoo#61804

X-original-commit: f5d0f4a1ebf406583889e9e04912d40c0693343e
Related: odoo/enterprise#14769
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-11-16 16:47:28 +00:00
Martin Trigaux c59c10f1bc [FIX] *: correct typos and bad English
Courtesy of translators
Reexport .pot of modified modules

closes odoo/odoo#61010

X-original-commit: 62a18bdb372e234107fd2099a2df5f9e3a442c96
Related: odoo/enterprise#14489
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-29 19:23:41 +00:00
Victor Feyens 594ccdcbf4 [FIX] *: typos and english incoherences
Mainly transifex issues but also some errors found through 'grep' checks.

Fix typos and obscure english strings in xml contents, fields strings/helps, some docstrings, ...
ensuring correct translations base (and fallback when translations isn't available).

closes odoo/odoo#57276

X-original-commit: 4214f05d454bca2b60fda3a288d529c098e84f77
Related: odoo/enterprise#13053
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-09-08 18:12:26 +00:00
Aurélien Warnon 695294b953 [IMP] survey: apply small survey form design changes
This commit slightly improves the survey form by adding a few cosmetic changes,
notably:

- Add/reduce some margins/paddings
- Adjust colors/font-weight
- Adjust heights
- Change some icons by more fitting replacements
- Center matrix choices
- Move survey progression to bottom-right
- Remove ugly jumbotrons
- Hide survey title in page_per_question layout
- When there are 5 or less option for simple_choice or multiple_choice
  questions, display the options vertically.
- Only show the textarea for the "comment answer" if the user clicks on the
  related option.

One of the biggest design change is the introduction of a "minimized layout"
that reduces the width of some question types on bigger screen.
This gives a cleaner look to the survey form.
Impacted question types:
- Numeric
- Date
- Datetime
- Simple / Multiple choices

Technical note: As the survey progression is now outside of the survey content,
that was re-rendered on every submit, we have to manually refresh the
progression with a second template render on the controller side.

Small fix addition:
We also fix the matrix key selection feature in case the matrix had a total of
more than 25 options, which would raise an error.
Indeed, they "use key selection" condition only checked the number of rows,
and not the rows * columns (total number of options count).

LINKS

PR #46768
Task 2208574
2020-03-31 15:43:03 +00:00
Tiffany Chang (tic) c099a504ad [IMP] survey: add new scoreable questions demo/test data
Adding additional demo and test data for new scorable question types:
'numerical_box', 'date', and 'datetime'. Includes both a scored and
unscored (i.e. answer_score = 0) version for each question type to
ensure differing behavior is viewable in survey results.

Also updating existing data/tests to:
1. Follow American standard for $ placement.
2. Have hardcoded 'answer_is_correct' and 'answer_score' demo data (due
   to updated correct answer implementation being done via frontend
   input only)
3. Update minor errors in the existing demo data (for example, removing
   2nd answer for a single answer choice question for the same survey
   submission).

Upgrade PR: odoo/upgrade#835
Task ID: 2061937
2020-03-18 10:17:08 +00:00
Arnaud Baes bf242977e2 [FIX] survey: allow mail templates updates.
Otherwise, users will ending up with broken templates if
they update from v12

closes odoo/odoo#47120

X-original-commit: 3f84cae060c62839e8d493c0b90539363469f5f3
Signed-off-by: Toufik Benjaa (tbe) <tbe@odoo.com>
2020-03-06 16:36:33 +00:00
David Beguin 3968bed239 [IMP] survey: add conditional questions demo data
Purpose
=======

This commit adds demo data to illustrate the conditional questions
configuration. Users will be able to choose among 4 themes. Depending on their
choice(s), the survey will continue by displaying only the questions related
to the selected theme(s).

Link
====

Task ID: 23509
PR #44950
2020-03-06 10:29:50 +00:00
mcm-odooandThibault Delavallée de1743ab12 [REF] mail, various: remove user_signature field from mail.template
RATIONALE

Mail template model holds a field telling odoo mail engine to automatically
add the current user's signature to the body. Its use depends on the use
case

  * using the template in the composer on a single record: it is displayed
    in the rendered template in the composer, meaning people could change it.
    This behavior is interesting as it allows to see the email content;
  * using the template in the composer in mass mail mode: it is not displayed
    as only the raw jinja is displayed. It is therefore not obvious that it
    will be appended to the body of the mail. People could add it manually and
    have 2 signatures as a result;

A mechanism automatically adding a signature to sent emails when posting a
message is already implemented and is based on template existence. If a
template has been used when posting, no signature is added in sent emails.
Otherwise it is automatically added. This behavior should not change.

Behavior will therefore be

  * use a template -> specify signature usage in it manually through jinja;
  * do not use a template -> signature added in sent emails;

SPECIFICATIONS

Remove user_signature.

Update template body accordingly. In customer oriented templates that are using
it and do not already contain it, manually add a call to user.signature within
the jinja code. When set to False, just remove its declaration.

Quickly clean some signature integration.

LINKS

Task ID 2089252
Community PR odoo/odoo#39482
Enterprise PR odoo/enterprise#6459
Upgrade PR odoo/upgrate#761

Related: odoo/enterprise#6459
Related: odoo/upgrade#761
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2020-02-11 14:01:13 +00:00
Aurélien Warnon f9710a68d6 [IMP] survey: improve demo data for quiz session
This commit improves the new survey "quiz" demo data by adding some questions to fill in the email
and nickname of the user with the associated user inputs.

PR #43568
Task 1972640
2020-01-31 14:35:49 +00:00
Aurélien WarnonandDavid Beguin e973bd5519 [IMP] survey: add a 'live session' mode to the survey app
PURPOSE

Add a "live session" mode for survey that allows the host to interact with its
audience.
He controls the pace of the survey and the audience answers questions one at a
time.

Results for each question can be displayed by the host to adapt his speech in
real time.

A gamification component even allows to give points to the attendees, based on
the quickness of their answer, and create ranking to keep everyone's attention.

SPECIFICATIONS

This whole feature is deeply integrated with survey.
It adds a layer of "survey session" on top if it that gathers attendees and
answers during the lifespan of the session.

The attendee identity is filled in by a special question that is marked as
"Save as user nickname".
If the host has not configured that question or if the user doesn't answer,
they are marked as "Anonymous" in the rankings.

The answer score computation is also altered during the session to take the
speed of the answer into account.

To ease the access to the survey to attendees, we have introduced two new
routes in the survey main controller:
- '/s/123456'
  That uses the 6 first characters of the token to give quick access to the
  survey and allow typing the URL manually somewhat conveniently.
- '/s' that renders a view that asks the attendee to enter the survey 'code',
  which then redirects to the previous route.

This commit also fixes a few bugs:
- A bugged use case with the "enter key" listener.
  When the survey is done, we display a "result template" that shows the user
  his score and allows him to retry if possible.
  When this template is displayed, we don't want to listen to the "enter" key
  that allows to submit the survey form.
- We now correctly remove the timer and initialize the result
  widget when the user presses 'enter' on the last page / question.

SURVEY SESSION FLOW

HOST point of view:

- On the Survey Form, the host configures:
    - "Reward quick answers" that gives more points to attendees if they answer
      quickly
    - Question Time Limit, on each question, that defines the time limit for
      that specific question, allowing to have different (or no) timer for each
      question.
- From the Survey Form, the host can start a "live session"
  Only one session per survey can be running at a time.
- When he starts the session, the session_state is marked as 'ready', meaning
  all attendees landing on the survey page will be part of the session.
- The host will land on a page showing the current number of attendees as well
  as the link for the attendees to join that session.
- The host starts the session, activating the first question of this session.
  We keep an active reference to the "current_question_id" and use the bus to
  trigger an event that will refresh the survey page for all attendees, showing
  them the question and allowing them to answer.
- The host gets a "question management screen", from which he can:
    - See the current question text & suggested answers
    - See the current question timer
    - See the number of answers received for the question
    - Display the answers of the question (same view as the survey "results"
      page, but only for the question)
    - Display the ranking of attendees (if "competitive mode" is enabled)
- The host controls the pace of the survey by moving to the next question until
  it's the last one of the survey, then ends the current session.
  When the session is closed, we mark the answers of the attendees as "done".
- The host lands on a screen where he sees the survey results and the ranking
  of all attendees.

ATTENDEE point of view:

- He reaches the survey when a session and open, and gets a screen asking him
  to wait until the host decides to start the session.
- When the sessions starts, he's automatically redirected to the first question
  (see above).
- If the session is already started when he reaches the link, he lands on the
  current question (and NOT on the first one)
- If the host has configured a time limit, the attendee sees the countdown
  while he's answering.
- When the attendee answers the question, the screen tells him the answer is
  registered and he has to wait for the host to go to the next question, which
  will happen automatically.
- If the timer reaches 0 and he has not submitted his answer, it's too late and
  he waits for the next one.
- It continues like that until the end of the session.
- At the end of the session, the attendee gets a screen with his global results
  (same as a regular scored survey).

PR #43568
Task 1972640

Co-authored-by: David Beguin <dbe@odoo.com>
2020-01-31 14:35:48 +00:00
Jérémy Hennecart 79ce907f66 [IMP] survey: add demo data for media on survey
Quizz survey is updated to demonstrate the use case of media on questions and
answers. Happy surveying.

Task ID 2083823
PR #42228

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-01-29 10:09:03 +00:00
David Beguin aedeccbeea [IMP] survey : redesign frontend layout
In this commit, all the questions type have been redesigned to look more fancy.
(impacted question types : radio and checkboxes, text boxes (textarea and text
inputs, date and datetime inputs and matrix)

For radio and checkboxes, both design have been aligned to work the same way
(except checkboxes can still have more than one selected option).
Selection by key have been applied on those two question types if the number of
option is under 26 (to use all the alphabeat character for selection). This
selection by key is only available on page per question layout.

Tests have been adapted accordingly to the redesign (typically for choice and
matrix inputs)

* Progress Bar

This commit adds a progress bar to the survey to inform the user
where he is in the survey filling process.

There are two progress modes:
    - Number : will display the number of the current page on the total number
    of pages (or questions if layout mode is question_per_page)
    - Percentage : will display the percentage of page or question already done

So this leads to, on last page:
    - in Number mode :
    the progress bar div is 100% filled         3 / 3 pages   [===]
    - in percentage mode :
    the progress bar is aligned to percentage   66% completed [== ]

* Print Widget

A widget is added for survey print mode in order to resize all textarea to fit
their content, instead of showing a scroll bar. This can be usefull if user
wants to print the results. He will get the entire content of the 'textarea
answers' instead of only the two first lines.

* Misc

This commit also :
    - adds background image to survey.
    - redo quizz correction and add some data to illustrate non scored
    questions rendering in print template
    - review breadcrumb style

Note : readonly data option on survey form widget is not set anywhere yet but
the usage is done in prevention of the future work on presenter view for survey
session mode.

Task ID: '2150291'
PR #43237
2020-01-17 16:04:17 +00:00
David Beguin f325813c06 [REF] survey: rename skip state in in_progress
This commit renames state 'skip' into 'in_progress' as 'skip' does not really
mean anything.

Task ID: 2152223
PR #41453
2020-01-10 11:01:04 +00:00
David Beguin 792d71faf5 [REF] survey: remove display mode for simple choice questions
This commit prepares the complete redesign of survey.
Simple choice question type will only use the radio button display mode.
So the dropdown display mode is deleted.

Task ID: 2152223
PR #41453
2020-01-10 11:01:04 +00:00
Thibault Delavallée f7fb9b96f4 [IMP] survey: improve demo data
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

Add a new demo survey about a quiz: a survey with scoring but no certificate.
Have almost all possible combinations of questions and options (notably choices
to have a scoring) and answer lines in order to be able to, notably, debug
the statistics / result page.

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
2019-12-05 15:21:28 +00:00
Thibault Delavallée 0406b7049e [REF] survey: on survey.{question,user_input.line}, make type and field names match
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

To better understand question type and their input type, we update some of
``survey.question`` ``question_type`` keys :

  Type----Old type-----New type

  text----free_text----text_box
  char----textbox------char_box

Untouched question types: ``numerical_box``, ``date``, ``datetime``,
``simple_choice``, ``multiple_choice``, ``matrix``. Those are already
understandable.

Then ``survey.user_input.line`` ``answer_type`` keys are also updated to
match their question type counterparts

  QuestType--------Old type-----New type

  text_box---------free_text----text_box
  char_box---------text---------char_box
  numerical_box----number-------numerical_box

Then ``survey.user_input.line`` fields used to store the value are updated to
propagate the new naming

  AnswerLineType----Old field----------New field

  text_box----------value_free_text----value_text_box
  char_box----------value_text---------value_char_box
  numerical_box-----value_number-------value_numerical_box

Untouched answer types and field storing value: ``date``, ``datetime`` still
refer to same question type and use value_date / value_datetime fields.
``simple_choice``, ``multiple_choice`` and ``matrix`` still use ``suggestion``
answer type and ``suggested_answer_id`` (+ ``matrix_row_id``) to store link
to ``survey.question.answer`` records.

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
2019-12-05 15:21:28 +00:00
Thibault Delavallée 2a35d92b6c [REF] survey: on survey.user_input, rename question_ids field to predefined_question_ids
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

``question_ids`` field name is quite difficult to understand as we wonder why
there is such a field on user input model. As its purpose is to store questions
user has to answer (randomly chosen or all chosen) let us rename it to
``predefined_question_ids``.

Moreover starting from now on if it is now given at create it is automatically
computed. Classic flows go through ``survey._create_answer()`` method that
prepares them accordingly. However tests or demo data do not necessarily go
through that method and it makes scoring fail (notably) if people forget
to define them.

Let us automatically generate them at user input create if not given.

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
2019-12-05 15:21:28 +00:00
Thibault Delavallée 3a094f2294 [REF] survey: on survey.user_input.line, rename value_suggested{_row} fields
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

A new naming for ``survey.question.answer`` has been recently introduced:
``suggested_answer_ids`` and ``matrix_row_ids``. In this commit we propagate
that naming to survey.user_input.line model. New naming is

  * ``suggested_answer_id``: one chosen value for single / multiple choice.
    It is also used for matrix columns as those indicates the value to give
    on a given row;
  * ``matrix_row_id``: the related row of the suggested answer for matrix
    questions;

It adds two benefits

  * it finishes by _id which is always a good idea for m2o fields;
  * it better indicates the use;

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
2019-12-05 15:21:28 +00:00
Thibault Delavallée 1e66894042 [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
2019-12-05 15:21:28 +00:00
Thibault Delavallée 7edeb24de9 [REF] survey: globally rename survey.user_input_line model to survey.user_input.line
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

Main user answer model is ``survey.user_input``. It holds lines related to
answers given to specific questions. In this commit we rename this model from
``survey.user_input_line`` to ``survey.user_input.line`` to be coherent with
general odoo naming guidelines.

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
2019-12-05 15:21:28 +00:00
Thibault Delavallée 2592e72f2c [REF] survey: globally rename survey.label model to survey.question.answer
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

In this commit we rename the long standing ``survey.label`` model. Indeed
a label is something before a question, like an input label. Labels in survey
are used for suggested answers and sometimes as rows for matrix answers.

After much thoughts we rename ``survey.label`` to ``survey.question.answer``.
It indicates this model holds answers. Moreover it is namespaced within the
``survey.question`` model name to avoid conflict with user input / user answer
model.

As model naming changes, some fields also evolve. In survey.question model

  * ``labels_id`` is renamed to ``suggested_answer_ids`` to indicate it is
    used to display suggested values to the user;
  * ``labels_id_2`` is renamed to ``matrix_row_ids`` to indicate it is used
    to generate the rows of the matrix-type question. A matrix is therefore
    done using ``matrix_row_ids`` for rows and ``suggested_answer_ids`` for
    columns which seems easier to understand;

In survey.question.answer (old survey.label) model

  * ``question_id_2`` is renamed to ``matrix_question_id`` to ease its
    understanding, notably that it is used for matrix questions;

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
2019-12-05 15:21:28 +00:00
Thibault Delavallée 84bb9c748d [REF] survey: remove unused or unnecessary fields to clean models
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: QUESTION FIELD ON SURVEY.SURVEY

On survey.survey, remove question field, unnecessary related on title.

Question model holds two fields for its title: ``title`` and ``question``.
Question is simply a related on title, making the two fields completely
redundant. It is mainly due to historical reasons, when updating models for
certifications and eLearning. In this commit we keep only title field and
remove the question related field as it adds unnecessary complexity to the
model.

SPECIFICATIONS: INPUT_TYPE FIELD ON SURVEY.USER_INPUT

On survey.user_input, remove input_type and its garbage collect.

``input_type`` field exists on user input model to tell whether answer has
been created through invite or through manual click on a survey page. It
has been added a long time ago when surveys were either open to everyone,
either closed and on invite only.

Since eLearning and certification surveys access mode on surveys has evolved.
Notably being able to distinguish invite from manual survey user input is not
necessary anymore. Indeed what is important is the way people can reach the
survey, not how they created their user input.

Invitation creates token and this can be used if people effectively want to
find invitation-related user inputs.

Since 09ea5c7d49 manual entries still in draft are garbage collected.
Reason is still unclear as it is not obvious that tons of unnecessary entries
will be created. As this seems like unnecessary optimization this commit
removes that feature along with the input_type field.

SPECIFICATIONS: REPLACE URLS FIELDS BY METHODS ON SURVEY.{SURVEY, USER_INPUT}

On survey.{survey, user_input}, remove url fields replaced by methods

In this commit we remove some remaining of URL fields that are better found
using methods. Both survey and user input holds a "start" url field that is
replaced by a method call ``get_start_url`` on both survey (generic) and
user input (token specific) models. We also introduced a ``get_print_url``
method doing the same for the printable version of survey / user input.

SPECIFICATIONS: REMOVE CATEGORY FIELD ON SURVEY.SURVEY

On survey.survey, remove unused category field.

Survey model holds a ``category`` field whose purpose is to be able to somehow
categorize surveys according to their use. However using this field is not
easy as it is hidden and is a simple selection field. Module should add their
own key. Its sole use is in ``hr_recruitment_survey`` which is a niche module.
Let us clean models and lessen model complexity.

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
2019-12-05 15:21:28 +00:00
Thibault Delavallée b9a22d2f24 [IMP] mail: add computed fields for company emails
Purpose of this commit is to give a way to access to company email and catchall
with formatting. Those will be used in various automated emails. Indeed
currently several templates use either ``company_id.partner_id.email``,
``company_id.email``, or even don't provide fallback values.

With this commit from a company record people will be able to use

  * a correctly formatted catchall: ``"My Company Name"
    <catchall_alias@catchall_domain>``
  * an email_formatted field like partner email_formatted that is either its
    partner-related email_formatted value, or formatted catchall if its partner
    is not correctly configured;

Various calls to mail creation are updated accordingly.

Task ID 1853147
PR #32243
2019-11-29 13:35:14 +00:00
David Beguin c11267d435 [IMP] survey: add certification badge demo data for MyCompany Vendor survey
Purpose is to have bioutifoul demo data.

Task ID : 1961053
PR #32594
2019-11-22 15:32:10 +00:00
David Beguin 3bb4ac8dc6 [IMP-REF] survey : refactor questions naming, validation and save flow
This commit simplifies the answer_tag and question name
by removing the survey_id (uses now only question id) for the most simple cases

Factorise the save and validate survey answers to avoid duplicate code

Review posted submit data :
- process all questions by question type (instead of using form data
(key,value) that needed key parsing and was un-typed)
- regroup answers by questions and adapt all validation and save flow
- remove post data in save and validate question methods
  and uses directly the answer(s)
- remove useless input names

The tests have been adapted consequently

Task ID : 1930132
PR #32419
2019-11-19 12:52:22 +00:00
Martin Trigaux 20c0798fd8 [FIX] survey: correct typo
X-original-commit: 637e6a1ad2bf0a13f1452436e51acc88f1a338c4
2019-10-21 12:12:47 +00:00
Thibault Delavallée 65c3be37fd [FIX] survey: set email_from on certification mail template
Otherwise public users cannot receive their certification. Indeed email_from
will be the one of public user which is probably not set.

Task 2067872 (eLearning internal testing)
Task 2058598 (survey internal testing)
PR #36756
2019-09-13 10:05:15 +00:00
mcm-odoo f1b9ce5462 [IMP] (website_slides_)survey: add demo data for certifications
This commit adds a few demo data for the certifications.

FP feedback

Task 2066646
2019-09-11 09:16:40 +00:00
Hardik PrajapatiandMohammed Shekha 2581076a09 [IMP] survey: do not set a question type on question being section
This commit header is quite fun. If a question is not a question it should
not have a type. Maybe it should not be a question but, hey, you don't always
do what you want. That's life my dear Lucette.

In this commit we remove required attribute from python field definition of
question_type and make it required conditional based. Real questions have a
type, unreal questions have no type.

Alss update Questions menu entry to display only real questions, not unreal
questions.

Most of this commit message makes no sense, but remember who asked to push
this model.

Task 2053833

closes odoo/odoo#35835

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>


Co-authored-by: Hardik K Prajapati <hap@odoo.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
2019-08-30 11:09:21 +00:00
Victor Feyens 50caae5bc0 [REF] survey: replace dynamic survey.stage by a static state on survey.survey
Stages modification through the clickable statusbar wasn't very intuitive.
By fixing default behavior through states (and corresponding buttons), default user experience is simplified.

3 static states available : draft, open, closed

Form view: navigation through states with buttons
Kanban view: disabled modification of survey state

Task ID : 1949110

closes odoo/odoo#32325

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-04-25 14:17:45 +00:00
Thibault Delavallée 678e04c19d [FIX][IMP] various: improve lang computation in mail templates
Purpose: add lang definition on templates where it is missing

Related to task 1972615
Linked to PR #32872
2019-04-23 14:26:50 +00:00
Thibault Delavallée 0b74c9ab6e [FIX][IMP] various: improve recipients computation in mail templates
Purpose: use more email_formatted when possible, clean and simplify
email_from, email_to and partner_to computation.

Next step is to try to extract some common patterns in tools or methods in
order to simplify template creation and customization.

Related to task 1972615
Linked to PR #32872
2019-04-23 14:26:50 +00:00
Priyanka Kakadiya 61495126ae [FIX] survey: correct score of answer in demo data
- when answer is correct, then score should be +1.

Related to Issue: 1967506

closes odoo/odoo#32612

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-04-11 07:02:59 +00:00
Aurélien Warnon 2fb9fe279a [FIX] survey: prevent certification email from being sent twice
Purpose
=======

The certification email template had both "email_to" and "partner_to" fields set
and that implied the mail being sent twice.

This commit removes the "partner_to" field to fix it.
2019-03-18 08:03:46 +00:00
Aurélien Warnon 7070fa3219 [IMP] survey: rename 'Survey' to 'Certification' when relevant
Purpose
=======

This commit reworks some views to rename 'Survey' to 'Certification'
for a better visual integration of the new certification flow.
2019-03-11 10:46:11 +00:00
Aurélien Warnon 445541989f [IMP] survey: add randomization and survey layout selection
Task #1902306

Purpose
=======

The "page" concept is now only present in the user interface.
Surveys are split in "sections" that have two purposes:
- Organizing a (long) survey/certification
- Allow to pick a random questions count for that section (more information here after)

On the user interface, based on the questions_layout field, surveys are displayed:
- On a single page, where sections still appear but are only used as visual separations
- On multiple pages, having one page per section (this matches the previous behavior)
- On multiple pages, having one page per *question*

On top of that page concept, this commit added randomization for the survey questions.
The randomization mechanism will take X questions per section of the survey.
The survey.user_input is initialized with the selected questions to be sure to keep that
set of questions and avoid showing a new set of questions every time the user refreshes the page.
This also allows to easilly go back and know which question we have to show.
2019-02-06 10:34:43 +00:00
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
Aurélien Warnon dba4783326 [REF] survey: convert survey.page to survey.question -> is_page=True
Task #1902306

Purpose
=======

survey.question is now also the model used for the survey's pages (with the "is_page" field set to True).
This allows to put all the pages and questions together in a o2m field on the view side and
easily reorganize your survey by dragging the items around.

It also removes one level of encoding by directly having 'Add a page' and 'Add a question'
links on the tree view of questions, enabling a faster encoding.

However, this has the downside of making the code reading a little bit more complicated.
Efforts were made at the model level to create computed fields so that the use of these models
still seems somewhat logical. That means:
- A survey still has "page_ids" (question_and_page_ids filtered on is_page = True)
- These "page_ids" still have question_ids (questions located between this page and the next)
- These "question_ids" still have a "page_id"

That makes the use and display of these information at view and controller levels easier to understand.
2019-02-06 09:37:59 +00:00
Thibault Delavallée c801eecf23 [IMP] survey: access survey through access tokens
Purpose of this commit is to use an access token to access survey instead
of their ID. Routes are updated to use that token instead of the survey ID.
Purpose is to have less discoverable routes and be able to control a bit more
survey access even if it is not really a security parameter.

Some renaming is performed to avoid confusion in terms. Survey token and
answer token are now clearly labeled differently in the code to know which
model we are working on.

Some templates are updated to directly use the answer as base record to
have access to token and test_entry fields instead of giving those parameter
values directly in the controller. It makes some more diff but also allow
easier edition and improvement in templates when having directly survey
and answer record available.

This commit is linked to task ID 1932508 and PR #30508.
2019-01-25 13:11:50 +00:00
Thibault Delavallée bde36a276e [FIX] survey: fix invite mail template
Purpose of this commit is to improve the recently-introduced mail template
used to invite people to surveys. Containing

 * fix the display of deadline that is not required;
 * correctly talk about survey, not apparaisal;

This commit is linked to task ID 1932508 (side-dish fix).

closes odoo/odoo#30537
2019-01-25 09:21:50 +00:00
Thibault Delavallée 7d110c20c5 [REF] survey: refactor template use on invite wizard
Purpose of this merge is to remove the ugly __URL__ hack of survey templates.
It is solved by making template rendered on user_input model. This means each
invitation recipient will received its own rendered mail. Small jinja code
allows therefore to include the url in a clean odoo-style way.

Subject and body in survey invite wizard are not rendered anymore. It means
jinja could be displayed. This is necessary as this wizard will work in batch
mode, rendering the body on each recipient.

This commit is linked to task ID 1911586 and PR #28986.
2019-01-14 15:22:18 +00:00