Commit Graph
214 Commits
Author SHA1 Message Date
Aurélien Warnon 22d1743e26 [REF] website_slides: rename 'webpage' to 'article'
This commit simply renames the 'webpage' slide_category into 'article'.

Indeed, 'webpage' was confusing because it was leading you to believe that you
would have to link external content from another website.

While this slide_category instead lets you build an 'article' with content by
using our website builder.

The changes here are just renaming the slide_category and the labels, there
should not be any functional change.

Task-2510174

Part-of: odoo/odoo#71477
2021-11-30 15:21:49 +00:00
Aurélien Warnon ffa504887d [IMP] website_slides: slightly improve various e-learning views
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
2021-11-30 15:21:48 +00:00
Aurélien Warnon 0ece0b3263 [IMP] website_slides: add Vimeo integration
This commit adds support for the Vimeo provider in the e-learning platform.

This includes managing Vimeo video links and showing the Vimeo embedded player
in the fullscreen and non-fullscreen viewers.

But also managing video events to:
- automatically set the slide as completed when the video reaches the last 30
  seconds
- go to the next slide when the video ends (if there is one)

Task-2510174

Part-of: odoo/odoo#71477
2021-11-30 15:21:48 +00:00
Aurélien Warnon 7b5427f6d6 [REF] website_slides: refactor external content management in slide.slide
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
2021-11-30 15:21:48 +00:00
Aurélien Warnon ab0b36e8a5 [REF] website_slides: rename slide.slide fields
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
2021-11-30 15:21:47 +00:00
Aurélien Warnon 4a329da6a0 [IMP] website_slides: improve quiz error management
This commit slightly improves the quiz error management when building a quiz
directly on the website or when answering to the quiz.

When there is a validation or submission error, instead of displaying a toaster
very far from the user focus, we add the error next to the button he just
clicked.

For the question validation, this requires a small trick in the controller,
where we catch the ValidationError to return the message to the JavaScript.

Task-2678061

closes odoo/odoo#79081

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-24 13:16:45 +00:00
Aurélien Warnon 043b3385d2 [IMP] website_slides: improve slide.embed feature
Currently, the slide.embed statistics only work if a 'Referer' header is passed
in the request object.

The issue with that strategy is that it's not very reliable, indeed some modern
browsers now completely avoid passing the referer header (mostly for security
and privacy reasons).

This commit refactors the slide.embed feature to work even without a referer
header.
When the header is missing, the incremented count will be stored under a
common slide.embed record with a url field = False.

This count is still useful because the end-user will want to know if the slide
is popular externally, even if we don't know on which website it has been
embedded exactly.

In addition, we add more visibility to the slide.embed feature by introducing
a stat-button on the slide.slide form view, that redirects to the list of
slide.embeds for this slide.

Finally, we also renamed the 'embedcount_ids' field to 'embed_ids' to get a
better / clearer naming.

A few tests about embed detection were added to ensure this behavior.
(Tests are based on the work of Nathan Marotte <nama@odoo.com>).

Task-2654009

Part-of: odoo/odoo#77736
2021-11-24 10:18:17 +00:00
Aurélien Warnon 1ab9455a9a [IMP] website_slides: refactor slide.slide embed detection
This commit slightly changes the embed detection for slides.

Currently, we use the same URL to embed slide content within the e-learning
module and when the end-user wants to embed that content on an external
website.

However, we want to know whether the slide is embedded externally or not to
show different controls and update some statistics.
The code previously relied on the presence of the "referer" header to achieve
that detection, if the referer URL comes from a domain that is not this Odoo
website -> then it's embedded externally.

The issue with that strategy is that it's not very reliable, indeed some modern
browsers now completely avoid passing the referer header (mostly for security
and privacy reasons).

Instead, we change this to let users embed on external websites with a
*different* URL.

When the embed comes from '/embed_external/', we now easily know that it comes
from an external embed and don't have to do some further and potentially tricky
processing.

We introduced a computed 'embed_code_external' field that is computed the same
way as the embed_code except for that small route distinction.

This also easily solves any issue that could come with multi-website /
different root URLs etc.

Task-2654009

