Commit Graph
171 Commits
Author SHA1 Message Date
qmo-odoo c564ae6c87 [IMP] website_slides: Add elearning feature to slides
Purpose of this commit is to introduce a new way of displaying and managing
slides in eLearning module. Its purpose is to give a better experience to
users when going through a course. Notably a fullscreen mode allows to take
lessons one by one without going out of the elearning display. Integration
of all slide types eases taking the course step by step.

Quiz are introduced in this commit. Those are an addition to slides with
some question / answers (multiple choice). It allows customer to gain karma
and improves gamification. Certifications are still done using the survey
application. Quiz targets only small tests at the end of a given slide.

A new widget is added to display and control slide display in fullscreen
mode. Old display is still available for documentation channels or when
going out of fullscreen mode, to see details on comments / review / statistics
and have access to share options.

This commit is linked to task ID 1902304 and PR #29876. It closes the main
work on refactoring website slides into eLearning, with other tasks already
merged in current community [1][2][3][4][5].

[1] Task ID 1940360 landed at b2149bc7a2: certification inclusion
[2] Task ID 1936153 landed at 6c6179e57c: homepage inclusion
[3] Task ID 1937160 landed at 8b7605c9e5: selling courses
[4] Task ID 1922159 and 1940516 landed at 5fa651cb01 and 6a64c3ce82:
    new user profile and gamification of slides / forum
[5] Task ID 1938643 landed at 77b5673a0d: upload channel/slide
2019-02-19 13:11:15 +00:00
Aurélien Warnon 3c88e75c86 [FIX] website_slides: handle publishing rights of channel/slide
Purpose
=======

Handle publishing of the slide.slide/slide.channel accordingly to the new
'can_publish' field in the website published mixin.
2019-02-19 07:08:03 +00:00
David Beguin 705376a982 [IMP] website_slides : add karma gain rules
To gamify the new elearning, karma can be gained on various actions
- rank a slide_channel (course)
- vote for a slide
- finish a course

This commit also fix the 'completed' computation on slide.channel.partner

Task ID : 1922159
PR #31109
2019-02-18 15:01:40 +00:00
Thibault Delavallée 0fe26b382c [FIX] website_slides: fix computation of completed courses 2019-02-18 14:53:10 +00:00
Thibault Delavallée 6a9f6876c1 [FIX] website_slides: fix some statistics and publication issues
This commit fixes various issues introduced by recent commits in slides

 * fix slide type computation: using a dict in a fromkeys makes a shared
   object for all keys. It is better to fix that behavior;
 * correctly display number of course steps in elearning homepage. Currently
   number of steps of a course is simply the length of its one2many;
   holding slides. However this one depends on access rights which give funny
   results like a course with 2 steps for public users and 7 for admin;
   Right computation is: number of published lessons, whatever your access
   rights are. This is already computed as total_slides;
 * people that cannot publish should not be able to unpublish;

Commit linked to task ID 1941250 and PR #31133.
2019-02-15 17:44:02 +00:00
Aurélien Warnon 171c7028dd [FIX] website_slides: fix channel statistics computation
Purpose
=======

Channel statistics computation in the _compute_slides_statistics method
did not work for a batch of channels.

(The stats dict was shared for all the channels).
2019-02-15 15:32:47 +00:00
Aurélien Warnon f322816ae8 [ADD] website_slides_survey: add a new bridge between slide and survey
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).
2019-02-15 15:32:46 +00:00
Thibault DelavalléeandAurélien Warnon c437832e55 [REF] website_slides: perform some model code cleaning
This commit squashes several fixes / light improvements related to the new
slides / elearning homepage [1][2].

Containing notably

 * clean promote strategy field on channel model: less entries as they
   are now used only to display lessons in a given order on channels of
   documentation type;
 * remove promotional fields, not used anymore since partial access on channel
   allowing to have some kind of small preview of slides has been removed;
 * use standard image field (image, image_medium and image_small) and use
   image_resize_image from tools like all other odoo applications;
 * improve image resizing to have medium images better looking on frontend
   and use that nice image_large that broke my build yesterday;
 * add last publication date change on channel;
 * clean dead code;

