[FIX] website_slides: error message on elearning course preview

Steps to reproduce:
    - go to eLearning app;
    - select a course and go to its website page;
    - the course may (or not) be published;
    - join the course;
    - click on a course material which is not pusblished.
    (the course material does not have to be completed before)
    (on loading slide on full-screen mode)
    (in debug mode, it is not a "pop-up" but an classic error)

Issue:
   A message "Odoo Session Expired" appeard.

Cause:
   The course is not marked as completed. The `canSelfMarkCompleted` attribut is always False and will raise the error because we will continue the flow as if the slide is completed and this is not the case.

Solution:
   We have to test this `canSelfMarkCompleted` attribut to decide whether or not we continue.

opw-3033797

closes odoo/odoo#105379

X-original-commit: 6ca729d0ada58f2d7db736ecb4fa3aa98fbc9068
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
Signed-off-by: Lefebvre Thomas (thle) <thle@odoo.com>
This commit is contained in:
Thomas Lefebvre (thle)
2022-11-14 15:21:07 +01:00
parent c7cb454a67
commit ef300d6463
@@ -84,7 +84,7 @@ export const SlideCoursePage = publicWidget.Widget.extend({
* false to mark the slide as not completed
*/
_toggleSlideCompleted: async function (slide, completed = true) {
if (!!slide.completed === !!completed || !slide.isMember) {
if (!!slide.completed === !!completed || !slide.isMember || !slide.canSelfMarkCompleted) {
// no useless RPC call
return;
}