Part-of: odoo/odoo#77736
2021-11-24 10:18:17 +00:00
std-odoo 300b4cc624 [FIX] website_slides: fix a traceback when creating a new tag
Bug
===

Open a website page and click on "New" to create a new course from the
frontend. Then create a new tag from this view, a traceback is raised.

Since odoo/odoo@51ff8b09db the code has been refactored to use the new
JS import, but the way we import doesn't work with the "default export" used
in "slides_course_tag_add".

Task-2636073

closes odoo/odoo#76367

X-original-commit: 5838a2622d7798ce832939a05c0482f8dac01b3c
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-09-11 15:25:54 +00:00
Benoit Socias 7559626c54 [IMP] website, *: make a generic search bar snippet available
(*: website_blog, website_event, website_forum, website_sale,
website_slides)

Before this commit the search bar was specific to products.

After this commit a generic search bar is available as a general feature
of website which can be configured to inspect specific models.
The snippet is used to replace the old search bar in blog, courses,
event, forum, page and shop.
The search results of these pages and the autocomplete of the search bar
run through the same search mechanism.
A new hybrid results page has also been created as a target of a search
on "Everything".

In each involved module, `website._search_get_details()` is implemented
to return search metadata for every model related to the `search_type`
parameter.
Search metadata for a single model is returned by `_search_get_detail()`
on that specific model.

The autocomplete runs through the additional
`website._search_render_results()` pre-rendering step that prepares the
data to fit in the autocomplete template.

task-2379555
https://github.com/odoo/odoo/pull/65871

Part-of: odoo/odoo#65871
2021-09-03 06:59:33 +00:00
std-odoo 97f0f648f1 [IMP] website_slides: open rating composer in fullscreen mode
Purpose
=======
Currently we can write a review in the slide fullscreen view.
But if we click on the button "review", we are redirected to the reviews
page. Instead, we want to open the rating composer and to stay in the
page.

Task-2322583
2021-07-16 11:18:11 +00:00
Jeremy Kersten 478068c829 [IMP] *: always use Odoo Response
This branch adds request.redirect on all requests.
In case of a front end request, we do an url_for to the location.

We removed redirect_with_hash that was only for retro compatibility

local_redirect has been renamed to redirect_query, and param keep_hash has been
removed and moved.

Default code for redirect is 303 now instead of 302.

Now redirect and redirect_query make local redirect by default, you need to
pass local=False to make external redirect.

All werkeug.utils.redirect has been replaced by request.redirect.

Http.redirect now use an http.Response type, and it become easy to add an
override like 'set_cookies' e.g.

Dispatch of a website.page return an http.response too, so we first need to
check if it is a cached version before to check if it is an Odoo Response.

Migrate your code:

http.redirect -> request.redirect(location, code, local)
http.local_redirect -> request.redirect_query(location, query, code, local)
http.redirect_with_hash -> request.redirect

Courtesy of odony for help and review ;)

closes odoo/odoo#72599

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-07-08 07:00:06 +00:00
fw-bot de5be74db5 [FIX] website_slides: allow to use only in POST
This method only expects to be called as POST and should not be called
with GET.
This commit enforces that.

[CLA] Signature for sushiwushi

closes odoo/odoo#71575

X-original-commit: 00f2eeee7aa514599b40e049be46eacdcc8332fa
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-06-01 17:22:18 +00:00
Romain Derie 92175d3341 [IMP] *: replace web.base.url ICP by helper method
Previous commit introduce an helper to get the most suited URL for a record
instead of always using the ICP, which is not correct in a website context.

This commit replaces calls to ICP by the helper method.

Community: https://github.com/odoo/odoo/pull/68201
Enterprise: https://github.com/odoo/enterprise/pull/17538
Upgrade: https://github.com/odoo/upgrade/pull/2372

task-2476101
2021-06-02 10:04:29 +00:00
Leonardo Pavan Rocha c53724ebc3 [IMP] *: adds generic user avatar
Description of the issue/feature this PR addresses:
It is currently quite difficult to differentiate users. Most of the time, people
don't take the time to upload an actual avatar so everybody looks the same. This
PR generates a custom avatar with the users initials and random color to
differentiate them. For res.users, res.partner and hr.employee, image fields now
hold the binary image and avatar are used to show the image or svg.

