Commit Graph
1520 Commits
Author SHA1 Message Date
Benoit Socias a676344ecc [FIX] website{_*}: not truncate URLs in search results
website{_*}: website, website_blog, website_event, website_forum,
website_sale, website_slides

Since the generic search bar was introduced in [1] all text fields were
truncated in search results.
This caused problems for long URLs which were truncated as well, and
therefore could become invalid.

After this commit URL fields specify `'truncate': False` in their search
detail metadata, which informs the rendering to skip the text truncation
step for that field.
Also added previously missing controller-level tests of the
autocompletion.

Steps to reproduce:
- start odoo with website_forum and demo data
- go to the Help forum
- search for "configure" in the Help forum
- click on the auto-complete suggestion
- => redirected to a 404 page because the URL was shortened
To test the fix on other models, use a long enough name that causes the
problem. E.g.: "This product has such a long name its URL would have
been truncated without the fix contained in this branch".
Note that the problem did not occur on blogs because the URL does not
contain the name, but the same fix was applied for consistency.

[1]: https://github.com/odoo/odoo/commit/7559626c54e34b41e1549e28276a650accec6986

task-2727788

closes odoo/odoo#82621

X-original-commit: 045f741be35e62f5e3a636490c6c1d475b5d78eb
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-01-12 14:55:03 +00:00
Alexandre Kühn 9a0006bdd3 [IMP] mail,*: remove manual need to bind record methods in created
*: website_slides

Task-2731656

closes odoo/odoo#82444

Related: odoo/enterprise#23343
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-01-10 16:32:53 +00:00
Didier (did)andSébastien Theys 84adbcaffa [IMP] mail: move the activity handler inside a model view
part of task-2579306

closes odoo/odoo#79538

Related: odoo/enterprise#22506
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Co-authored-by: Sébastien Theys <seb@odoo.com>
2021-12-20 16:52:47 +00:00
Didier (did) 7d7a1e4029 [IMP] mail, website_slides: use mock server for activity test
closes odoo/odoo#81502

Related: odoo/enterprise#22941
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-12-17 12:51:39 +00:00
Louis Wicket (wil) c873ea643a [IMP] mail, calendar, website_slides: rename activity model
Rename javascript model 'mail.activity' to 'Activity' in order to
distinguish javascript model from python model.

Part of task-2701674.

closes odoo/odoo#80555

Related: odoo/enterprise#22593
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2021-12-15 00:10:23 +00:00
Yannick TivisseandVictor Feyens 18952cdc76 [IMP] *: Convert single create method into multi
Taskid: 2703085
Part-of: odoo/odoo#80824
Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-12-14 19:13:18 +00:00
Martin Trigaux d99cfd9416 [I18N] *: export saas-15.1 source terms
closes odoo/odoo#80964

X-original-commit: 0663892a34896980008eb0de69aeb58019a67e89
Related: odoo/enterprise#22759
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-12-07 13:48:53 +00:00
Thibault Delavallée bd0d951eef [FIX] website_slides: fix choosing of templates in invite wizard
``channel_id`` field is used to compute ``render_model`` of invite wizard
used to filter templates to choose. It is a fake trigger ensuring the
render model field is computed, and then used in template domain
(see ``mail.composer.mixin`` and ``mail.render.mixin``).

As channel_id field is not available in view the domain computation for
template_id is not updated. No template is therefore available in template
m2o field in invite wizard. This commit fixes that by adding the channel_id
field in the view, meaning render_model is now computed.

Task-2709581

closes odoo/odoo#80947

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-12-07 11:50:54 +00:00
Thibault Delavallée 4d4c66acc4 [IMP] website_slides: remove unnecessary create override
An override of invite wizard exists to give a value to body and subject.
However as those are computed field (not required) this is not necessary.

Task-2709581

Part-of: odoo/odoo#80947
2021-12-07 11:50:53 +00:00
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 1a21b0896a [MOV] website_slides: move slide.embed model into its own file
As we are going to do some rework on the slide.embed feature, let's put the
model into its own python file.

Task-2654009

Part-of: odoo/odoo#77736
2021-11-24 10:18:17 +00:00
Aurélien Warnon 6638b79c5e [IMP] website_slides: improve sharing control when slide is embedded
This commit improves the sharing control when the slide is externally embedded,
meaning embedded outside of the Odoo website, on a third party.

Previously, there were several buttons to share (by email / social / embed),
but the end result was really strange with some kind of overlay content
displayed on top of the PDF viewer that was almost unreadable.