[1] new homepage task: ID 1936153 and PR #30770
[1] main elearning task: ID 1902304 and PR #29876

Co-Authored-By: Aurélien Warnon <awa@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
2019-02-15 09:58:25 +00:00
jem-odoo 8ad65abd00 [IMP] website_slides: allow comments on slides
With this commit, the user can activate review on channel content when
creating a channel from frontend, or editing it from backend. Once
activated, the comment tab below the slide content will allow user
to post a comment with optional rating.
The way of commenting is different regarding channel type:
- documentation: user can post comment and vote (list/dislike) on
slide content
- training: user can post comment with review (rating)

Task-1902304
2019-02-14 15:27:35 +00:00
David Beguin d8f156ae73 [IMP] website_slides : use website_profile page template and adds website_slides specific information
Adds slides ands slide.channels specific information (courses) into the website_profile template page.

As there can be more than one slide.channel,the profile page shows everything linked to every slide.channel,
except if the channel_id is given in url arguments.

Adds the 'Go to eLearning' button in the 'new rank reached' mail to encourage the users to continue
to be active on the eLearning platform as well, to gain more karma point and improve there rank.

Task ID : 1922159
PR #30988
2019-02-14 09:24:10 +00:00
Thibault Delavallée 752a3a5169 [FIX] website_slides: improve can upload / publish computation
New rules are

 * on channel type documentation: can upload like before (employee or upload
   groups specified); can publish like before (can upload and publisher)
 * on channel type training: can upload like before (employee or upload
   groups specified); can publish restricted to channel responsible

Tests are added.

This commit is a sub-part of task ID 1902304 (main eLearning task).

closes odoo/odoo#31082
2019-02-13 18:20:05 +00:00
Thibault Delavallée 370c525d77 [FIX] website_slides: fix computation of members
Members is better computed using a sudo to avoid every access rights issues.
Moreover trigger is updated so that cache is correctly invalidated and
recomputed. Having the trigger on the relational model correctly triggers
the recompute when calling main API methods to add a channel member.

This commit is a sub-part of task ID 1902304 (main eLearning task).
2019-02-13 18:20:05 +00:00
Aurélien Warnon 82ce815a8c [REF] website_slides: rework slide's public and embedded views
Purpose
=======

A slide's 'Embedded views' are reworked as 'Public views' to simplify
the model and be more compliant with the new 'is_preview' field.

The rule is now the following:

A slide is a preview or the view is done as public user (once per session)
-> increment public_views

A slide is viewed as a logged in user that has access to the content
-> increment slide_views
Technically slide_views is a compute of the slide_slide_partner count.

Tests are also added to ensure it is effectively working.

This commit is a sub-part of task ID 1940360 (eLearning integration with
survey) and task ID 1902304 (main eLearning task).
2019-02-13 18:20:05 +00:00
Thibault Delavallée 752c8925ea [FIX] website_slides: fix typos
Othrewsie you colud have some isuses.

closes odoo/odoo#31020
2019-02-12 11:24:30 +00:00
qmo-odoo 0f22f95289 [IMP] website_slides: webpage slide type
The idea is a slide can be a HTML page completely customized by
user. So, you can now easily create custom content and publish
it on your website, like a normal slide.

Task-1938643
2019-02-12 11:22:59 +00:00
qmo-odoo b8a24751c2 [IMP] website_slides: remove unique slide name constraint within channel
Having a unique constraint for a slide name in a channel look strange.
It force an RPC call to check this when uploading a slide, making the
process a little bit slow.
Morevover, name is a translatable field on slide.slide model, so the
constraint can not be fully respected.

To simplify the model, we decided to remove this.

Task-1938643
2019-02-12 11:22:59 +00:00
qmo-odoo 5aa645c89f [IMP] website_slides: add external links on slide
A slide can now have some external link. For instance, links to
the origin of the document (sources for scientifics papers, ...).
A new model is added to allow the user to provide several link
per slide. Those are display below the channel on website page.