Current behavior before PR:
Avatar had only random colors and was being saved in database, being inefficient

Desired behavior after PR is merged:
A new mixin defines image fields and in case no image is set, it generates an
SVG image with the user's initials and random color.

closes odoo/odoo#69819

Task: 2404630
Related: odoo/enterprise#18199
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-06-01 14:36:23 +00:00
Mariska ArchielliandThibault Delavallée 994cc3f5e6 [REF] website_slides: better integrate documentation and training channels
Purpose of this commit is to lessen difference in layouting between courses
being documentation or training. Indeed we want a smoother user experience.

In this commit we

  * use the left bar with course information on course page view on both
    courses;
  * unify menus and tabs;
  * better integrate sale and forum as everything is not a single layout;
  * move Type under Display to have all display related options within the
    same option group;
  * unify display, notably remove "+" on "+ Add Tags";

LINKS

Task ID-2275688
PR odoo/odoo#65454

Co-Authored-By: Mariska Archielli <ram@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
2021-02-11 16:07:27 +00:00
Thibault DelavalléeandMariska Archielli 7cba785900 [IMP] website_slides: allow to see document slides in fullscreen
Allow documentation lessons to be seen in fullscreen mode. Default mode
is still the slideshare-like one but fullscreen is now available. This
imply notably computing category data in both modes to enable fullscreen
support and course lessons navigation.

LINKS

Task ID-2275688
PR odoo/odoo#65454

Co-Authored-By: Mariska Archielli <ram@odoo.com>
Co-Authored-By: Thibault Delavallée <tde@odoo.com>
2021-02-11 16:07:27 +00:00
Romain Derie f2583f3de4 [IMP] website(_*): prevent wrong multi website access during dispatch
Before this commit, routes were prevented to be accessed if the route model was
not accessible from the current website, eg you couldn't access blog1 which is
set to website2 from website 1.
That would raise a 404 even from admin/editor.

This commit introduce that behavior at a lowel level in a generic way, instead
of having to write it on every route.

Note that routes without a model converter won't benefit from this.

Closes #63499

closes odoo/odoo#64313

Related: odoo/enterprise#15688
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2021-01-25 11:01:13 +00:00
75b4e2dd38 [IMP] portal, website_slides: send message without reloading page
1) in this commit, improved portal chatter for messaging. when the user sends a
message, the new message is updated in history without reloading page.
instead of submitting a form which reloads page to send message we added rpc call
to send message.
2) rating on courses is implemented by extending portal chatter, applied changes in
website_slides to do reviews without reloading page
3) refactoring: cleaned or removed code
eg. removed form and some input fields as data is not submitted as form anymore,
introduced some methods to avoid duplication of code

task-2054662
Closes https://github.com/odoo/odoo/pull/47746

closes odoo/odoo#47746

Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
Co-authored-by: ktr-odoo <ktr@odoo.com>
Co-authored-by: Siddarth Gajjar <sga@odoo.com>
2020-11-30 11:22:13 +00:00
Siddarth Gajjar 1e9ae791c3 [IMP] website_slides: beautify tags URL
Before this commit when searching channels based on tags URLs were generated
like `/slides/all?tags=%5B4%5D`. This is not very clean, especially when
people share links.

In this commit we move to a slug-based URLs generation and support. URLs now
look like `/slides/all/tag/basics-1,gardening-2` which is more readable and
user friendly.

Support of all tags is maintained: `/slides/all?tags=%5B4%5D` still work
and display the same as `/slides/all/tag/basics-1,gardening-2` to ensure
links still work after applying this patch.

Along with this improvement this commit also improves the behavior of tags
for bot indexation. This is inspired by website_blog[1].

Task ID-2267840
Closes #53621

[1] - https://github.com/odoo/odoo/commit/0f2cada32319b3910d6ace6d412cfa94a646c9c7

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-11-10 08:55:18 +00:00
Jeremy Kersten 6538e20bb6 [FIX] tools.sql, website_*: increment counter with skip lock
*blog, forum, slides