Now, we simply re-use the "slide_share_modal" template to get a consistent
sharing feature whether it's embedded externally or not.

Side note: this removes the ability to share by email, which was not working
anyway since it requires the user to be logged-in to the system, which will
most likely never happen if said user is actually viewing the slide on a third
party website.

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
ijas ahammed 4566e1b23d [IMP] website_slides: improve content list view under reporting menu
This commit improves the list view of the contents under reporting menu
to make it simpler. Since we don't want to allow multi-edit here this commit
adds a different list view for reporting and binds it with the action.

Also, the action now excludes the sections from the result, and applies
default filter to see 'Published' content while landing as other content will
probably have no interesting statistics.

Also added float time widget for `completion_time` field.

TaskID-2607467

Part-of: odoo/odoo#76930
2021-11-23 09:39:35 +00:00
ijas ahammed 8f800a5ec0 [IMP] website_{slides,sale_slides}: improve course list view under reporting
This commit makes the reporting courses list view simpler, which now has
following fields:

- name
- user_id
- total_views (updated string to `# Views`)
- rating_avg_stars (updated string to `Average Review`)
- total_time (displays total)
- members_count (displays total and updated string to `# Attendees`)
- members_done_count (displays total and updated string to `# Completed`)
- product_sale_revenues (added from website_sale_slides with monetary widget)

This commit also adds a 'Published' filter to course search view
which is applied by default in report action for the courses.

TaskID-2607467

Part-of: odoo/odoo#76930
2021-11-23 09:39:35 +00:00
ijas ahammed ac3c4e6f67 [IMP] website_slides: improve content list view
This commit makes the content list view simpler, which now has following fields

  - name
  - channel_id
  - category_id (optional, default hidden)
  - user_id (with "many2one_avatar_user" widget)
  - is_published
  - date_published
  - completion_time (displays total and added float time widget)

Note that the view is now multi-edit, but we only want to update 'user_id' and
'is_published' fields in batch. So all other fields are readonly.

We have removed tracking from `date_published`, `website_published` field and
added tracking for `is_published` field. This information is sufficient.

TaskID-2607467

Part-of: odoo/odoo#76930
2021-11-23 09:39:34 +00:00
ijas ahammed fb372a69de [IMP] website_slides: improve course list and form view
This commit makes the course list view multi-edit (except 'name' field)
and moves the 'website_id' next to 'user_id'.

In form view: inside options page we have moved `enroll_msg` under to
`enroll_group_ids` to have all enroll options well displayed.

TaskID-2607467

Part-of: odoo/odoo#76930
2021-11-23 09:39:34 +00:00
ijas ahammed ce21cfb99c [IMP] website_slides: reorder eLearning settings
This commit reorders eLearning settings blocks, which now looks like

+----------------+-------------------+
| eLearning      |                   |
+================+===================+
|                |                   |
+----------------+-------------------+
| Certifications | Paid Courses      |
+----------------+-------------------+
| Mailing        | Forum             |
+----------------+-------------------+

TaskID-2607467

Part-of: odoo/odoo#76930
2021-11-23 09:39:33 +00:00
Martin Trigaux a8e50921af [FIX] *: correct typos and English errors
closes odoo/odoo#80181

X-original-commit: efd178daee689192d4e930a075475587038b3e0d
Related: odoo/enterprise#22439
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-11-22 14:48:04 +00:00
Fabio Barbero 8467ad6518 [IMP] website_slide: change sample text
Purpose
=======
Make placeholder look more like sample text to avoid users confusing it
with actual text, add "Sample" ribbon to default course context to avoid
confusing some users.

Specifications
=============
Change default placeholder text, add css rule for placeholders in
website_slide to make the colour lighter and disappear on focus.

PR: odoo/odoo/pull/78845
Task-2674361

closes odoo/odoo#78845

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-17 15:52:15 +00:00
Thibault Delavallée 6908c475c5 [FIX] mail, survey, website_slides: fix logger usage
Make CI/Style happy even if not really related to this PR.

Task-2621326 (Mail: add 'view' button in 'light notification template')

Part-of: odoo/odoo#76418
2021-11-10 09:58:10 +00:00
Thibault Delavallée f9dbd38720 [IMP] mail, various: rename custom_layout / notif_layout context usage
RATIONALE

Currently we can specify email used for notification layouting through context
use in mail composer. It is then propagated to message_post, stored on
mail.message and used to encapsulate emails sent based on posted messages.