Task-1938643
2019-02-12 11:22:59 +00:00
qmo-odoo c2a38e4602 [IMP] website_slides: create channel in frontend
This commit provides the abilty to create channel from the website
instead of creating a slide. To do so, the user still have the "upload"
button on the channel home page.
The new modal allow user to set title, description, type and channel
tags. We prevent channel tag and group tag creation on the fly, as it
can impact the UI (coming in a future commits).

Task-1938643
2019-02-12 11:22:55 +00:00
Aurélien Warnon 9352bb682f [IMP] website_slides: improve channel's "members_count" computation
Task #1937160

Purpose
=======

Performance improvement:

The members_count computed field now uses a compute_sudo with
a read_group allowing to compute all the members_count of the recordset
in a single query.

closes odoo/odoo#31013
2019-02-12 09:22:29 +00:00
Aurélien Warnon a15810e0c2 [IMP] website_slides: add a setting to install website_sale
Purpose
=======

With the new 'website_slides_sale' module users can now sell slide.channels.

This commit adds a setting to let the user know he has to install website_sale
to be able to sell courses / documentation.
2019-02-11 17:47:35 +00:00
Aurélien Warnon e5536fc07b [IMP] website_slides: add invite wizard for 'invite' slide_channel
Purpose
=======

Currently, the slide_channels having a visibility configured as 'invite' could
only add members manually.

This commit adds an 'Invite' button on top of the slide channel form that opens
a wizard allowing to send emails to contacts and also make them members of the
related slide channel.
2019-02-11 17:47:22 +00:00
Aurélien Warnon 779d9c9b90 [IMP] website_slides: add a "Attendees" stat button on slide.channel
Task #1937160

Purpose
=======

This commit adds a "Attendees" stat button on the slide.channel form view
showing the members (partner_ids) count.

On click, it redirects to a tree view of slide.channel.partner. The tree
view is configured as editable to be able to administrate members
(add/update/delete).
2019-02-11 17:47:10 +00:00
Aurélien Warnon 9b7bee73e5 [ADD] website_sale_slides: allow to sell slide.channel
Task #1937160

Purpose
=======

This commit adds sale capabilities to a slide.channel. A slide.channel can
now have the 'payment' visibility, that requires a 'product_id' configured
on the channel.

When a customer purchases a product linked to a channel, he is added to the
members of the channel (see slide.channel.partner_ids) when his order is
confirmed.

The feature is added in a new module 'website_sale_slides' that comes as a
bridge auto-installed between 'website_slides' and 'website_sale'.