Based on https://github.com/odoo/odoo/pull/48552#discussion_r440061218 suggestion

Add a new method 'increment_skip_lock' in tools.sql to allow to easily
increment a specific field of 1 if the record is not locked.

The method return boolean if at least 1 record has been incremented.

closes odoo/odoo#58765

X-original-commit: d92e61e89f468c2db2fbd68b2f0d6b36c77f1065
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-09-29 08:48:59 +00:00
Patrick Hoste b39f4b6307 [REF] website(_sale)_slides(_survey): improve course management and creation
PURPOSE

Improve usability of course creation and management in frontend

SPECIFICATIONS

This commit improves various elements of the eLearning module:
  * the create 'new course' dialog has been improved with examples and
    improved placeholders;
  * allow to create tags directly from course creation modal. Using the
    add tag button after having created the course is not the only way of
    managing tags anymore;
  * the create 'new content' dialog has some explanations on the right side;
  * add a flag indicating which content has already been viewed in
    documentation;
  * changes the text/color of some buttons;

LINKS

Task ID-2241513
PR #55698
2020-08-11 10:22:23 +00:00
Patrick Hoste 255bb3abf3 [REF] website_slides: improve course frontend page
PURPOSE

Improve onboarding and user experience and course frontend

SPECIFICATIONS

Overall improvements and onboarding :
  * new and improved default images for both course types;
  * preview / free preview badge update;
  * copy writing and spacing update;
  * allow to specifically choose a slide to promote. Display promoted slide is
    not optional anymore as configured in backend;
  * display a sample of lessons if no lesson in a course;

LINKS