SPECIFICATIONS

On template model: rename ``notif_layout`` parameter of ``send_mail`` to
``email_layout_xmlid`` to be coherent with naming used in other parts of the
code. Moreover it better indicates we expect an xml id.

On rating model: rename ``notif_layout`` parameter of ``rating_send_request``
to ``email_layout_xmlid``, for the same reasons as above.

In various wizards: support ``email_layout_xmlid`` context key when no field
is available, notably because this is still done manually in some wizards
like survey invite. Keep a fallback on ``notif_layout`` but remove support of
``custom_layout`` deprecated since quite a long time.

Task-2621326 (Mail: add 'view' button in 'light notification template')
Task-2647302 (Mail: add layout field in composer)

Part-of: odoo/odoo#76418
2021-11-10 09:58:09 +00:00
Thomas Josse cbec2409a2 [ADD] website_sale_slides: add default course product
Purpose
=======
This commit adds a default product called "Access Course" to the
database when you have the `website_sale_slides` installed.

This commit also starts the transition for courses products
into `event ticket`-like products

Specifications
==============
This product is already created in order to help the users start to sell
their courses.

We also added a new type of product named `Courses`.
This will be used to create courses and easily work with courses products.

The commit adds the list of all the courses that the will gain access to
when he will buy the product inside of the cart and in the right column
whe it appears.

It also adds the same list when the product is inserted into a sales order.

The commit adds the choice of enroll policies in the front-end when
`website_sales_slides` is installed and of the corresponding product
if we are creating a paid course.

Task-2636092

closes odoo/odoo#77990

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-09 15:35:15 +00:00
Thomas Josse e83dfa4eb5 [IMP] website_(sale_)slides: clean frontend onboarding
Purpose
=======

Improve frontend onboarding: add placeholders, improve tour, improve experience
when buying course (display what has been bought, avoid displaying buy now on
an already purchased course).

Specifications
==============

The tour of the front-end has been updated. It adds a step to enter fullscreen
mode and allow users to test it.

It updates the placeholders for the quiz creation, adding examples and hints
to ease user filling fields.

The course purchasing flow has been improved. It adds a direct link to the
purchased course(s) when the payment is done with the `sale_purchased_course`
template.

It also blocks the possibility to rebuy a course if the user is already a
member of said course by showing the buying options only if `channel.is_member`
is False. INdeed it makes no sense to display the "Buy" button when having
already bought the course.

This commit also removes the autocompletion of fields in modals.

Task-2623471

closes odoo/odoo#77050

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-05 09:31:50 +00:00
Fabio Barbero 3f590e88fe [FIX] website_slides: fix traceback on granting access to course
Purpose
=======
Avoid getting a traceback when granting access to an event as a course
responsible.

Specifications
=============
Remove activity after making rpc in _onGrantAccess and _onRefuseAccess
in website_slides/static/src/components/activity/activity.js

PR: /pull/79075
Task-2676752

closes odoo/odoo#79098

X-original-commit: e98ebb5b97f9ce06b072d17de75e42142b11f775
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-27 19:23:51 +00:00
Nasreddin Boulif (bon) 6647d70f53 [FIX] website_slides: Don't set completion_time for encrypt/corrupt PDF
Steps to reproduce:

  - Install eLearning module
  - Go to eLearning, open course Basics of Gardening and edit it
  - Click on `How to Grow and Harvest The Best Strawberries | Basics`
  - Upload an encrypted PDF as Attachement

Issue:

  Traceback is raised :
  utils.PdfReadError("File has not been decrypted")

Cause:

  When trying to calculate `completion_time` to read pages, we try to
  get the number of pages of the pdf but an error will be raised if the
  pdf is encrypted.

Solution:

  If not possible to get number of pages, we dont set/update the
  completion_time.

opw-2612529

closes odoo/odoo#79017

X-original-commit: 8eac410996bd9813cf1972ac6e71560ddb582775
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-10-27 18:41:20 +00:00
Thomas Josse 63285ce026 [ADD] website_slides: merging slide.slide.link into resource
Purpose
=======
This commit is used to merge 2 models into 1: `slide.slide.resource`
and `slide.slide.link`

Specifications
==============
These models are merged in order to create a unique table for the
*Additional Resources* of a Content.

In order to do that, we merged the models into `slide.slide.resource`
that will contain either a link or a file.

task-2597345

See odoo/enterprise#20480
See odoo/upgrade#2784