The final goal is to be able to sell "courses" (see task #1902304).
2019-02-11 17:46:40 +00:00
Thibault Delavallée 7b81df3747 [REF] website_slides: remove promoted slide feature, add image and channel_type
Purpose of this commit is to clean a bit channel model. Promoted slide
feature is removed as people can already choose an order for a given
channel. Moreover promoted slide will not be used when having a eLearning
display of a channel.

Image field on channels is added as it is not depending on promoted slide
anymore.

To simplify future additions a search-specific template is removed to
have a unique template to display a channel content. It will ease future
merge.

This commit is linked to task ID 1936153 and PR #30985.
2019-02-11 09:55:15 +00:00
Thibault Delavallée 7ee22f1219 [IMP] website_slides: improve and add statistics computation
Purpose of this commit is to add some statistics computation on slide.channel
model. We want notably to have a count of views and votes (likes and dislikes)
on channels. Completion is also computed.

Purpose is to be able to search and order channels based on those statistics.
Having stored computed fields for some statistics help achieving that purpose.

Tests are added.

This commit is linked to task ID 1936153 and PR #30985.
2019-02-11 09:55:12 +00:00
Thibault Delavallée cbc2de0eb6 [IMP] website_slides: add tags and tag groups on channel
Purpose is to be able to filter, search and categorize channels. Notably
with eLearning in mind there will be more channels as a channel will also be
used to hold lessons.

For that purpose we add a model of tag linked to channels. Those tags are
organized by groups in order to be able to display them using a menu or
a small hierarchy of tags. Displaying a tag group as a specific navigation
element is controlled by a specific field.

Those models will be used to display a new and improved home page for
channels / courses.

This commit is linked to task ID 1936153 and PR #30985.
2019-02-11 09:55:05 +00:00
Thibault DelavalléeandAurélien Warnon a20408e995 [FIX] website_slides: reflect ACLs on fields for channel members
Just reflect access rights: publishers should be able to manage channel
members.

Co-Authored-By: Aurélien Warnon <awa@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>

closes odoo/odoo#30960
2019-02-08 16:26:44 +00:00
Thibault DelavalléeandAurélien Warnon 8d310d1a88 [FIX] website_slides: improve methods to add members on channel
To avoid security issues or exploits, public method to add a member on a
channel allows to add only itself, under given restrictions, like being
a channel maintainer to add self on a private channel.

A private method allow to subscribe other people. It will be used notably
to allow publishers to invite other people.

Co-Authored-By: Aurélien Warnon <awa@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
2019-02-08 16:26:39 +00:00
Thibault Delavallée 6b46422a6b [REF] website_slides: update slide members relationship
This commit changes decorated many2many between slides and participants
recently introduced [1]. It was done between slide and users as people have to
login to have slide information.

Another many2many between channel and partners to store notably completion
and soon add statistics has been added [2]. It has been done between
channels and partners.

In this commit we choose to have the same relationship for slides, aka a link
between slides and partners. It allows to easily compute statistics and find
information based on partner_id.

Co-Authored-By: Quentin Mourrier <qmo@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>

[1] See c273e89d55
[2] See 748b9072d6
2019-02-08 16:26:28 +00:00
David Beguin 723789b6b1 [FIX] website_slides: Fix clean ACLs and refactor access options commit
Fixes related to commit 748b9072d6

 * fix template still having an unnecessary t-else whereas the t-if has
   been removed;
 * move order by strategy on right class;
 * fix access rights on intermediate model between channels and partners. It
   should be accessible to website publisher as they will have so manage
   channel members;
 * fix some typos;

closes odoo/odoo#30949
2019-02-08 12:01:12 +00:00
Aurélien Warnon c4c067509e [REM] website_slides: remove the 'state' field of slide.channel.partner
Purpose
=======

The 'state' field for a member of a channel did not imply anything functionally
so we decided to remove it. It allows to remove an unnecessary computed fields.
ACLs are updated accordingly.

If needed, we will soon be able to check partner_ids that have ordered but
not paid a channel / course product by searching the related 'sale.order' model
for such products.
2019-02-08 11:33:09 +00:00
Thibault Delavallée 29219b9c93 [IMP] website_slides: remove duplicated code
Code probably coming form a rebase conflict. Duplicated and therefore removed.

closes odoo/odoo#30921
2019-02-07 13:58:57 +00:00
Thibault Delavallée 797daba163 [IMP] website_slides: add widget to join a channel
Purpose is to add a new widget and its route allowing to join a channel.
As visibility is now mainly based on membership a widget to join channels
is required.

This commit is linked to task ID 1937411 and PR #30847.
2019-02-07 13:44:39 +00:00
Thibault Delavallée ddccd33bae [IMP] website_slides: improve upload slide screen
Slide upload access is a bit cleaned. A can_publish field is added controlling
who can publish slides. Currently website publishers are allowed to publish
content. Not publishers people allowed to upload cannot publish their own
content. It stays in a submitted non published state.

This commit is linked to task ID 1937411 and PR #30847.
2019-02-07 13:44:39 +00:00
Thibault Delavallée 748b9072d6 [IMP] website_slides: clean ACLs and refactor access options
Purpose of this commit is to clean access rights on slide models and give
less access to public / portal / internal users. Website publishers and
editors have rights to edit slides content and manage channels.

Another purpose is to clean and refactor access options on channels and slides.
Access to a given slide depends on the current user being a member of the
slide channel. A channel can be either public (joined easily) or on invitation
only (manual addition of members).

Slide can be flagged as preview, meaning they are accessible without any
concern about channel membership. It is used as teasing or free promotion
of a channel.

Publish flag is orthogonal. Non published slides are not visible to everyone
except website content editor. It allows to work and improve slides without
displaying them to members or public people.

Technically a new model is added to model membership on channels. It is
a decorated m2m between channels and partners; on this m2m the state of
membership is added. In a near future additional information will be stored
on this model, like completion of channel or certification information.

Other technical changes implied by this commit
 * visibility is simplified to either public or invite;
 * can_see and can_see_full are removed, as well as concept of 'partial'
   display of slides;
 * group_ids related to private access is removed;
 * a computed / searchable field is added to be able to efficiently find
   and search active members of a channel;

This commit is linked to task ID 1937411 and PR #30847.
2019-02-07 13:44:39 +00:00
Thibault DelavalléeandDavid Beguin 43740f94ea [IMP] website_slides: add dependency on website profile
Purpose is to prepare the use of gamification tools in slides. In this commit
we add the dependency on website_profile (gamification front-end) in slides
and add the slides category on challenges.

Partial commit linked to eLearning project. Main specifications related
to gamification and user profile can be found on task 1922159 (PR #30514).
Main specifications related to eLearning can be found on task 1902304
(PR #29876).

Co-Authored-By: David Beguin <dbe@odoo.com>
Co-Authored-By: Thibault Delavallee <tde@odoo.com>
2019-02-07 12:13:28 +00:00
jem-odoo e97b40bae6 [IMP] website_slides: allow to rate slide channel
This commit allows user to rate a slide channel: using the new Popup
Rating Composer, users having access to the slide channel can submit
a rating with a comment. Then, lower in the page, they can see the
ratings of other users.

Task-1902304
2019-02-06 09:55:13 +00:00
Thibault Delavallée 8f3eff13fb [REF] website_slides: light cleaning
Purpose of this commit is to prepare future code addition by making some
noise in a separate commit. In this commit we move compute methods below
fields definition because currently it is a complete mess and finding a
given field gives a headache.

Commit linked to task ID 1933820 and PR #30830.
2019-02-05 11:19:52 +00:00
Thibault Delavallée 7105669b77 [FIX] website_slides: limit auto subscription
In order to avoid spam and unwanted notification this commit limits auto
subscription on channel when

 * creating a channel;
 * automatically telling a channel a new publication has been done;
 * creating a slide;

As being a follower of a slide channel means following its slides user should
choose manually to be follower of a channel, notably through the UI.

A new way of managing subscription will come with elearning in mind and
therefore auto subscription should be limited.

Commit linked to task ID 1933820 and PR #30830.
2019-02-05 11:19:52 +00:00
Thibault Delavallée c273e89d55 [REF] website_slides: introduce slide / user relationship and use it for vote
Purpose of this commit is to store a relationship between slides and users.
Indeed starting from now we will track more user interaction with the slides
module.

In this commit we introduce a model that is used to populate and decorate
the relationship between slides and users, slide.users. From slides or users
point of view it behaves like a many2many. It can also be used to store
more information about the user interaction with the slide.

We use it here to store the user vote. Like and dislike are not static
counters anymore but computed fields based on user votes. It is implemented
as a tristate field.

As it is a technical model no access on slide.users is granted. Controllers
and methods grant access to the relationship in order to avoid information
lead and keep technical details private.

Future commits improving the eLearning use of slides will notably store
information about user having read the slide, taken a quizz or gaining
karma depending on some actions performed on the slide.

This commit is linked to task ID 1934488 and PR #30620 .
2019-01-29 09:24:48 +00:00
Thibault Delavallée 088041f79d [FIX][IMP] channel: improve can_upload / can_see computation on channel
Purpose of this commit is to clean a bit interface of slides

 * separate can_see from can_upload;
 * correctly set can_see on partial visibility channels;
 * remove upload button for portal users as they have no rights to upload a
   document and this is not supported in any way;

This commit is linked to task ID 1933820 and PR #30553.
2019-01-28 15:37:14 +00:00
qmo-odoo 6f5748d288 [MOV] slides: Rename and split files according to their underlying models
Purpose of this merge is to polish a bit this module before turning
it into "courses" (see task #1902304 for more details on this)

Contains
 * split python model into separate main files to ease models understanding;
 * split views into separate main files to ease views finding;
 * rename files according to guidelines;
 * merge templates in the same file to have all available at hand;
 * move assets in their own file in order to remove noise from templates;
 * Split javascript widgets into their own separate files

No functional behavior change should occur with this commit. Only move
has been performed.

Note that we might lose part of the history as splitting files creates a new
history for new files.

Task: #1909281
Closes: #28679
2018-11-19 08:28:34 +00:00
Yannick Tivisse 532d82a7a9 [IMP] mail: Make mail.compose.message code more readable
Purpose
=======

Remove the method 'render_template' in mail.compose.message as the indirection
is not useful. Call the method on the correct model (mail.template) directly.
2018-10-02 12:35:34 +02:00
Adrian Torres 3f4f77fd9d [REF] *: adapt code to new related default behaviour
This commit adapts the business code to changes introduced by
the parent commit in order to keep the same behaviour as before.

All readonly=False fields will have to be checked afterwards to confirm
that the business case requires write access to the source field.
2018-09-27 12:10:23 +02:00
Sébastien Theys e4aa8ec6d1 [IMP] website,website_livechat,website_slides: add "new content" buttons
Those allow the user to quickly create a new channel or new slides.

PR: #27110
task-1885419
2018-09-25 16:23:08 +02:00
Romain Derie bcd405efa3 [FIX] website_slides: fix website_meta_og_img right on partial channel
156955de6b introduced a new property `website_meta_og_img` in
`website.seo.metadata`.

When rendering a template, `render()` is calling `get_website_meta` that will
end up reading `website.seo.metadata` fields.

But `website_slides` module is overriding `check_field_access_rights` to allow
partial read on the record.
The new `website_meta_og_img` was missing from the allowed fields, thus
crashing when an user without the required slide's group would try to read the
slide.
2018-09-25 15:15:57 +02:00
Nimesh Jethva 53e8aba1ab [IMP]website_*: Improvement in model description
Purpose of this commit is to give description more "business oriented"
because those descriptions appears in Odoo Studio which is supposed to be used by end users, not only by developers.

Related Task ID : 37311
2018-09-21 11:45:15 +02:00
Raphael Collet 5701d93624 [FIX] *: decorator returns on message_post 2018-08-23 17:01:22 +02:00
Kishan Gajjar 25166653c6 [IMP] website_slides: Remove meta from website_slides template.
add default meta tags into product page by override '_default_website_meta' in slide.slide
2018-08-22 14:01:32 +02:00
Jeremy KerstenandDerie Romain 066cfc9598 [IMP] website_[blog|event|forum|sale|slide]: make website specific
Set up env & tools for module website multiwebsite (blog, event, sale..)
website_id in modelConverter and ir_rule

add _compute_domain_keys to have a different cache per website
  or rules would not be correctly website_dependant
  eg: blog 1 on website 1, blog 2 on website 2
      access blog 1 from website 1 => can access -> normal
      access blog 1 from website 2 => can access -> should crash because (ir rule)

split mixing website.published.mixin and website.published.multi.mixin to have
website_id only on last one.
 multi mixing will:
     - override website_published compute to take current_website into account (not in backend)
     - force website when clicking on published in backend

- website blog, website_sale, website_event, website_forum, website_slides are now multi website

Co-authored-by: Derie Romain <rde@odoo.com>
Co-authored-by: Kersten Jérémy <jke@odoo.com>
2018-08-13 20:16:34 +02:00