Commit Graph
344 Commits
Author SHA1 Message Date
Julien Banken a03b57a1c5 [FW][FIX] slides: Do not show a traceback when the user provides an invalid video link
PURPOSE:

When the user creates a new content for a course and specify an invalid
video link, the system will display a traceback when the 'onchange' hook
of the field is triggered (i.e: when the user unfocus the field).

Instead of displaying a traceback with the 'Warning' function, we will
rather use the 'UserError' function which is more user-friendly and does
not provide any debugging information.

SPECS:

- Replace the 'Warning' function call with 'UserError'.

LINKS

Task id: 2607238

closes odoo/odoo#74237

X-original-commit: 7e9949b9c1e2e98a4d5059de695dbed95751b8b5
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-07-26 12:15:54 +00:00
dht-odoo b8fb33817b [IMP] website_slides: improves field type from text to html
Replace text fields to html fields as we have our own 'OdooEditor'.
Indeed, it gives more options to users in the way they format their
content without weighting too much on the UI
(tools appear on demand and not by default).

Models -> Fields

1) slide.channel -> description
2) slide.channel -> description_short
3) slide.slide -> description

Task Id: 2499504

X-original-commit: 6d914c005183aa5ae69650e3002a5a85ca83b4a6
2021-06-07 05:24:08 +00:00
Djamel (otd) d6c409444d [FIX] website_slides: set PdfFileReader to strict=False
Steps to reproduce the bug:
- Go to elearning app > Courses > content
- Create new slide > Upload a PDF file with faulty content

Problem :
Pypdf2 throws errors because it does not support some content or syntax.
In our case we are just trying to get the number of pages in the PDF, so if we put `strict = false`
we just determine that the user should not be informed of all the errors that pypdf2 encounters,
the flag `strict` is not a security indicator.

FYI: https://pythonhosted.org/PyPDF2/PdfFileReader.html
``` strict (bool) - Determines whether user should be warned of all problems and also causes some correctable problems to be fatal. Defaults to True.```

opw-2530829

closes odoo/odoo#71756

X-original-commit: 3acd0d666af56c39e34fc551e182468cc7bedc42
Signed-off-by: Djamel Touati <DjamelTouati@users.noreply.github.com>
2021-06-04 13:33:25 +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
Anjali d70af67954 [IMP] website_slides: show relevant info while viewing partners' courses
Currently, when you click the stat button "x Courses" on a contact, you land
on the dashboard of the courses that this user follows. But this information
in not much useful here. You'd like to see information like progress of this
member for each courses, or when the member was last active on a specific
course.

With this commit, when you click the 'x Courses' stat button from a contact,
you will see the list view of model 'slide.channel.partner', having the
default filter for the contact from which you clicked the button. This will
show the additional and relevant information you need, and by removing the
filter, you'll be able to see info about all the attendees and their progress
on courses they follow (Note that here if the partner is a company, you
won't get default filter set but the records will be filtered by domain,
because we need to show courses of current contact and it's children, and
so we have to set domain in action, instead of adding default filter in
action context).

The same way, on the Attendees View of a course (when seeing attendees from the
course dashboard), we add 'Last Action' field, and instead of fixed domain, we
use filter to view attendees of a particular course, removing which can allow
us to view information about all the attendees from all courses.

We also introduce new 'Attendees' menu under 'eLearning > Reporting' that will
show information about all the attendees from all courses, with a default group
of channels

Task Id-2409447