Part-of: odoo/odoo#75646
2021-10-22 11:09:17 +00:00
Thomas Josse 91db19c187 [IMP] mass_mailing_slides / survey / website_forum / website_[sale_]slides_* : enhancing the views in eLearning
Purpose
=======
This commit is enhancing the website_slides module.

Specifications
==============
It changes placeholders for certain fields, it changes helpers in some
of the views.

It updates some of the main views of the menus and corrects wordings
inside of them.

It activates the Graph and Pivot views for the reporting of
Courses, Reviews and Quizzes.

It cleans up some of the measures inside of the Pivot and Graph views
of each menus where it is available.

It also merges 2 models: slide.slide.link and slide.slide.resource into
slide.slide.resource with a type Selection field.
This is done in order to create a single table for the additional
resources of a Content.

It also improves the front-end of the module with minor changes.
It fixes the problem of long names inside of breadcrumbs.
It also adds a message when there is no leaderboard in /profile/users.

task-2597345

See odoo/enterprise#20480
See odoo/upgrade#2784

Part-of: odoo/odoo#75646
2021-10-22 11:09:16 +00:00
prro-odoo 63e6a22205 [FIX] website_slides: build a correct form in Courses
How to reproduce the problem:
- Install the website_slides modules
- Go to the website -> Courses -> choose a course -> Add Content (Webpage)
- In the new Webpage -> Edit -> Drag and drop a Form Builder -> Save
The form is unusable: you can't write in the form's fields.

Cause of the problem : usefull attributes and values of the form were
removed due to the sanitizing of the HTML component.

Solution : the HTML components in slide are not sanitized anymore,
in order to keep valuable information for building forms.

opw-2588089

closes odoo/odoo#78155

X-original-commit: f783e23848986925937785aec82a616c4b237f16
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Signed-off-by: prro-odoo <proose@users.noreply.github.com>
2021-10-15 19:12:44 +00:00
Fabio Barbero 2d65d022d9 [IMP] website_slides: change confirmation messages for email
Purpose
=======
Clean up messages related to email verification.

Specification
=============
Rephrase messages, add confirmation of email sent and let user change
email.
Do not show "Validation Email sent" if the current user changed their
email address.

PR: https://github.com/odoo/odoo/pull/77617
Task-2647065

closes odoo/odoo#77617

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-10-12 11:44:40 +00:00
Martin Trigaux e132c36ee6 [I18N] *: export 15.0 source terms
closes odoo/odoo#77898

X-original-commit: ad5afb1d18661784bfcf51bca66e576de1f6c49b
Related: odoo/enterprise#21478
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-10-05 16:54:21 +00:00
b63ee52552 [FIX] *: remove scss 'extend' from dropdown components
This commit removes all the 'extend' initially introduced to avoid code
repetition and ensure visual consistency across Bootstrap and Owl dropdowns.

Despite achieving the desired results, using 'extend' in this context
was seriously impacting the bundle generation time, probably due to an
underestimated amount of Apps' legacy-code applied on these elements.

In order to achieve the same results, the chosen strategy is to add
Bootstrap default classes directly into Owl dropdowns.
Also, it moves code related to bootstrap dropdown in 'webclient.scss',
leaving 'core/dropdown/dropdown.scss' for Owl code only.

Due to the discrepancies between Bootstrap and Owl html
structure, the '.dropdown-item' class could not have been added
directly to Owl's '.o_dropdown_item' itself, without refactoring
the Dropdown component structure.

// ==== Bootstrap 4.6 default Structure ================================
<div class="dropdown-menu">
  <button class="dropdown-item" type="button">Action</button>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== OWL default Structure before this commit =======================
<ul class="o_dropdown_menu">
  <li class="o_dropdown_item">
     <span>Action</span>
  </li>
  <li class="o_dropdown_item">
     <a href="#">Another action</a>
  </li>
</ul>

// ==== OWL Structure after this commit ================================
<div class="o-dropdown--menu dropdown-menu">
  <span class="dropdown-item">Action</span>
  <a class="dropdown-item" href="#">Another action</a>
</div>

// ==== web.assets_backend.css Bundle Generation Comparison ============
With all modules installed (enterprise edition over runbot):
Before this commit, bundle took ~2.5s and ~4s to generate and weighted ~322kB (~2.5MB uncompressed)
After this commit, it takes between ~1.2s and ~1.6s and weights ~257kB (~1.6MB uncompressed)

closes odoo/odoo#77649

