PURPOSE
This commit adds some small UI improvements to the e-learning views.
All those small changes are meant to improve the general user experience when
adding content to a course.
DETAILED SPECS
- Change some placeholders / labels
- Inform the end-user that he can edit his 'webpage' slide using the editor
- Inform the end-user that he can add questions to his 'quiz' slide using the
'Quiz' tab in the backend form view
- Do not update from slide metadata if field value is already set
- Do not allow previews for certifications
- "Allow Download" of slide content is now False by default
As it was nice to have for "Documentation" courses but does not really make
sense for "Training" ones.
- Having a duplicate video id is now informative on the frontend and not
blocking as before (it was allowed in the backend form anyway).
- Show the video title in the frontend preview
Task-2510174
Part-of: odoo/odoo#71477
PURPOSE
Globally refactor the way we handle external content (YouTube videos,
Google Drive documents, ...) in the course slides.
This includes both technical changes (new computed fields, rename, ...) as well
as visual changes on the form views that allow introducing new content, both in
the backend (slide.slide form view) and in the frontend (course main website
page).
SPECS
TECHNICAL REFACTOR
1. Rework the "url" field
This field was used without any distinction for videos, regular documents and
images, leading to a big confusion both technically and visually.
The urls are now split in separate fields (video_url, document_google_url and
image_google_url), based on the type of slide.
Those fields are implemented as 'related' to the stored 'url' field to avoid
extra storage.
This change globally increases the readability and usability in the code, and
also allows for clear labels on the various views.
1b. Rework the "binary_content" field
The same way as for the 'url' field, the 'binary_content' field has been split
into 2 related fields ('document_binary_content' and 'image_binary_content').
This allows for more readability and also helps in the form view to limit the
file selection to the supported file types.
2. Remove the "document_id" stored field
This field did not have to be stored since it can "easily" be inferred from the
video/document URL with some regex work.
3. Remove the "mime_type" field
This field's value was only determined by an external call to the Google Drive
API. It was inconsistent because not set for manually uploaded document and was
used for some strange checks that seemed to work but did not make much sense.
(e.g: used to make the difference between a Google Drive video and a YouTube
video??).
It has been replaced by a "document_type" field, which is always 'pdf' for
local files (only type we support) and inferred from the mimeType returned by
Google Drive metadata for external documents.
This allows, for instance, to show pretty icons next to every slide based on
their type, "sheet" files (Excel, Google Sheet, ...) share the same icons, the
same principle is applied to "doc" files (Word, OpenOffice, Google Doc, ...)
and finally "slides" files (PowerPoint, Google Slides, ...).
4. Introduce several computed fields
Such as:
- video_source_type
- youtube_id
- google_drive_id
These fields are mostly inferred from the slide type and the related URL.
They are used to make clear checks in the code and ease readability, for
example when constructing the slide "embed code" to insert it in the frontend
full screen viewer.
5. Remove the "presentation" slide_type
The slide type "presentation" was some kind of very confusing type between
image and pdf. It was mostly relying on the fact that the content had a bigger
width than height ('landscape' display).
This lead to a lot of confusion both in the code base and in the various forms
allowing to introduce new content ("what should I choose? document or
presentation?").
In order to simplify everything, we completely removed the slide type
"presentation" and converted all the data that had this type and the various
code checks to the type "document" instead.
Meaning that we end up with the following slide types:
- Infographic - for images, local files + external links
- Web Page - local input only
- Document local files + external links
- Video - external only, YouTube or Google Drive links
- Quiz
FUNCTIONAL
Following the technical changes here above, we can improve the form view of the
slide.slide model as well as the website form that allows adding new content.
1. Slide form view
To make it clear where the source of the document comes from, we introduced a
"source_type" field that is either "local_file", used when uploading a file
from your computer, or "external", used when linking content from Google Drive.
The source_type selection appears when adding content of type "document" or
"infographic" and conditions the display of the file upload button or the
document_url field.
2. Adding content from the website
When adding content from the website, the user is now invited to select from
ALL the available slide type, meaning we added "Infographic" to the selection.
Before this change, if you wanted to link an image, you had to select the type
"presentation" (that has a PDF file as icon...) and then input an image file.
The JS then processed the file type to determine the slide type.
As this was slightly confusing for the end user, we decided to use the same
approach as the form view, meaning you FIRST select the type of slide you want
and THEN input the content as a local file or external link.
Since we now handle all types of documents when using an external Google Drive
link, the various screen and text helpers have been reworked accordingly.
3. Handle more types of slides with the new "slide_type" field
This commit also introduces a new "slide_type" field.
(Don't get confused, the previous "slide_type" field has been renamed to
"slide_category" in an earlier rename commit).
This slide_type is a refined slide_category:
- Videos are split into 'youtube_video' and 'google_drive_video'
- Documents are refined based on the file mime_type if it's external content
For example, if you link a Excel file, the slide_type will be 'sheet'.
If you link a Google Doc, the slide_type will be 'doc'
etc...
(Local documents are only PDFs since it's the only type we support for now)
This small change allows to include minor nice details into views, such as a
refined icon for each slide_type on the website.
LINKS
Task-2510174
UPG PR odoo/upgrade#2498
Part-of: odoo/odoo#71477
This commit simply applies the following renames in the slide.slide model:
- 'datas' is renamed into 'binary_content'
- 'slide_type' is renamed into 'slide_category'
This changes intend to ease the next bug refactoring of the website_slide
module content management.
There should be no functional changes applied in this commit.
Task-2510174
Part-of: odoo/odoo#71477
PURPOSE
When dealing with lot of surveys kanban view is not really optimal and its
state based grouping is not really helpful. Indeed we do not have total of
each coumn and there is not point adding new states, meaning most surveys
hang in the same column. This is not an optimal display.
SPECIFICATIONS
Improve ungrouped display as this is the main usage of surveys. It should
be displayed like a global list view: each card should take the whole
screen (like ``Visitor`` kanban view). Each line contains some "columns"
holding statistics. We notably use a progressbar to display a nice passed
ratio, as well as a many2one avatar widget to make survey enters the era
of amazing wow kanban views.
When grouped, display should be the old one, aka a standard card.
This is done using a small CSS hack: card template actually consists in main
templates related to two displays. Each card style is hidden depending on being
groups or ungrouped. This triggers a class that is used using CSS to hide
irrelevant content.
A ribbon is also added on kanban cards displaying an Archived danger ribbon
when survey is not active anymore. It is therefore coherent with the form
view display that also has a ribbon defined.
An override in website_slides_survey is added to add number of courses using
the survey.
Order is updated so that new surveys are on top. No need to be bloated by
old ongoing surveys when creating new one.
Finally, some labelling is done with answers to be clearer: registered (number
of raw user inputs), completed (finished answers), certified or passed (quiz
with certification activated or not).
Task-2388785
Part-of: odoo/odoo#77227
RATIONALE
Currently we can specify email used for notification layouting through context
use in mail composer. It is then propagated to message_post, stored on
mail.message and used to encapsulate emails sent based on posted messages.
SPECIFICATIONS
On template model: rename ``notif_layout`` parameter of ``send_mail`` to
``email_layout_xmlid`` to be coherent with naming used in other parts of the
code. Moreover it better indicates we expect an xml id.
On rating model: rename ``notif_layout`` parameter of ``rating_send_request``
to ``email_layout_xmlid``, for the same reasons as above.
In various wizards: support ``email_layout_xmlid`` context key when no field
is available, notably because this is still done manually in some wizards
like survey invite. Keep a fallback on ``notif_layout`` but remove support of
``custom_layout`` deprecated since quite a long time.
Task-2621326 (Mail: add 'view' button in 'light notification template')
Task-2647302 (Mail: add layout field in composer)
Part-of: odoo/odoo#76418
Purpose
=======
This commit is enhancing the website_slides module.
Specifications
==============
It changes placeholders for certain fields, it changes helpers in some
of the views.
It updates some of the main views of the menus and corrects wordings
inside of them.
It activates the Graph and Pivot views for the reporting of
Courses, Reviews and Quizzes.
It cleans up some of the measures inside of the Pivot and Graph views
of each menus where it is available.
It also merges 2 models: slide.slide.link and slide.slide.resource into
slide.slide.resource with a type Selection field.
This is done in order to create a single table for the additional
resources of a Content.
It also improves the front-end of the module with minor changes.
It fixes the problem of long names inside of breadcrumbs.
It also adds a message when there is no leaderboard in /profile/users.
task-2597345
See odoo/enterprise#20480
See odoo/upgrade#2784
Part-of: odoo/odoo#75646
Use _for_xml_id to replace all the self.env.ref().read()[0]
This has the advantage of having a single point of control and to add
the fields filtering and model verification.
Add sudo for other operations on ir.actions.*
With this commit, Selection fields with `required=True` which are
extended via `selection_add` are given proper ondelete policies to
ensure the cleanup of records containing these extended options during
uninstall of the extending module.
This commit also cleans up leftover uninstall hooks that were being used
to handle the same set of problems prior to the ondelete mechanism being
implemented for Selection fields.
closesodoo/odoo#46325
Related: odoo/enterprise#9117
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Previously there was no way to view when a survey (specifically a
certification survey) was being used by a course from the survey
app. We handle 2 cases for when a survey is currently assigned to
a course:
1. A survey is assigned to 1 course => survey form stat button visible to bring user
directly to corresponding course form.
2. A survey is assigned to more than 1 course (unlikely, but currently possible) =>
survey form stat button visible to show user a list of corresponding courses where
each list entry can be clicked on to view corresponding course form.
Note: we do not cover viewing courses a survey was previously assigned to as this would
be currently be unreasonable to track.
closesodoo/odoo#42336
Task: 2153743
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
PURPOSE
Have user groups specific to eLearning to separate them from generic website
editors. Indeed this is a specific work area and require more than pure design
skills.
SPECIFICATIONS
Two user groups are added in this commit
* group_website_slides_officer
+ can read any course/slide
+ can create a course (will be responsible)
+ can write on its courses
+ can upload slides to the courses he is responsible
+ can publish slides to the courses he is responsible
- cannot unlink courses/slides (you should archive them)
* implies group_website_publisher in order to see the top navbar in
frontend with the publish toggle button and the new content button;
* group_website_slides_manager: has full rights
+ can read any course/slide;
+ can create a course;
+ can add slide to any courses;
+ can publish any courses/slides;
+ can unlink any courses/slides;
+ has access to reporting menu entries;
Rights for other groups are untouched for courses / slides. As a reminder
we still support responsibles being outside of eLearning groups, for example
if an employee is a teacher that handles a course:
* people in upload_group_ids of a channel can upload slides, even if they
don't belong to any eLearning group;
* people responsible of a course can upload and publish slides even if they
don't belong to any eLearning group (done through controller as they
don't have real rights on underlying models);
We choose to keep the survey rights separated from eLearning ones. Indeed
it is easy in odoo to update the imply_ids field of groups if necessary
to link survey / eLearning groups; default user template can also be updated
easily. Standard Odoo should therefore correctly separate those groups. The
only specific rights is that eLearning officers can read all surveys, allowing
to choose them for certification-based courses.
LINKS
Task ID 2062462
PR #39485
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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 QUIZ_SCORE ON SURVEY.USER_INPUT
On survey.user_input, quiz_score field to scoring_percentage
``quiz_score`` field name is related to the old "quiz" behavior of surveys
that is replaced by certifications and scoring mechanisms. Let us propagate
the renaming, beginning with a ``scoring_`` prefix.
SPECIFICATIONS: RENAME QUIZZ_PASSED ON SURVEY.USER_INPUT
on survey.user_input, rename quizz_passed field to scoring_success
``quizz_passed`` field name is related to the old "quiz" behavior of surveys
that is replaced by certifications and scoring mechanisms. Let us propagate
the renaming, beginning with a ``scoring_`` prefix.
SPECIFICATIONS: RENAME TOKEN ON SURVEY.USER_INPUT
on survey.user_input, rename token field to access_token
Survey user input model holds two token field. One is used to distinguish
a pool of attempts linked to a given invite: ``invite_token``. The other
one is used to control access to a specific user input. It means that
``invite_token`` indicates a set of user inputs and each of them is accessed
through its own ``token``. To be coherent with other naming in odoo this
latter field is renamed to ``access_token``.
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
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
Purpose of this commit is to ensure challenge linked to surveys linked to
slides have ``slides`` category, while challenge linked to surveys not
linked to slides (if changing survey_id for example) have ``certification``
category.
With this patch challenges are correctly categorized, allowing to accurately
filter them based on their category.
Task ID : 1961053
PR #32594
Since admin is responsible of all created demo channels and then re-added
manually as member in demo data of slide.channel.partner he is actually
twice member of some channels. This commit fixes that by resetting its
membership status before adding membership demo data.
PR #36756
PURPOSE
Test frontend and UI tools of eLearning.
SPECIFICATIONS
Since 9920f20e4c course completion when finishing a certification survey
is broken. Indeed channel completion is not correctly recomputed. A
certification course can therefore never be completed and awarded. This
commit fixes that and correctly update channel completion based on survey.
In this commit we also rename some methods
* _compute_completion: renamed to _recompute_completion to avoid naming issue
with computed field convention;
* _post_completion_hook is not unnecessary as code in hr_skill can be done
after calling super of _recompute_completion;
* _completed_callback is renamed to _set_completed_callback to be coherent
with slides naming;
LINKS
Task ID 1937768
PURPOSE
Like already done for sale order, invoice of survey, purpose of this commit
is to remove category model and replace by a flagged line (slide). It allows
to easily reorder slides in an embedded list view.
SPECIFICATIONS
This commit completely reworks the slide.channel form view
* improve the content management from the form itself by adding a tree view
with the possibility of drag and dropping slides from category to category.
This tree view has buttons to quickly add content or certification. It
also allow to add a category (slide with flag is_category) without opening
a modal;
* reorder tabs and fields, improve some labels;
* add a custom float field widget to display ratings as stars;
* add stat button for partners who completed/certified ;the course
* add stat button that redirects to the forum posts;
* add stat button that redirects to the channel reviews;
LINKS
Task 1978731
PR #33255
PURPOSE
Like already done for sale order, invoice of survey, purpose of this commit
is to remove category model and replace by a flagged line (slide). It allows
to easily reorder slides in an embedded list view.
SPECIFICATIONS
Instead of having a fully fledged slide.category model, slide.slide will serve
that purpose with a is_category flag. This will allow to drag and drop slides
and sections in the channel form view.
This change had an impact on the way slides were added/sorted on the front-end.
In fact, whenever a slide is added from the front-end, a resequencing of all
the slides in the course has to be triggered.
Category of a slide is now a computed field based on the sequence. Order
of slides is based on sequence, with categories splitting the slide list based
on is_category flag.
In this commit tests are added. Some cleaning in tests is also performed to
speedup a bit tests (savepointcase) and some cleaning / renaming to ease
their understanding.
Future commit will add JS necessary to manage slides in the section list view.
LINKS
TaskID: 1978731
PR: #33255
Multi is the default api for methods, it is not necessary to explicitly
decorate methods with it, adds clutter and most people use it because
they see that the rest of the code uses it.
Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
This commit fixes a few issues with courses which have certification
* fix links to already passed certifications: currently it crashed, now it
redirects to the certification end screen;
* "Begin your certification now" green box link now has same behaviour
as links in the list view. It redirects to either the start certification
screen or the first slide in fullscreen mode. Moreover once the user has
started the course (at least one completed slide) this box disappears as
it is not really useful anymore;
Some dead code is removed.
Commit linked to task ID 1978530 (fixes linked to internal testing).
Task #1945036
Purpose
=======
If the user fails his last attempt at a course certification, we remove him from
the members of the course (and he has to enroll again).
He receives an email in the process notifying him of his failure and suggesting
he enrolls to the course again.
The purpose is to have a 'certification flow' where the user can re-purchase the
certification when they have failed it.
This could lead to some issues if the course containing the certification also has
other slides with content because the user will not have access to them after failing.
This also prevents configuring courses with multiple certifications since the membership
will be removed at the first failure.
These use cases are considered "non standard" by the business and are thus not handled
in the code. We assume that users will configure their courses "correctly".
Before this commit, in fullscreen mode, clicking on the "pass certification"
button would redirect the user to the "non-fullscreen" view.
After this commit, the button directly redirects the user to the survey page.
To avoid generating user_input of survey (test entry or not) for
certification slides in fullscreen mode (table of content), we decided
to create those user_input lazily: we redirect the user to a route that
create (or reuse) the correct user_input.
Task-1946511
This commit sets the completed flag to True for a slide of type certification
when this certification is succeeded (quizz_passed set to True).
Also, the Download certification button has been added to the fullscreen mode
if the certification is passed by the user.
Task ID : 1941250
PR #31697
This commit makes the quiz widget a real odoo widget that triggers up some
events. The widget is now only responsible of
* fetching quiz data (if not given)
* decorating the anwsers according to the result
* displaying message (error or modal)
To do so, some code move/rewrite was needed
* extract and factorize some template
* add 'sudo' on technical model to avoid access rights error
* factorize some python method from controller to model
* remove some CSS classes to lighten the code
* fixing access model error
* make quiz widget handle the display of error message
* give browse record for template rendering, rather than slug
* cleaning some spaghetti code in Fullscreen widget
* ...
Commit linked to task ID 1941250 and PR #31584.
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Purpose is to reduce model naming complexity. Currently you have: slide_type
<type>, and related statistics on channel and category nbr_<type>s with a
trailing and error-prone s. Let us remove the trailing s to reduce complexity
of code reading. Some code cleaning in statistics computation is also done.
Commit linked to task ID 1941250 and PR #31272.
Task #1940360
Subtask of #1902304
Purpose
=======
Adds certification capabilities to the website_slides module.
Channel/courses can now include certifications as a new type of slide.
This new type of slide is available as a "Certification" button on the slide creation
frontend view (next to "Video", "Presentation", ...).
Users have to link the slide to an actual survey that has the 'certificate' field
set to true (that will populate the slide's survey_id field).
Slides of type certification are handled in frontend in a very simple way for now:
- A button "Begin certification" that redirects the user to the related survey frontend.
- A button "Download certification" when the user has succeeded the certification.
- When the survey is done, if it's linked to a slide, a button "Go back to course" allows
the user to go back to the slide frontend.
(There is a special use case for when the website_publisher designing the survey lands on a
certification slide: he is allowed to test the survey with a survey_input created as test_entry)
Survey creation as well as limited time, limited number of attempts, ... are still completely
handled in the survey module. That means that the user will have to first create a suitable survey
that is a certification and only then create a slide of type "certification" and link
the created survey to it.
Ideally, the taking of the survey should be transparently included in the slide frontend but
it requires a full refactoring of the way surveys are submitted. This will most likely come in
a later commit.
This commit is an advanced merge of full eLearning module (see task #1902304).