closes odoo/odoo#64152

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-17 09:12:26 +00:00
Julien Banken 1ba6312f29 [FIX] slides: Verifying the returned value of re.search before accessing the capture groups.
The `search` function of the `re` package can return `None` if the
provided string does not match with the provided pattern
(https://docs.python.org/3/library/re.html#re.Pattern.search).

On the `_parse_youtube_document` function of the `slide.slide` model,
we are directly accessing the capture groups from the returned value
of the `search` function without checking that the returned value is
actually a 'match' object. As a result, an exception can be throw if
there is no match as, in that case, the `search` function will return
`None` and the `group` function will not be defined on `None`.

To avoid throwing an exception, we will check that the returned value
of the `search` function is not `None` before accessing the capture
groups via the `group` function.

LINKS

Task id: 2525007

closes odoo/odoo#70763

X-original-commit: 575a524474fe8866cc71b3befc6bbbde8d73075e
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-05-12 15:02:41 +00:00
Jérémy Hennecart dd98184c43 [IMP] website_slides: remove the automatic creation of link trackers
Before, each time the name of a slide was modified then a new link
tracker was created.

After discussion, we agreed to remove the automatic creation of link
tracker and let the user creates it manually if he really wants one.

The slides already have a lot of statistics that can be used without
the need of a link tracker.

task-2511961

closes odoo/odoo#69734

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-04-23 09:50:43 +00:00
Philémon van Helden 542618db8e [FIX] website_slides: correctly shows 0 XP on completed unpublished quiz
In 13.0 and above, when looking at a quiz that was completed while not published, it would incorrectly show 2 XP awarded, when 0 XP should be awarded.
With this commit, we show instead the correct 0 XP awarded.
opw-2480343

closes odoo/odoo#70349

X-original-commit: 26f047633b919bd8f2a260305bfd80e15bf259b6
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-05-04 15:41:09 +00:00
Xavier Morel 369075fefb [FIX] website_slides: de-raw-ify
Convert `embed_code` to a computed HTML field so it's considered markup-safe.

It needs to be sanitize=False because we're putting <iframe> elements
in it. Those get stripped by sanitize.
2021-04-29 05:34:20 +00:00
Achraf (abz)andThibault Delavallée f5adb5b25d [FIX] mail: send notification mail with right access link when using mail.thread
PURPOSE

Notification may be sent using a generic mail.thread record, notably when
sending user notifications. In that case links to view document are
incorrect.

HOW TO REPRODUCE

Issue

    - Install "Approvals"
    - Submit new approval with you as "Request Owner"
    - Click on "View Approval Request" in your mailbox

    The link redirects to a 505 error

Cause

    The model is not the correct one and the res_id is undefined

Solution

    Specify the model and the res_id to _notify_get_action_link
    when creating the link with kwargs

SPECIFICATIONS

Propagate message value through various notification sub methods. That way
we can rely on them if model seems void.

Also limit values given as URL parameters to some white listed values.

LINKS

opw-2358846
Task ID-2379766
Followup of odoo/odoo#60998
Followup of odoo/odoo#61545
Closes odoo/odoo#63292
Closes odoo/enterprise#15585

closes odoo/odoo#64229

X-original-commit: 58bac5d242d6548d54f0163328fa64b319852e40
Related: odoo/enterprise#15634
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Achraf Ben Azzouz <abz@odoo.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2021-01-07 17:44:37 +00:00
ijas ahammed 5e59ced9ca [IMP] website_slides: separate backend tags from frontend tags
Backend tags are generally used internally for classification or daily
process. Frontend tags are used for filtering and menu definitions. These
two type of tags are not managed separately in eLearning channels right now.

This commit separates backend and frontend tags using the color field.
Along with that, it improves the following :

Frontend

 - only displays channel tags that has color set;
 - avoids showing void tag group / menu (without any frontend tags);

Backend

 - prevents access of the backend tags for portal/public users with a
   record rule (similar to online events);
 - adds 'Tags (tag_ids)' field in the list view of 'Course Groups' that
   shows all the tags (frontend as well as backend);
 - hides the colorless tags in slide channel kanban;
 - improves the form view for course channel tags;

Frontend and Backend

 - adds a default color value while creating a new channel tag

Task ID-2357942
PR odoo/odoo#62138

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-12-23 14:49:28 +00:00
Lavish Chhatwani 3df926b30b [FIX] websites_slides: remove active test from context
Before Commit :
-when user archive a course content, it's still visible
 on the course itself, without real difference between
 active content and archived. it was confusing.

After Commit :
-now when user archive a course content, it's not visible
 anymore on the course.

closes odoo/odoo#63508

Task-id: 2411211
X-original-commit: 363dcd4e19e88854118e10c11ee2c6bbdf13b537
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-12-17 10:42:22 +00:00
Adrian Torres 679185f3e8 [IMP] *: replace all raises inside unlink by api.ondelete
With this commit, all instances of errors being raised inside
`BaseModel.unlink` overrides are moved into methods decorated with
`api.ondelete` which is safer.
2020-12-04 09:16:16 +00:00
Victor Feyens e2c3ab984d [IMP] website_slides: support batch creation
See merge commit for more details.

Task ID-2330149
COM PR odoo/odoo#61246
ENT PR odoo/enterprise#14561
2020-12-03 10:19:21 +00:00
Anh Thao Pham (pta) ec04b04b1e [FIX] website_slides: fix quiz karma won
- Install website_slides
- Connect with an user (i.e. Mitchell Admin)
- Go to Website and open a Course quiz for the first time
(i.e. "Test Yourself" from "Basics of Furniture Creation" Course)
- Answer correctly
The number of won karma is the one from the last attempt reward and is not saved
in user's total xp.

When submitting the quiz, quiz_attempts_count is incremented via a SQL query,
but its value is not updated in cache directly.
When the karma gain is computed from the attempts count, the value used is the
old one in cache.

opw-2389969

closes odoo/odoo#62500

X-original-commit: d8254c130d4b04a0f1ff80990fe28e795bf9ad51
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2020-11-27 10:20:32 +00:00
Jairo Llopis 012eec250a [FIX] website_slides: embed YouTube videos without cookies
Due to recent legal changes in EU, you cannot install tracking cookies in a user's browser without explicit consent.

Before this patch, Odoo embedded youtube videos were violating that law (AFAIK & IANAL).

With this simple patch, you benefit from YouTube's offering to embed videos without cookies. The UI remains the same, but no tracking is done.

@Tecnativa TT26153

closes odoo/odoo#61828

X-original-commit: a1a1169f28233b69cd70d01621d605b36517ac73
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-11-17 09:55:43 +00:00
Aurélien Warnon a3aa45414b [FIX] website_slides: fix archive/unarchive slide.channel behavior
PURPOSE

This commit fixes the behavior of archiving and un-archiving slide.channels.

SPECS

When archiving a slide.channel, you could run into an issue where the
associated slide.channel.partners would be marked as "completed" even though
the related slides were NOT completed by the user.

This happened because when computing the completion, it's searching for
slide.slide.partners marked as completed, and then comparing it with the count
of slide.slides in the channel, which would always return 0 since all slides
are archived when the channel is archived.

Marking channels as completed when they should not triggers undesired
side-effects (karma increase, completion email sent, ...).

Now, when the slide.channel is not active, we don't mark associated
slide.channel.partners as completed anymore.
The ordering in which we archive channel and slides was also altered, see
method docstring of 'slide.channel#toggle_active' for more info.

A new test ensures the correct behavior of archiving.

LINKS

Task 2170708

closes odoo/odoo#61773

X-original-commit: f7795f85ed66fcebaf8a96bf4e550b069fcf1e83
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
2020-11-16 13:40:47 +00:00
Aurélien Warnon 4ebe8ccf00 [FIX] website_slides: fix slide.channel mail completed
PURPOSE

Fix the 'multi' behavior when sending completion emails for slide.channels.

SPECS

There was a typo in the 'slide.channel#_send_completed_mail' method that
prevented it from correctly working in "multi" mode.

A new test was introduced to ensure the fix is working.

LINKS

Task 2170708

closes odoo/odoo#61004

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-30 10:30:18 +00:00
Martin Trigaux c59c10f1bc [FIX] *: correct typos and bad English
Courtesy of translators
Reexport .pot of modified modules

closes odoo/odoo#61010

X-original-commit: 62a18bdb372e234107fd2099a2df5f9e3a442c96
Related: odoo/enterprise#14489
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-29 19:23:41 +00:00
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
Dharmraj Jhala 7e750ac639 [FIX] website_{slides,forum}: enable slide content and forum creation
Since a recent refactoring[1] is merged, few compute methods are being
called at record creation, and throws traceback because of newID.

This commit fixes the traceback by improving the compute methods and
thus enable users to create records of slide contents and forums.
Note - compute fields should be assigned a value, and so we update
the recordset with default values while creation. See below PR for
more information.

[1] - https://github.com/odoo/odoo/pull/55995

Task - 2325605

closes odoo/odoo#58196

X-original-commit: a677859a03c86bf6ac791c31f52ce8609bcba594
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-09-22 10:07:46 +00:00
Victor Feyens c482fdbf05 [IMP] various: improve code style and performance by improve `all()` usage
PURPOSE

Clean code. Be more performance oriented.

SPECIFICATIONS

Improvements applied in this commit

  * not all() --> any(not) for earlier returns;
  * all([generator]) --> all(generator) to avoid unnecessary list casting.
    This code construct is better managed by all;

This commit will probably not have a big performance effect on standard
production databases. However each performance and cleaning improvement
is welcomed.

LINKS

Task ID-2328619

closes odoo/odoo#56810

X-original-commit: 1cc6bb1231401ea7f501d2f5b5e9641ec8734850
Related: odoo/enterprise#12802
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-08-31 13:59:27 +00:00
Patrick Hoste 375e38fcd8 [IMP] website_slides: send an email when an attendee finishes a course
PURPOSE

After this commit, an email will be sent to congratulate the attendee
for the completion of a course.

SPECIFICATION

Adds a new 'Completion Email' template field in the slide.channel model
that will be sent automatically after an attendee completes a course.

LINKS

Task ID : 2216352
PR : #49592
2020-08-24 13:42:54 +00:00
Patrick Hoste 0b43747a4b [IMP] website_slides: add partner completed course filter
PURPOSE

Before this commit, it was possible to send an email to all attendees only.
After this commit, it will be possible to send an email to attendees that
completed the course.

SPECIFICATION

Adds a searchable o2m field in the res.partner model to find all the completed
courses linked to that partner.

LINKS

Task ID : 2216352
PR : #49592
2020-08-24 13:42:54 +00:00
Thibault Delavallée a91972a910 [FIX] website_slides: set groups on slide-related fields of partner model 2020-08-24 13:40:00 +00:00
Martin Trigaux 6156f98288 [FIX] *: adapt action content retrieval
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.*
2020-08-17 09:09:02 +00:00
Didier d761a73ad0 [IMP] website_slides: improve archive management
PURPOSE

Archiving a course should also archive its content, and unpublish it as it
should not be accessible from outside. Improve archive / publish management
between a course and its slides.

SPECIFICATIONS

Show the content of an archived course having archived slides. When slides and
course are archived its content should still be displayed. This is done using
an active test in context of field.

Propagate channel archive to content. Also unpublish archived slides.

LINKS

Continuity/IMP of task-2170708
Task-2225598

closes odoo/odoo#52233

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-08-12 10:26:55 +00:00
Patrick Hoste 4f2a4b175f [REF] website_slides: improve elearning backend usability and onboarding
PURPOSE

Improve elearning backend usability and onboarding

SPECIFICATIONS

Improve layout of email send when invite. Do like a SO, add the join button
in the notification email and not in the composer itself. It required to
create a new notification layout specific to that invite wizard.

Improve channel form view: remove statistics as they are already displayed
in various places, add a stat button for content/visits, better display of
karma (split gain from karma-based access rules).

Automatically publish channel's product to avoid de-synchronization of publish
flags.

Remove unused channel_url field on wizard.

LINKS

Task ID-2241513
PR #55698
2020-08-11 10:31: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
Xavier Morel e162e6f714 [FIX] test_lint, *: false negative in sql injection linter
The linter would miss / fail to warn on injection of *local variables*
in some cases.

Try to improve it to be stricter and more reliable, after discussion
with odo, sql which is "correctly" dynamic should use psycopg2's sql
package in order to bypass the linter (bonus: it should also properly
escape & quote identifiers).

closes odoo/odoo#53938

Related: odoo/enterprise#11718
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2020-07-10 07:12:35 +00:00
Nicolas Martinelli 834ebc26ff [FIX] website_slides: use email_from on new content notif
- Seta a value for the `ir.config_parameter` `mail.catchall.domain`
- Enroll user A to a course
- Add new content to the course
- Publish it
  => an email is sent to the users enrolled
- Reply to the email

The reply is considered as a review of the course.

It is not intended that users reply to such email; they are 'one-way'
notifications.

A solution is to be able to set the `reply_to` field on the mail
template. This way, it's possible to set it to a `noreply` value.

opw-2290521

closes odoo/odoo#54281

X-original-commit: 7ffc300e7c857bf743d7ab25631f9ee02419dea1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-07-09 13:57:42 +00:00
Nicolas Martinelli b93e9780de [FIX] website_slides: slide sorting
Ensure deterministic sorting for slides with the same sequence.

opw-2283154

closes odoo/odoo#54008

X-original-commit: 46bd51dc5f7b674409beac2557cbd19ec001944b
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-07-02 15:40:32 +00:00
jvm-odoo 8c5b47e8c3 [FIX] website_slides: fix youtube URL params ignored
Issue

	- Install website slides
	- Create a slide with document url =
	  a youtube video URL with params like ?rel=0
	- Check it on the website with debugger

	The iframe url doesn't have ?rel=0

Cause

	We only take the video ID and pass it
	to a predefined string. We add light
	theme params too.

Solution

	Split the given url in order to
	get the params and pass it to
	the predefined string.

OPW-2275928

closes odoo/odoo#53334

X-original-commit: 5e8fcd3391525192f462cc44acd84d3badb4f132
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-06-19 13:45:54 +00:00
Victor Feyens bdcad21ccc [FIX] *: correct support of multi records in methods
Wrong usage of self in for loops makes some apparently multi-friendly
methods not work correctly when called with a recordset of len > 1.

This commit replaces those references by the correct unique record
reference which should be used at this iteration of the loop, avoiding
potential exceptions or wrong behavior in the concerned methods.

closes odoo/odoo#53320

Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-06-19 13:27:41 +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
Thibault Delavallée 5227f956da [FIX] website_slides: better reorder after category deletion
Currently deleting a category with slides is not supported as it should
be voided before being unlinked. This commit allows to unlink a category
by moving all its slides in uncategorized section.

This require a small reordering of sequences as category computation is
based on sequence of slides in a given channel.

Task ID 2276559
Prepares Task ID 2093671
PR #52917

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-06-12 11:20:57 +00:00
Patrick Hoste 786374399e [IMP] website_slides: add possibility to request access to private course
PURPOSE

Before this commit, a user could not contact a course responsible to ask him
to join. With this commit he is be able to do it.

SPECIFICATIONS

Change the message 'Contact website administrator' to 'Contact Responsible'.

Add the name of the course responsible in the course description panel. When
clicking on its name it opens a modal to request access to the course. It
creates an activity linked to the customer and assigned to the responsible.

When hovering the 'You're enrolled' button the fa-check icon changes to a
fa-times icon to show that you can unsubscribe when clicking.

LINKS

Task ID : 2127364
PR : #40708
2020-06-08 10:43:53 +00:00
Patrick Hoste ad8c53ac2c [FIX] website_slides: changes enroll_msg default value
SPECIFICATION

Changes enroll_msg default value to 'Contact Responsible' instead
of testing if it was empty or not. Since the FieldHtml widget sets
the default value to '<p><br></p>' it was never empty.

LINKS

Task ID : 2127364
PR : #40708
2020-06-08 07:14:14 +00:00
Benjamin Frantzen (bfr) e4a4ffb974 [IMP] customer ratings flow improvements
- Rename the 'Use Rating on Project' feature into 'Customer Ratings'
- Rename the 'Set Email Template to Stages' link to 'Set a Rating Email Template on Stages'
- Add an optional list view for the Stages menu
- display warning if the rating_template_id field is set and if one of the selected project_ids doesn't have the rating_status field set to true
- Project form view revamp
- rename the '% on tasks' stat button into 'Customer Satisfaction'
- Remove the 'no option' for the rating frequency field because it is required
- project form : Add a 'Go to Website' stat button
- Project dashboard: remove the 'Customer Ratings' menu item in more
- Ratings page: the 'Last 30 days' filter include ratings from today
- remove the Appointment / Helpdesk Customer Satisfaction / Live Support menu items

TASK ID : 1251
2020-05-08 12:17:20 +00:00
DramixDw 9b9829416b [IMP] website: simplify website menu
Some apps, once installed, automatically create a menuitem in website.
What complexify the UI and create useless menu withtout plusvalue.

It is not because you install livechat to make support online, that you want
a link in your menu to show stats e.g.

Now we remove the default menu created, and help user to find it when he create
a link. The autocomplete suggest most of the main App's controllers

task-2189613

closes odoo/odoo#49081

Related: odoo/enterprise#9733
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-05-01 07:59:07 +00:00
jerome hanke (jhk) ffe119d03e [FIX] website_slides: leaving a course unsubs from the related channel
Steps to reproduce:
- install eLearning
- go to the website > courses > enroll in any course > leave the course

Previous behavior:
you are not unsubscribed from the slide channel and still receive mail
notifications

Current behavior:
you are unsubscribed from the channel when you leave the course

opw-2244716

closes odoo/odoo#50404

X-original-commit: cb262738a20fad3e5114e9df21b77f499347745e
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: mightyjol <jhk-odoo@users.noreply.github.com>
2020-04-29 14:53:28 +00:00
Patrick Hoste 03e62ac8ad [IMP] website_slides: publish content when publishing slide
Purpose of this commit is to avoid de-synchronization where content could
be unpublished whereas slide was published.

Task ID 2239840

closes odoo/odoo#49908

X-original-commit: d0f4a3e85eab63e335766a823185fd6ada6e07b4
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-04-22 06:46:46 +00:00
Patrick Hoste ec2b38dd1f [IMP] website_slides: allow user to download slides pdf by default
PURPOSE

To align on the v13.0 enable the 'Allow Download' option by default.

SPECIFICATION

Change the default value of slide_resource_downloadable from False
to True.

LINKS

Task ID : 2225802
PR : #49951

closes odoo/odoo#50164

X-original-commit: 44bfb8c73f9abc563ce764411610f45e5bdf18b1
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-04-24 14:51:49 +00:00
Thibault Delavallée d73a92505c [IMP] website_slides: implement archive cascade behavior in toggle_active
Purpose of this commit is to make use of toggle_active to implement business
behavior linked to active field being changed. In this commit we move the
business specific code from write to toggle_active. When archiving a channel
its slides are archived.

In this commit we also track active field for courses and slides, allowing
to see flag changes in chatter.

Task ID 2170708
Community PR odoo/odoo#46563
2020-04-03 12:59:29 +00:00
fja-odoo 388c222c6c [IMP] base, *: allow html fields not to sanitize forms
* = event, website_event_track, website_sale, website_hr_recruitment,
website_livechat, website_sale, website_slides

The option to sanitize or not the forms was not available, this will
allow better flexibility on whether forms should be sanitized or not on
an HTML field.
Also we use this new param to allow forms to be added on some already
existing html fields where forms where sanitized out.

task-2209554

closes odoo/odoo#47318

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-03-31 14:22:43 +00:00
Adrian Torres 1daf8eb127 [FIX] *: set ondelete policy of required Selection fields
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.

closes odoo/odoo#46325

Related: odoo/enterprise#9117
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-30 13:42:04 +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
Quentin Mourier 843caa270c [FIX] website_slides: fix resequencing based on category
When new slides are added through frontend a resequencing of slides and
categories sequence is done by calling _resequence_slides on the channel.
However this method is not working as expected, and resequencing should
take a category in order to better know where to start its resequencing.
Otherwise it simply reorder slides in the same order as before, or in an
unpredicted or prodicted but fasly order if new slide category has just been
created.

Task ID 2090927

X-original-commit: f038946ae2e3f174bee086281a541c6bc770e354
2020-03-26 15:57:43 +00:00
jvm-odoo 5eea6b278e [FIX] website_slides: fix undeletable question answer
Issue

	- Go on Runbot V13
	- eLearning
	- In a course, try to delete a question

	You can't

Cause

	The linked answer is not deleted
	If you want to delete the answer you should
	add an extra menu

Solution

	Add ondelete='cascade' on answer's question_id
	Prevent course deletion if there are attendees

OPW-2210096

closes odoo/odoo#48372

X-original-commit: 799ee72facbca7a7eaf348938ed312a6d723854e
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-03-25 16:04:59 +00:00
Thibault Delavallée a03f6483d6 [REF] mail: clean code about rendering in mail_template
PURPOSE

Clean and rename code about language management and template rendering in mail
template model.

SPECIFICATIONS

Clean method naming and try to make code easier to understand and call. Also
add and/or clean docstrings of rendering methods.

Notably

  * ``_classify_per_lang``: for each lang-contextualized template, give the list
    of record ids;
  * ``_render_template``: now working only on a valid list of IDs instead of
    allowing both int / list and having a return type depending on the input
    type. It allows to simplify code and delegate some processing to callers;

Introduce new API method

  * ``_render_lang``: for each record id return the lang matching it;
  * ``_render_field``: render a field of mail.template, on given set of record
    ids. Usage: template._render_field('body_html', records.ids). Language
    computation is available for this method;

Remove the "multi mode" support of rendering that either returned a rendered
value, either a dict based on given ids. Now all methods always work in batch
and caller have to fetch the correct result if necessary.

LINKS

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:24:18 +00:00