X-original-commit: 84715436d87bb05b421bc9ccaacda67d07571690
Related: odoo/enterprise#21370
Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Stefano Rigano <sri@odoo.com>
Co-authored-by: François Georis <fge@odoo.com>
Co-authored-by: Bruno Boi <boi@odoo.com>
2021-10-04 07:57:00 +00:00
Nicolas Bayet 4813f42997 [IMP] mail,*: replace jinja with qweb
Jinja as a templating engine was problematic in differents respect:
- introduce external dependency to Odoo (less controll)
- add another templating mechanism in the stack
- specific feature in qweb cannot be reused
- difficulty in rendering easily editable templates
- more knowledge required with no betterment

By replacing jinja with qweb we can now build tools to edit a qweb
that will work with the previously jinja encoded document
(essentially `mail.template` records).

There is a catch however. Some email fields (eg. email_to) used jinja
syntax for rendering dynamic variables (ie. ${object.something} and
${object.something_that_should_not_be_escaped | safe}).

We still want user to use dynamic variables for some char fields (eg.
subject, from, to, ...). We made a new rendering engine called
"inline_template" that will render an expression enclosed by `{{` and
`}}`.

To be able to edit the templates from the backend interface, a
plugin to the Odoo editor has been made for seamlessly edit the
document.

This qweb plugin includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
  (for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif, and t-else)
  in order to see only one at once
- a floating select input to switch visibility of a particular logical
  branching

Task-27033

X-original-commit: odoo/odoo@68182baff4
Part-of: odoo/odoo#77377
2021-09-28 23:42:54 +00:00
Martin Trigaux ef8ad324b0 [I18N] *: export 15.0 source terms
closes odoo/odoo#76542

X-original-commit: 63e6807437295519a0f4705fb88644d6d557ca3a
Related: odoo/enterprise#20882
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-09-16 07:17:40 +00:00
Nathan Marotte (nama) 77d6dff466 [FIX] website_slides : iframe code block appearing when pdfviewer loaded
Issue: When viewing a pdf in a website_slide, in certain conditions (
odoo detect the slide is externally embedded), a <iframe> code block
is displayed on the pdf rendering it really hard to read. As a work
around, one could click on the "<\> Embed" button to make it disapear

Steps to reproduce :
 1) Run a local odoo server with the website_slides module
 2) Set up a ngrox tunneling service to your localhost and good port
 3) Find or create a **document** slide and get its id (<slide_id>)
 4) Access the slide via the website url on the slide
 5) Go down the page in the Share tab and copy the iframe
  -Replace http by https in the src attribute of the iframe if necessary
 6) go back to the dashboard, open the inspector and add the iframe in
 the body of the webpage
 -> The slide is correctly detected as non embed
 7) Access your Odoo database with the ngrox https forward (example :
 https://0dfc-2a02-a03f-6b9b-b300-bd6c-8048-90f1-3f25.eu.ngrok.io)
 8) Repeat step 3 to 6 included
 -> The slide is detected as embed, so a <iframe> text area appears
 and make the pdf hard to read

Alternative steps to reproduce :
 1) Run a local odoo server with the website_slides module
 2) Go to the usual http://localhost:8069/ to access your database and
 navigate to a PDF slide in eLearning
 3) Change the localhost in the URL to 127.0.0.1 (Example
 http://localhost:8069/slides/slide/gardening-the-know-how-1 becomes
 http://127.0.0.1:8069/slides/slide/gardening-the-know-how-1) and press
 Enter to go to the new URL
 4) Change back the 127.0.0.1 to localhost and press Enter to go to the
 new URL
 5) You might have to repeat the back and forth between the two domains
 -> The slide is detected as embed, so a <iframe> text area appears
 and make the pdf hard to read

Why is that a bug:
 It makes the PDF unreadable unless we know that we must click on that
 button, it really shouldn't be like that

opw-2499110

closes odoo/odoo#76487

X-original-commit: cda27bc5535e0bb2a5191d89abf556d8c72025bd
Signed-off-by: Nathan Marotte <nmarotte@users.noreply.github.com>
2021-09-14 13:32:21 +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
Mathieu Duckerts-Antoine 7545913020 [REF] *: graph archs cleaning
We clean various graph archs taking into consideration that:
 - the default type of a graph is "bar".
 - a bar chart is by default stacked.
 - the field attributes type="row" and type="col" does not make sense for
   a graph view (since its implementation was separated from the pivot
   implementation a long time ago))
 - the boolean attributes should now take 1 or 0 as value (but the other
   values are accepted for retrocompatibility).