Task ID-2241513
PR #55698
2020-08-11 10:21:30 +00:00
Martin Trigaux ba244cef01 [IMP] *: replace to new _() syntax
Using a few regex like
\((_\(.*%s.*)(\) % )([\w\[\]][\w .\[\]\(\)'"]*)\)
($1, $3))

Old syntax is still compatible but starts the migration to the new
syntax that catches error.
2020-06-18 13:03:34 +02:00
Martin Trigaux d9287caf94 [IMP] *: convert to private methods
render, render_template, load, activity_schedule_with_view,
get_website_pages should all be private:
It should not be possible to render an aribtrary template only with
its name or id

Still need to render some qweb views from js so the method
render_template is kept public.
This explains why the website editor still need read access on
ir.ui.view as we want to allow any snippet to be rendered.
2020-05-14 13:59:10 +02:00
Thibault Delavallée 513c6d18df [FIX] website_slides: allow portal users to udpate their review
Followup of 86c80d341846894c435b1c8f61ef946b06e72ec7 : currently portal users face an access issue
if they change attachments in their review. This commit fixes that by sudo-ing
access to the attachment as other access is already granted.

Task ID 2214795

closes odoo/odoo#50815

X-original-commit: 90152abef30e043d36f8a8aabfe18c46e807973f
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-05-07 09:03:24 +00:00
Thibault Delavallée d0a855985f [FIX] website_slides: allow portal users to read their own reviews with attachment
Followup of 86c80d341846894c435b1c8f61ef946b06e72ec7 : currently portal users face an access issue
if they try to read their full review with attachments. This commit fixes that
by sudo-ing access to the attachment as other access is already granted.

Task ID 2214795

X-original-commit: ad7cd4bd38fdb0d92b22bb979637bb5623621378
2020-05-07 09:03:24 +00:00
David Beguin e52489bf99 [IMP] website_slides: lint and clean slide upload widget and controller code
This commit prepares the next ones from same PR and only clean the code of
slide upload widget + website_slides controller.

Task ID 1981399
PR #43577
2020-04-16 10:26:32 +00:00
Thibault Delavallée d998c29ae8 [FIX] website_slides: fix upload without category
This commits fixes 6d9b367a79d09d3d7a9dde890ca651aa09b93987 that fixed 0a980d4be6300fbc888dcc9daf760a48c1b0ec32 that fixed dc9fa6e2166ad803c91ca4f3e3e17b8065eeee82 .
Amazing.
2020-04-16 10:26:32 +00:00
Andrea Grazioso (agr-odoo) 30988c932b [FIX] website_slides: correctly upload PDF in course
With website_slides installed go to website, select a course in which
the user is enrolled, try to upload a pdf

Traceback will occur because the category recordset is needed but the id
is passed to _resequence_slides

opw-2229756

closes odoo/odoo#49198

X-original-commit: 6d9b367a79d09d3d7a9dde890ca651aa09b93987
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-04-08 09:20:30 +00:00
Julien Castiaux ab4000fb3c [REF] base: Remove deprecated exceptions and osv
TL;DR: remember `osv` and `except_orm` ? You can forget about them.

* Deprecated `except_orm` dropped.
* `UserError` elevated as super type of all user-related
  errors.
* Unused `DeferredException` dropped.
* Unused `QWebException` dropped (real one is in `qweb.py`).
* `MailDeliveryException` made a python exception.
* `name` legacy exception attribute made an alias of the python standard
  `args[0]` attribute and deprecated.
* `value` legacy exception attribute dropped.
* `exception_type` RPC error response key dropped.
* Deprecated `osv` module dropped.
* `--osv-memory-age-limit` cli option made an alias of
  `--transient-age-limit` and deprecated.

The `odoo.exceptions.Warning` have long been a deprecated alias to
`UserError`. It is going to be removed in a future version but first we
explicitly deprecate it with a warning.

The `odoo.exceptions.DeferredException` was a very old internal
exception, it has been removed without deprecation notice as it is never
raised.

The `odoo.exceptions.except_orm` has been a deprecated exception type
with deprecation warning for 5 years, it has been removed in favor of
UserError which becomes the super class of all user-related errors.

The `odoo.base.models.ir_mail_server.MailDeliveryException` was
inheriting `except_orm`. As it is not related to a user error but is
more of a problem an admin much take care of, the exception has been
made a Python error.

The `exception_type` JSON key in RPC error responses was holding an
hardcoded value derived from the exception type. Its usage has been
dropped in favor of the `name` JSON key that holds the precise exception
name. Again as it was hardly used in the source code (beside the crash
manager) it has been dropped without deprecation warning.

Since we are here trying to clean odoo custom exceptions, we are also
deprecating the `name` exception attribute in favor of the more standard
`args[0]` attribute.

The `name` (along with `value`) were two attributes used to raise
`except_orm` exceptions before the introduction of `UserError`,
`AccessError` and related exceptions. The `name` attribute, at the time,
was holding the exception type/title. Nowadays it contains the error
message. The `value` attribute, at the time, was holding the error
message. Nowadays it is no more used.

The `osv` module contains very old deprecated aliases. There is no
simple way to log a deprecation warning for osv, osv_memory and
osv_abstract but as they have not been in use for ages, they have been
removed too. To be consistent, the `--osv-memory-age-limit` cli option
has been made a deprecated alias to the `--transient-age-limit`.

closes odoo/odoo#45723

Task: 2187728
Related: odoo/enterprise#9162
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-04-08 08:41:17 +00:00
qmo-odoo 12c6d77e7f [FIX] website_slides: fix slide reordering in frontend
This commit fixes the reordering of slides on upload or drag and drop
in frontend. This issue was due to the fact that in a previous commit
(c4eba6f) uncategorized slides were moved to the bottom of the list,
which broke the reordering after drag and drop.

Indeed we use the dom order itself to reorder the slides with a simple rpc
call to dataset/resequence. Instead we revert part of the previous fix
to display uncategorized slides at the top. It allows to be coherent with
resequence and with backend behavior that displays uncategorized at the
top of the list.

Another issue was that, on slide upload, in the controller, we used
the category_id on the slide (which seems to not always be correct at
this stage) instead of the one given by the javascript. This caused the slide
to not be uploaded in the right section.

This commit also adds some margin to the categories in frontend for training
courses. Otherwise uncategorized slides are too close to the first category.

Task ID 2090927

X-original-commit: 7bd042d6e20c44558b90641409a6e3f8fa8000ed
2020-03-26 15:57:43 +00:00
RVE-odoo 3efffa8a55 [FIX] website_slides: allow feedback update on review update
Currently, when updating a review on a course, the feedback field is not
updated on the rating model. Therefore, the backend view for rating is
always displaying the first feedback posted

Task ID 2184038

closes odoo/odoo#48382

X-original-commit: f2d04753be9f1feb75e575b0598b3520caa4744d
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-03-25 17:29:21 +00:00
Martin Trigaux 800db7405c [FIX] website_slide: correct frenglish
closes odoo/odoo#48185

X-original-commit: 3ad726f3019e4aa6f7043ef08bf4fae8eec49a09
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-03-23 11:29:34 +00:00
Lavish Chhatwani 9a9edeaf35 [FIX] website_slides: avoid trying to browse categories in frontend player
Before this commit when you browse a course's contents,the category is
displayed as a blank page with a pdf icon rather than going directly to the
next content.

This commit fixes that by skipping the category. User is redirected to the
next available slide.

Task 2201175
Closes #46824

closes odoo/odoo#47886

X-original-commit: 4625c017cfda9ad800124452448252a11a8ac9bb
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-03-18 10:23:31 +00:00
Florent LejolyandAurélien Warnon 660e105431 [IMP] website_[sale_]slides: allow users to take the slide quiz before joining the course
PURPOSE

When previewing a slide of type 'quiz', users are tempted to answer the
questions even if they are not member of the course yet.

This commit will allow users to answer the quiz without being a member of the
course, and offer a smart redirection to join / buy based on the enroll type
of the channel.

SPECIFICATIONS

We introduce a "CourseJoinWidget" that will handle the display and the behavior
of the "join" button based on the user (public or not) and the enroll type
(public course or based on a payment).

When the user answers questions and he's not a member yet, we store the answers
temporarily in the session object.
When he comes back on the quiz page after having completed his membership, we
fill in the quiz based on his previously entered answers and clean the session.

LINKS

Task 2045571
PR #41972

Co-authored-by: Florent Lejolyn <fle@odoo.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
2020-03-12 08:30:16 +00:00
Tiffany Chang (tic) 27005ebdbb [IMP] website_slides: Add course tags creation to frontend
This commit makes it possible for course tags to be added via the
frontend. To support this, course tags were also made viewable in a
specific course's website since previously these tags were only visible
in the courses frontpage (i.e. within the course cards). "Add Tag" is
placed after course page's tags. Note that due to the ability to make new
tags within this "Add Tag" modal restricts addition to only 1 tag at a
time since new tags require a "Tap Group" to be assigned and handling a
mix of new/existing tags would get confusing and complicated.

Supports Task: 2128166
PR #44365
2020-03-05 10:53:45 +00:00
Jérémy Hennecart c9ace27135 [IMP] website_slides: improve the ui on a course (documentation)
Before, uncategorized slides  weren't display correctly on the slide_channel. It was impossible
to view all the slides if there were more than 4 slides uncategorized because the "View all" link wasn't
display.

Now, when there is no section/category on a course, it displays the last 4 slides with the "View all" link
which allows to be redirected to the uncategorized category (category_id=-1). This request displays all the
uncategorized slides with a pager if the limit of 12 slides per page is exceeded.
If there is at least one category created, all uncategorized slides are displayed under a section "Uncategorized".

Additionaly, there is a new button which allows to create a category directly on the course page to allow the user to
organize is course more effectively.

task-2161391
2020-02-12 12:55:35 +00:00
Patrick Hoste e42ee496f8 [IMP] website_slides: add comments on answers showed after answering a quiz
PURPOSE :

A quiz after a course content is a good way to check if the user gets the previous lesson.
Despite, the user/student may not understand why his answer was wrong/correct.
In this task we'll allow the teacher to add a comment next to the asnwer of a quiz.

SPECIFICATION :

The quiz creator will now be able to comment the answers to inform the frontend user why
his answer is wrong/correct. He will be able to add the comments both in backend and frontend.

Task ID : 2072566
PR : #41188

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-24 08:56:12 +00:00
Debauche Stéphane 01dadaecca [IMP] website_slides: improve error message when google API key is invalid
Currently when there is an issue with the google API key, a generic message
is send to the user, with the error details embedded in it in an ugly way.

Now a message is displayed: "Your Google API key is invalid, please update it
into your settings. Settings > Website > Features > API Key". This is done
by parsing the JSON google sends back after request and determining if the
error is linked to the API key.

Task #2082857

closes odoo/odoo#40547

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-20 12:24:43 +00:00
Thibault Delavallée 5649fc88e8 [REF] {website_}mail: move and replace published field of mail.message to is_internal
PURPOSE

Clean posting process and improve mail.message definition and comprehension.

SPECIFICATIONS

Website mail defines a website_published field allowing to publish / unpublish
comments on the frontend of some modules. This field has several drawbacks :

  * it is used only for front-end people (portal, public) and has no real
    effect in chatter / classic discussions;
  * it is used only in some advanced front-end module and is not available
    in portal by default;
  * its naming is not really correct as it is not linked to fields coming
    from the website_published mixin and its behavior is not really
    the same;
  * its use is a bit duplicated with internal flag coming from subtype
    allowing to hide messages related to an internal subtype;
  * there are overrides of standard mail.message methods just to handle
    this flag;

In this commit we change that field by an is_internal flag directly on
mail.message model itself. It tells if share people (customers, share users)
are allowed to read the message. This field can be given through posting
API or set manually using widgets. It is also used in access rights custom
methods and managed like the internal flag of subtypes.

Mailgateway was already using an internal flag for internal note replies. It
is renamed to is_internal and propagated as it is now a standard field. It
also eases code understanding.

Portal is updated to allow managing the flag directly. It means customer portal
now natively allows to moderate customer comments without any need of website
modules.

Rating is updated accordingly. An is_internal field is added, replacing the
related on website published.

LINKS

Task ID 2071556
PR #38692
2019-12-02 15:18:44 +00:00
Florimond Husquinet (fhu) 0a46e086c0 [IMP] website_slide: improve the ways to search through courses
PURPOSE

Purpose of this commit is to improve search capabilities of eLearning
frontend application. Searching tags and content should be easier to
do, update and notice.

SPECIFICATIONS

Before this commit
- There is no visual indication to what are the selected filters.
- The user can only select one tag in each dropdown box.
- When the user selects a tag on one course card, this tag replaces all other
filters.
- When the user enters custom search terms, it replaces all other filters.
- When searching a documentation, a stacktrace appears.

After this commit
- Selected tags appear as little tag boxes under the search bar.
- The custom search terms appear as one tag box.
- It's possible to remove a search tag by clicking on the cross present in each
little box.
- It's possible to select multiple tags in each dropdown box.
- Tags in course cards work the same as tags in dropdown boxes, and add
themselves to the list of filters.
- To generate the list of courses to display, a logical OR is operated between
tags of the same group, and a logical AND is operated between groups of tags.
- A logical AND is operated between the custom search terms and other filters.
- A logical AND is operated between the "My courses" options and other filters.
- Bug when searching a documentation is fixed.

LINKS

Task ID: 2080617
PR #39259

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-12-02 10:18:36 +00:00
Hoste Patrick ec9e389f2f [IMP] website_slides: allow to create and update quizzes directly in frontend
Purpose is to ease designing your courses by allowing to create and update
slide quiz directly in frontend, within the slide display.

With this commit you are able to

  * add a quiz to a slide or add a question to an existing quiz;
  * edit an existing question from a quiz:

   * change the title of the Question;
   * add, remove or update answers;
   * change the right answer;
   * delete an existing question;
   * reorder the questions from a quiz;
   * reset the quiz for the current user if he is a website designer, allowing
     to test the quiz and its answers;

New frontend widgets are introduced allowing to manipulate quiz. Slide page
now supports a readonly / taking quiz mode and an edit mode for quizzes
used notably for website designers / course maintainers.

Task ID : 1999636
PR : #35326

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-11-29 13:36:25 +00:00
David Beguin be3f074a91 [REF] gamification, * : rename challenge.category into challenge.challenge_category
To ease grep in the code, especially that challenge is quite heavily used.

Task ID : 1961053
PR #32594
2019-11-22 14:45:39 +00:00
laa 92cc770c90 [IMP] website_slides: indicate new content on courses to users
Purpose of this commit is to help users knowing there is new content in a
course by adding a visual insight. It is done through a new content arrow
displayed in courses homepage.

Regarding the file "website_slides_templates_homepage.xml", the choice to
incorporate the t-call attribute into a 't' balise was necessary to display
the customize option (part front) associated with the model course_card.

Side dish usability improvements raised during development

  * display completed courses as last instead of first in "my courses";
  * do not show promote strategy field for training courses as it has no
    use, only for documentation courses;

TASK ID 2025186
Closes PR #36703

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-11-20 14:59:07 +00:00
ryv-odoo c7a1a2d964 [REF] rating, various: improve rating.rating ACLs
PURPOSE

Rating model should be available only for internal users. External users
access them only through dedicated routes or controllers using sudo and/or
granting access through tokens. Therefore simplifying ACLs should be feasible.

SPECIFICATIONS

Remove access to rating.rating for public and portal users. Only employees
can access it, with full access given to system admins.

Update various functional flows to use sudo() and check that access is
verified before using sudo.

Impacted modules

  * rating / mail: add groups on some rating related fields as only
    internal users should access them now;
  * rating / mail: set some statistics fields using compute_sudo as their
    value should be accessible for external people even without access to
    the underlying rating.rating records;
  * project: makes some use of rating and has to be updated, notably for
    the public rating page;
  * website_{livechat, rating, slides}: add sudo in public routes as access
    is already granted;
  * website_slides: set statistics field using compute_sudo as their
    value should be accessible for external people;

TASK ID 2053096
PR #36592

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-11-19 15:46:51 +00:00
Patrick HosteandAurélien Warnon c957949b8c [IMP] website_slides: add an animation when user levels up
PURPOSE

If a user levels up after passing a quiz, we want to clearly show him in the success modal that he
actually passed a level instead of just showing his new rank and xp gauge.

This commit introduces an animation with the progress bar when the user is levelling up.

After reaching the upper bound of the next level:
- The progress bar goes back to 0 ;
- The lower/upper bounds change to reflect the new reached level bounds ;
- The message "Amazing!" becomes "Level Up!" ;
- The motivational phrase changes with a fade out/fade in animation.

LINKS

PR : #39870
Task ID : 2032649

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
2019-11-06 13:01:17 +00:00
Jeremy Kersten e19227d3ba [IMP] website*: clean sitemap
From now, you need to explicitely add sitemap=True if you want your controller
into the sitemap.

It's the default value, but if you forgot it, it will raise a Warning on runbot.
It will avoid wrong controller in sitemap and duplicate (empty) content.

From now, if your model contains a field website_id, the modelConverter for
sitemap will automatically add the domain:
   "[('website_id', 'in', (False, current_website_id))]"

It avoid redundant declaration and ugly url in redirect/rewrite view.

Migration: need to remove it from url_from in website.rewrite

task-2065018

closes odoo/odoo#39427

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-10-28 10:36:56 +00:00
fw-bot d128200f18 [FIX] website_slides: don't crash when the slide has been archived
opw-2089868

closes odoo/odoo#39227

X-original-commit: 2dc54945746223525762d10128bffbc9530a3591
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-10-23 08:03:41 +00:00
Romain Derie 9b38bcec12 [IMP] website, website_*: improve edit in backend feature
*base, website_blog, website_event, website_forum, website_slides

With this commit:
1. It is now possible to add the 'Edit in backend' entry in the frontend navbar
   for any desired model, not only the ones which have the published mixin.
   It will simply redirect to the main_object form view.
   This commit add it to Forum and Blog.
2. When clicking on 'Edit in backend', it is now possible to land on another
   module than Website.
   That's especially useful for events and slides which are not directly
   related to the website module as they have their own module.
3. Remove the custom Edit in backend from the forum homepage (fa-cog).
   Opportunity was also taken to remove the 'edit welcome message'.
   It will now be editable through the editor (welcome message will appear in
   edit mode). Thus we got rid of the custom edit welcome message controller
   and views.

Closes #36325
2019-10-02 07:13:26 +00:00