Part-of: odoo/odoo#76065
2021-09-07 15:50:14 +00:00
Mitul Shah 173b3001a4 [FIX] website_slides: avoid scroll while creating section during tour
Currently, during the slide tour, while adding 'Section' from the
website, the modal is opened, and the tour/bubble for this step is
added at the bottom of the input which introduces a vertical scrollbar
to this simple modal which looks ugly.

This commit removes this step (and thus bubble for input), and simply
provides a placeholder for this input.

And, for the section modal next step ('Save' button), we simply improve
the wordings of the message, which now asks the user to pick
a name for the section first.

The same issue also happens while uploading new 'Content' from the
website, and so to avoid scrollbar here, this commit also adds little
bottom margin for the anchor (so that there's enough space for tour
bubble).

Task-2616529

closes odoo/odoo#75976

X-original-commit: 7757c5bfd3c6ef760035bcae9cfda9c919fb773e
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-09-07 08:53:13 +00:00
Benoit Socias 9f9c4bb7e4 [IMP] website(_*): replace search callbacks by a mixin
Before this commit the `_search_get_detail` result contained callback
functions to handle special behavior during fetching and rendering.

After this commit a `website.searchable.mixin` is introduced that must
be inherited by models that participate in website-based searches.
Custom behavior previously achieved with callbacks is now achieved by
overloading methods of this mixin.

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

Part-of: odoo/odoo#65871
2021-09-03 06:59:33 +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
Sébastien Mottet (oms)andqsm-odoo 97b103dcd2 [FIX] website, *: fix conversion of specific svgs on Firefox
*: website_slides

A function allowing to convert a SVG to a PNG has been added as an
utility function in website.utils and is used for the upload of document
in website_slides. This function add support for a specific case which
was not supported by the previous conversion function used for the
document upload in website_slides: SVG without width and height
attributes on Firefox.

Related to task-2602521

closes odoo/odoo#75866

X-original-commit: b5ad8d66e311afcc30dae0ab62642e61ea74b156
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2021-09-02 04:41:54 +00:00
std-odoo cc012a0864 [IMP] mail, various: add email templates management levels
Purpose
=======

Purpose of this commit is to add a new group for the mail template designer.
Goal is to make roles clearer: managers edit templates, users use them. This
commit allow some designers / managers to make email template and to let
others users use those email templates.

Specifications
==============

When this feature is enabled in the Settings page, a new group is required to
modify email templates in a composer like wizard or to make dynamic content.
This allows to separate managers editing / composing templates from standard
users that use them.

If the current does not have this group, the email body will be in readonly
mode if he selected an email template. That way we force him to use the email
template that the manager made.

Technical
=========

New Group
---------

Only users in this group will be able to create / write email template or
to write Jinja code in the mail composer (including other fields like subject
in mailing).

By default, all internal users have this group. Mass mailing users also have
this group as writing mailings is about the same management level as writing
templates.

Mail Composer Mixin
-------------------

In comment mode, the template is rendered and then saved on the body field
so non-"Mail Template Editor" users can load email templates.

But in mass mode, the body of the template is saved and then rendered and
many things change the body (HTML sanitizer, web editor move inline CSS
properties, add / remove spaces...). So in this case, we can not know if
the user changed the body or not. That is why we put the body field in
readonly mode so, it is not modified by the web editor.

Jinja code detection
--------------------

To detect dynamic Jinja content, we compile the template, and we browse the
AST. If we do not have a single "Template Data" node, we assume that the
template is dynamic.

When we detect the template as static, we do not render it. That way we
avoid unnecessary rendering.

Code cleaning
-------------

Move Jinja import into tools so that it is outside of mail framework code.

Task-2187263

closes odoo/odoo#75840

Related: odoo/enterprise#20547
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-09-02 03:42:54 +00:00
Zelong Lin ab33ea0282 [FIX] website_slides: prevent crash due to incorrect import
task-2510656

closes odoo/odoo#75573

Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
2021-08-25 11:39:04 +00:00
Zelong Lin 51ff8b09db [REF] *: convert JS files to ES6 modules
* = hr, hr_holidays, sms, snailmail, website_livechat, account_invoice_extract,
approvals, documents, mail_enterprise, calendar, crm, mrp, note, website_slides,
crm_enterprise, sign, social, voip

task-2510656

closes odoo/odoo#72712

Related: odoo/enterprise#19241
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-08-24 14:31:55 +00:00