Commit Graph
1936 Commits
Author SHA1 Message Date
Louis (wil) 3f6f949fa5 [I18N] export sources
closes odoo/odoo#140002

Related: odoo/enterprise#49687
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-10-27 08:36:16 +00:00
Adrien Dieudonné e6c747b43b [REF] *: keyboard: replace deprecated charCode, keyCode and which properties
These properties are deprecated.

We should consider to use `KeyboardEvent.key` or `KeyboardEvent.code` for new code.
Note that we prefer to use the `key` property as multiple physical keys
can send the same value (e.g. Enter can also be sent by the numeric pad).
We should only use `code` when we explicitly want to target a single physical
key on the keyboard.

By doing this, we can now remove the dependency of `jQuery.ui.keyCode`
that was used as mapping of key code descriptions to their numeric values.

References:
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/charCode (deprecated)
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode (deprecated)
https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/which (deprecated)

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key

https://api.jqueryui.com/1.12/jQuery.ui.keyCode/

Some links that helps:
https://w3c.github.io/uievents/tools/key-event-viewer.html
https://www.toptal.com/developers/keycode/table

closes odoo/odoo#139809

Related: odoo/enterprise#49591
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-10-26 08:46:00 +00:00
Pierre Paridans 963842381e [IMP] web,*: replace ClipboardJS with Web API and homebrew polyfill
*: auth_totp_portal, mrp_subcontracting, project, survey, web_editor,
   website, website_links, website_sale_loyalty, website_slides, test_lint,
   spreadsheet

Implements missing `clipboard.write()` and `ClipboardItem` ; targets
only Firefox (which partially implements Clipboard API, features hidden
behind a preference flag).

Supported browsers: Chromium 76+, Safari 13.1+, Firefox 63+, Safari iOS
13.4+.

This allows to replace ClipboardJS by the native Clipboard Web API.

Reference:
https://caniuse.com/?search=clipboard
https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API
https://w3c.github.io/clipboard-apis/

task-3439226

closes odoo/odoo#134881

Related: odoo/enterprise#47154
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-10-26 07:22:54 +00:00
Chrysanthe (chgo) df8535fbd4 [REF] portal, *: portal redesign
*: base, account, account_payment, auth_top_portal, hr_timesheet, loyalty,
   mrp_subcontracting, payment, project, purchase, sale, sale_stock,
   sale_timesheet, website_crm_partner_assign, website_sale,
   website_slides

Portal general redesign. Increase visual consistencies with the backend
[1] and adapt to the new default website design [2].

[1] https://github.com/odoo/odoo/pull/116641
[2] https://github.com/odoo/odoo/pull/120302

task-3046004

Part-of: odoo/odoo#138077
2023-10-25 15:50:36 +00:00
Michael (mcm) fcb16a3b1b [IMP] *: remove guarded catch
This commit removes the promise extension which added the function
`guardedCatch`. It was used to filter server and connection errors from
javascript errors. Instead of using guardedCatch, we should use catch
and check if the reason is a server or connection error if needed and
re-throw the error if it's not handled.

closes odoo/odoo#137702

Task: 3439226
Related: odoo/enterprise#48451
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-25 15:50:34 +00:00
Shaan Thakkar (THSH) 4e7d383692 [FIX] website_slides: unwanted html text
How to reproduce:
=================
1. Open any course having quiz.
2. Select quiz content.
-> In the quiz template we can see that the html content is not sanitize.

Technical:
==========
I think the issue arises after this commit https://github.com/odoo/odoo/commit/0d7acf60b4cca84a8c700edd97af8c4de6b78010

After this commit:
==================
Now t-esc is deprecated and the HTML text is not sanitize in the template
so instead of t-esc we are using t-out.

Task-3555159

closes odoo/odoo#138873

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-10-25 11:37:30 +00:00
Xavier Morel 9ebbfdac73 [FIX] *: incorrect translations markings
Fixes a large number of cases where strings are translated then
formatted, instead of letting `_()` do the formatting internally,
which allows it to recover from incorrect translations (missing,
broken, or extra placeholders).

Also

- removes translation markers entirely when there's nothing to
  translate e.g. `_("%s - %s")` is not useful
- fixes a few messes which lead to only partial translatability
  (DRY is generally a bad idea when translations are involved, even
  more so when you don't make the variable part translatable)
- fixes a few nearby issues noticed at the same time
- replaces a few `"%s"` by `%r`, which should automatically quote
  strings relatively appropriately
- fixes translated strings which use `\` to escape a newline (in order
  to fill-paragraph): `\` escapes only the newline, if the
  continuation string is indented this results in a bunch of spaces
  ending in the string to translate, which is pretty garbage for the
  translator, using implicit concatenation works much better

Note: some of the updates revert f-string parameters to %, because
babel (2.9) apparently has trouble with f-strings and blows up trying
to extract them.

Not in scope:

Helping translators fix translatable strings e.g. any translation
string with more than one placeholder probably should use keyword
placeholders

- Provides more context / data to the translator to make sense of the
  sentence.
- Allows reordering the translated terms, which can be necessary
  depending on the sentence and language.

closes odoo/odoo#139314

Related: odoo/enterprise#49311
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2023-10-23 16:45:09 +00:00
FrancoisGe f91920a440 [REM] *: remove legacy/js/core from asset bundles
Several asset bundles have legacy/js/core files that they no longer use.
So we're going to remove them in this commit.

Part of task: 3439226

closes odoo/odoo#139423

Related: odoo/enterprise#49377
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-23 07:17:51 +00:00
Michael (mcm) 8cf98fbe67 [IMP] *: remove core.bus
This commit removes the legacy global bus (core bus) and the places
where it was used.
The main users of this bus were the public widgets, they now use the bus
on Component.env.
Some of the uses were dead code and has been removed.

closes odoo/odoo#139076

Task: 3439226
Related: odoo/enterprise#49131
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
2023-10-20 09:35:21 +00:00
Noe Antoine fae131e44c [IMP] website_slides: remove useless field slide_channel_all_ids
This field is not used at all. Remove it.

UPG PR: odoo/upgrade#5218
Task-3444633

closes odoo/odoo#130030

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-10-19 20:22:35 +00:00
Noe Antoine f2a2881e65 [IMP] website_slides: clean partner_all_ids field
Follow up of odoo/odoo#139104

After fixing the performance of ir rules, previously using
partner_all_ids on slide.channel, that field is not used
anymore except for tests. Adapt tests and remove it as well
as its search method.

Also adapt a search domain to use is_member field.

UPG PR: odoo/upgrade#5218
Task-3444633

Part-of: odoo/odoo#130030
2023-10-19 20:22:35 +00:00
Guillaume (gdi)andqsm-odoo c32e7b27fe [IMP] website, *: prevent abuse of h1 and use font size classes
*: website_event, website_forum, website_livechat, website_mass_mailing,
   website_slides

This commit permits to reduce the risk to have a wrong h1 tag or
multiple h1 tags on the same page. This commit replaces some h1 tags
with a h2 in snippets. In addition, this commit removes some font sizes
written in the style attribute and replaces them with a font size class
now that they are possible to use and edit as an user.

task-1958098

Part-of: odoo/odoo#129791
Co-authored-by: qsm-odoo <qsm@odoo.com>
2023-10-19 19:08:11 +00:00
Dossogne Bertrand b67dc64cea [FIX] *: remove populate call to random
*:
- hr_holidays
- resource
- website_slides

Before this commit, the populate files for the listed modules
were calling the random python library.
As we don't want non-deterministic populate, this import has
been changed to use the odoo Random tool which allows deterministic
randomization through seeds.
This commit also changes the way populate works for leaves in hr_holidays
so that they fit the current way of defining leaves.

closes odoo/odoo#139150

Related: odoo/enterprise#49162
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-10-19 17:01:16 +00:00
Noe Antoine bb1ea07920 [FIX] website_{forum_}slides: improve perf of logged_in rules
(Introduced in 16.3, 86c6266)

--- ISSUE

From there, partner_ids and partner_all_ids m2m fields became computed
fields in order to return only active records as we read them from
the slide.channel.partner table, not checking the active field of that
table (not supported by framework).

Ir rules of records check if current user's partner is inside partner_ids,
or partner_all_ids of a given course. (joined the course for partner_ids,
invited or joined the course for partner_all_ids)

The issue is that all ir rules searching on these fields lead to very
slow loading of slides (channel, slide, homepage) and forum pages (as
soon as we have a forum linked to a course). This comes from the fact
that in some templates, we read records and evaluate rules on the spot,
in python. (for instance tags of courses on homepage)

As some courses have tens of thousands of attendees, this evaluation is
very slow in python, and there is no quick solution at framework level.
Therefore, computing thousands of partners for each access rule linked
to a course is too slow.

--- SOLUTION

The existing fields is_member and is_member_invited are used inside ir
rules instead. _search methods are added and we check whether course
is inside courses of current user's partner ones. It improved all times
a lot, see BENCHMARK below.

Tests already exist to assert the search methods indirectly.

--- LOCAL BENCHMARK (16.3) - IntelCore i5-8265U CPU 1.60GHz - Firefox

ROUTE                                   BEFORE (s)        AFTER (s)
/slides                                 5                 <0.15
/slides/all                             7.6               <0.15
/slides/course_c                        4.2               <0.2
/forum                                  5.5               <0.15
/forum/forum_c                          6                 <0.25
/forum/forum_c/post_y                   4.4               <0.25
/forum/forum_c/post_y/edit_answer       2.5 + 2.5         <0.3 total
/forum/forum_c/post_y/edit              2.8               <0.2
/forum/forum_c/post_y/reply             3 (+6 post)       <0.35 total
/profile/user/id                        2.3               <0.4

DETAILS

- course_c: 43k attendees
- forum_c: forum of course_c
- post_y: 2-3 answers
- logged user: 'portal', with 7 courses
- deactivated GC cron as many populated invited attendees were
to be removed, and it can take a lot of time

    POPULATIONS

- 20k   forum.forum (avg 2 answers)
- 20k   mail.message (about 2 answers per post)
- 10    forum.forum (+20 on courses)
- 20    slide.channel (half 'members' visibility)
- 300k  slide.channel.partner
- 'large' for other models

--- LINKS

UPG PR: odoo/upgrade#5246
Task-3444633

closes odoo/odoo#139104

X-original-commit: 019d9d4808994cd819d13fab2d6ddfdffeb621e7
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-10-19 01:23:32 +00:00
FrancoisGe bb09cf76e3 [REF] *: remove legacy time.js
The purpose of this commit is to delete the legacy/js/core/time.js file.
We have therefore replaced all calls to time.js with the l10N/date.js utilities.

Part of task 3439226

closes odoo/odoo#138609

Related: odoo/enterprise#48918
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-18 08:56:06 +00:00
Brieuc-brd 538fdab99b [IMP] *: fine-tune app icons
The aim of this commit is to improve the impact and rendering of app
icons in bright and dark mode. It also reduces the size of svg files.

To achieve that, this commit updates the colors to flat colors. This
change will make the icons stand out and improve their readability.

task-3072562

X-original-commit: 667a19162b74fb6554a2389ba9c6e69de4ff5113
Part-of: odoo/odoo#138279
2023-10-16 09:21:17 +00:00
Michael (mcm) e062e6f483 [IMP] web,*: remove legacy env
This commit removes all the legacy envs (common_env, env, public_env)
as well as the files used to set up them.

task 3439226

closes odoo/odoo#138348

Related: odoo/enterprise#48781
Signed-off-by: Mathieu Duckerts-Antoine (dam) <dam@odoo.com>
2023-10-13 09:17:45 +00:00
Michael (mcm) 94824d8767 [IMP] *: remove legacy notification service mapper
This commit removes the mapper to the notification service and adapts
widgets that display notifications.

task 3439226

Part-of: odoo/odoo#138348
2023-10-13 09:17:45 +00:00
Aaron Bohy dc2be03dba [IMP] web,*: lazy load jSignature lib and extension
The jSignature lib is only used by the NameAndSignature component,
which is not accessible on a many screens. This commit thus
removes the lib and its extension from the bundles, and makes the
NameAndSignature component load it on demand.

Part of task~3439226

closes odoo/odoo#138054

Related: odoo/enterprise#48633
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-11 08:18:46 +00:00
Aaron Bohy 4bf1384e8b [REF] web,sale,portal: adapt SignatureForm to owl
This commit converts the SignatureForm widget into a Component.
This allows to remove the last usage of the legacy NameAndSignature
widget, which we thus remove.

Part of task~3439226

Part-of: odoo/odoo#138054
2023-10-11 08:18:46 +00:00
Nasreddin Boulif (bon) e22010ad89 [FIX] website_slides: hide suggested slides page slide when click prev
Step to reproduce:

  - Install `Elearning` module
  - Go to any course and a content as document
  - Upload a pdf with more than 1 page
  - Go to the website and click on the course then on the content with
    the document
  - Go to last page and click on next button (should display suggested
    slides page)
  - Click on previous button

Issue:

  Page displayed is not the last one, but the one before.

Cause:

  When clicking on the previous button, the current page is still the
  last page (just with the suggested slides page on top of it as
  overlay), and therefore will decrease it to the page number before
  last page (nb last page - 1).

Solution:

  When clicking on previous button, if we are on the suggested slides
  page (by checking if overlay is not hidden since no attribute is set
  on `EmbeddedViewer` to know if we are on that page), hide it.

opw-3482712

closes odoo/odoo#137644

X-original-commit: 422625615b2f6708667fa44d2a9e83ad3e66e5af
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
2023-10-10 08:19:29 +00:00
Romeo Fragomeli 5f454f0ccb [IMP] web,web_editor,website_slide: sortable service for frontend usage
This commit removes the module sortable from jQueryUI and adds instead a
sortable service to use the sortable code already used by the backend.

The service can be called using `this.call("sortable", ...)` and the
sortable listeners are added when the `enable` function is called.
This function (`enable()`) returns an object that contains the `cleanup`
function (`cleanup()`).

```javascript
// start / setup
const sortable = this.call(
    "sortable",
    "create",
    {
        ref: { el: document.querySelector(".list") },
        elements: ".items",
        handle: ".drag-icon",
    },
);

// on attach callback / on mounted
const sortableInstance = sortable.enable();

// on destroy / on willUnmount
sortableInstance.cleanup();
```

Also, it adds some new property to the useSortable:
* clone: the placeholder is a clone of the drag element
* placeholderClasses: classes added to the placeholder element
* applyChangeOnDrop: on drop the change is applied to the DOM
* followingElementClasses: classes added to the element following mouse

task-3439226

closes odoo/odoo#137527

Related: odoo/enterprise#48371
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2023-10-10 01:59:35 +00:00
Aaron Bohy daf05d48ac [IMP] *: views: deprecate active_* keys from evalContext
This commit aims to simplify the evaluation context used to
evaluate expressions used in views (invisible, required, readonly,
domain and context attributes). For now, the evaluation context is
typically the current record (there's a key for each field in the
view). In addition to that, there're static keys (that may conflict
with field names): uid, allowed_company_ids, current_company_id,
active_id, active_ids and active_model.

The motivation of this commit is at some point to get rid of the
3 active_* keys, because they are misleading and basically useless.

The notion of active_* exists, but it is something else: when you
are in a form view (let's say the form of a partner) and you open
its opportunities (by clicking on the stat button), the list view
of opportunies shows up and in the context, there're 3 keys
active_*, referring to the record from which we came. One can
easily access those information with context.get("active_*"), in
python or in view archs.

However, almost all `active_id` found in archs were actually used
to refer to the id of the current record. Indeed, for now, in the
evaluation context of a record, the value of the `active_id` key is
always the id of the record. So this commit adapts them to
directly use `id` instead. There was no use of active_ids, and
a single use of active_model which was removed (active_model is
the res_model of the view, so it isn't really necessary).

This commit doesn't drop the support of those keys, it deprecates
them. They will be removed for v18. A warning will be displayed if
they are used.

closes odoo/odoo#136665

Related: odoo/enterprise#47917
Signed-off-by: Raphael Collet <rco@odoo.com>
2023-10-10 00:54:04 +00:00
Guillaume (gdi) b3a1d0f9d0 [IMP] website, *: use BS mixin to have responsive font sizes
*: auth_totp_portal, event, portal_rating, web, web_tour, website_blog,
   website_event, website_event_booth, website_event_sale,
   website_event_track, website_event_track_quiz, website_payment,
   website_sale, website_sale_comparison, website_slides,
   website_twitter

This commit allows to have responsive font sizes on all the Odoo
frontend. It is based on the Bootstrap mixin `font-size` which
calculates the font size based on the viewport width.

task-1958098

closes odoo/odoo#129469

Related: odoo/design-themes#673
Related: odoo/enterprise#44578
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-10-08 22:12:13 +00:00
Aaron Bohy 9e46a8a58c [REF] web,*: remove owl.App.validateTarget override
The motivation of this commit was to remove the override of owl
that disables the validateTarget check, which we believed was
necessary for the renderToString function.

Fun fact: renderToString doesn't seem to need the override, as
validateTarget is only called when mounting an app and when
completing a fiber, which renderToString doesn't do. It was instead
probably necessary for the legacy compatibily layers that have now
been removed.

So this commit removes the validateTarget override.

This commit also simplifies the setup of the renderToString fn by
lazy creating the app itself, instead of requiring the application
setup to set the main app as renderToString app (e.g. main.js in
web).

Part of task~3508223

closes odoo/odoo#137807

Related: odoo/enterprise#48514
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-06 14:33:45 +00:00
Martin Trigaux 22ab49e343 [IMP] *: use file_path and file_open
Replace all the calls to get_resource_path to the better file_path or
directly use file_open when not needed

Doing both a get_resource_path and file_open means checking twice that
the file exists.
Doing a simple path concatenation before a file_open is safe.
If given to another method (e.g. etree.parse), calling file_path is
the prefered method.

Note that get_resource_path used to return False when the file does
not exists while file_path/file_open raises a FileNotFoundException

closes odoo/odoo#135607

Related: odoo/upgrade#5187
Related: odoo/enterprise#47475
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-10-06 14:33:43 +00:00
Thibault Delavallée c40053bc28 [IMP] test_mail: cleanup tracking tests
When possible, use '@users' decorator. Rename tests to better match their
main purpose, notably

  * test_mail_track*: mail_track specific (specific fields, display)
  * test_message_track*: overall behavior of 'message_track', notably subtypes,
    template usage, ...

Add some additional tests and improve test coverage, as some field types
were not covered (date, datetime, text notably). Improve currency
check for monetary fields.

Move 'mail.tracking.duration.mixin' tests into the file testing mixins
linked to 'mail.thread', rename the Case class according to current test
guidelines.

Also starting from now, `MailCommon` flushes tracking automatically at
setup time, allowing to remove some custom flush done in tests. That way
tests are less prone to non deterministic errors. This implies some changes
in execution of tests, which means some updated query counters notably.

Task-3345979 (Mail: Simplify tracking model)

Part-of: odoo/odoo#124182
2023-10-06 06:13:54 +00:00
Jorge Pinna Puissant ef424a9dc2 [REF] *: remove owl from linter's accepted global variables
Before this commit, owl was in the linter's accepted global variables.
This allowed  direct access to owl global object.

For instance, to use xml from owl, you could do :
`const { xml } = owl;`
or you could use it directly:
`owl.xml`

Now, owl is not accepted on linter's global variables anymore, so to
import xml, now you need to use a proper import:

`import { xml } from "@odoo/owl";`

task-id 3498859

closes odoo/odoo#137517

Related: odoo/enterprise#48364
Related: odoo/design-themes#709
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-10-05 10:21:53 +00:00
Jorge Pinna Puissant 006ee1fc47 [REF] web, *: remove legacy cookie utils and cookie service
The cookie service was replaced by a utils file in core. This was done
to be able to use the cookies without the need of environment.

"Om Nom Nom Nom" - Cookie Monster

part-of task-id 3439226

closes odoo/odoo#136782

Related: odoo/enterprise#48005
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-10-03 20:17:40 +00:00
Romain Estievenart adba68440b [IMP] *: remove jQuery.nested_sortable
task-3439226

closes odoo/odoo#136375

Related: odoo/enterprise#47807
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-10-03 19:20:06 +00:00
Alexandre Kühn b526078ae9 [REF] mail: set data immediately on discuss model relational field
With this commit, instead of `Record.insert()` before setting
relation with records, we can immediately pass record data.
For example:
```js
message.author = { id: 3, type: "partner", name: "Admin" };
thread.messages.add({ id: 10, body: "some-text-content" })
```

This is supported on all relational fields that define a target
model.

To make this work while drastically avoiding cyclic dependencies
in code, whenever data have to be inserted in relation, they are
pre-inserted with essential data, and then they are fully inserted
after being registered in the relation.

closes odoo/odoo#136539

Related: odoo/enterprise#47854
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-10-02 11:42:55 +00:00
Mayurrajsinh Rathod 68ddd3c3a0 [FIX] website_slides: prevent content title overflow
This commit resolves the issue of content title overflow in both fullscreen
and non-fullscreen views by cropping the title and adding '...' at the end.

Task-3384661

closes odoo/odoo#137112

X-original-commit: 2275279a74757d47b3138587793aef67f6b5e7ef
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-29 14:48:22 +00:00
Mahamadasif Ansari 3389bbafad [REM] *: remove owl="1" from the templates
As all the templates are now imported in the owl app, there is not need
anymore to specify the owl="1" attribute in the templates.

Ref-https://github.com/odoo/odoo/pull/130467

task-3508331

closes odoo/odoo#136920

Related: odoo/enterprise#48065
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-28 16:57:55 +00:00
Mayurrajsinh Rathod 9fc8492259 [FIX] website_slides: prevent content title overflow
This commit fixes the overflow of content title on without fullscreen view(Exit-
Fullscreen) of content page by cropping the title and adding  '...' at end.

Task-3384661

closes odoo/odoo#136939

X-original-commit: 09244c59f1681f9222abbbe347b24baacc8483b0
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-28 13:21:04 +00:00
Lopes Marc (loma) 2e5175919c [IMP] website_profile,*: specify reason for profile access denial
*: website_forum, website_slides

Purpose
=======

Website profiles of users like Mitchell Admin, which are set as "public",
are also rendered as "Private". In Fact, users can be denied access to
the public profile of other users for different reasons. In such
situations, users should get a more accurate feedback on the reason of
the access denial.

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

On profile access denial, give users a more accurate reason:

- "This profile is private!" when the profile is indeed private
or the karma of the user profile is equal to 0.

-"Not have enough karma to view other users' profile." when the profile
is public but the requesting user has insufficient karma rights.

Also:
- Redirect to the 404 page users trying to access a non-existing
profile.

Note: the minimum level of karma required to access a public profile is
now editable. See odoo/odoo#123411

Task-3360050

closes odoo/odoo#128686

Related: odoo/upgrade#4955
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2023-09-28 10:22:05 +00:00
Michael (mcm) 7422eb643c [IMP] *: remove legacy rpc
This commit removes the files ajax.js and rpc.js then adapts all the
places where their exports were used. For most of the changes, it's a
replace of `this._rpc({...})` by a new `useService("rpc|orm")` like
pattern in the widgets.

closes odoo/odoo#136271

Task: 3439226
Related: odoo/enterprise#47775
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-27 11:33:01 +00:00
std-odoo 91979b0fcf [IMP] http_routing, website_slides: redirect the user on /slides on AccessError
Purpose
=======
When a user tries to reach a course, an AccessError can occur when we
unslug the URL. Instead of the traditional error page, we want to
redirect the users to /slides, and the error will be displayed there.

Task-3477630

closes odoo/odoo#135926

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-25 09:38:33 +00:00
Shubham Thanki 6ca91cea77 [FIX] website_slides: update Vimeo description
Before this commit:
- Select a course from the website, and click 'Add Content'.
  From the 'Add Content' window, click 'Video'.
- The description with the title 'On Vimeo' is not up to date with
  Vimeo privacy management.

After this commit:
The description is now up to date.

task-3458724

closes odoo/odoo#136083

X-original-commit: 4a1d2a2726ce83edbf28dd478c60a3e6f67d4470
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-21 07:40:06 +00:00
Thibault Delavallée 8409ebe5fb [FIX] various: update query counters to runbot state
Update (some) query counters according to runbot state.

Also make some tests deterministic when involving company name.

Task-36879 (Mail: Support MultiCompany Aliases)

closes odoo/odoo#135288

Related: odoo/enterprise#47345
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-09-19 16:37:13 +00:00
Om Rabara d8ce53991f [FIX] website_slides: return the record for next_category
This error occurs when user tries to click on the checkbox to 'Mark as done'.

Steps to produce:
- Install the `website_slides` module.
- Go to Website > Courses > Open a course containing one or more sections
  (e.g., 'Taking care of Trees').
- Click on the `Add Content` button located at the bottom in blue.
- Select the video option and upload two videos, one after the other.
- Now, click the 'Mark as done' checkbox for the first video.
- When attempting to click the 'Mark as done' checkbox for the second video,
  the error will occur.

Error: AttributeError: 'int' object has no attribute 'id'

To solve this issue we have returned the record for `next_category`from that it
will get the record `id`.
Previously, this code returned an integer value, see here:
https://github.com/odoo/odoo/blob/f34d87ecb7772417f1dd8f3d8836c89ddb903de8/addons/website_slides/models/slide_slide.py#L1321
here we are using that return value from the above line
https://github.com/odoo/odoo/blob/69fca30bb4fb66e6d979ce5ddc1bff4db963ca71/addons/website_slides/controllers/main.py#L1062
Previously it gets the integer and try to get id of that integer value.

sentry-4414398591

closes odoo/odoo#135805

X-original-commit: 9cc11ef9a0f2025a717602fb2087b96eda5e8218
Signed-off-by: Achraf Ben Azzouz (abz) <abz@odoo.com>
2023-09-19 08:48:35 +00:00
Samuel Degueldre 4aaee61a5f [REF] website_slides: remove usage of legacy dialog to enroll
The Dialog widget is deprecated and will soon be removed, this commit
converts the usage of this dialog for the enroll buttons to use the new
dialog service.

To avoid duplicating the opening logic in the Quiz code, the selector of
the widget that opens the dialog now targets the #wrapwrap and uses
event delegation for the button, avoiding the need to manually spawn the
dialog for buttons added to the DOM after the first load.

closes odoo/odoo#135476

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-18 10:14:07 +00:00
thsh-odoo f115aa013b [FIX] website_slides: inaccurate completion time
How to reproduce the bug
=========================.
1. Open e-Learning.
2. Create a section.
3. Add a content in the created section and change the default duration .
-> New duration is not set and it is taking the default duration only

Technical
=========
https://github.com/odoo/odoo/commit/7b7fdf8f2771840797e1d416a8275ba3666ab542
This commit introduce the feature to set default time for the content in the
backend if user put the Duration field empty for that content but because of
the extra 'not' in the condition it was always getting true so every time
default value is stored and if completion_time is not there then it is set
to 0.

After this Commit
==================
Now whatever duration user will put, it will be set and if completion_time is
not given then it will give us the default time.

Task-3340462

closes odoo/odoo#135668

X-original-commit: 5cae7c3fa6f564a3f8d42cb255377cdc2ef86276
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
2023-09-18 08:46:58 +00:00
Sébastien Theys 7ea370fce7 [REF] mail, *: tests: refactor contains to further remove jQuery
* = account, base_iban, bus, calendar, crm_livechat, hr, hr_holidays,
    im_livechat, mrp, project, sms, snailmail, test_mail,
    test_mail_full, web, website_livechat, website_slides

Add support in `contains` for most operations that we use in tests.
Remove return value from `contains`.
Move into `web` module.
Remove import/export chains, directly import from correct module.

closes odoo/odoo#134652

Related: odoo/enterprise#47064
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-09-14 11:22:47 +00:00
Lopes Marc (loma) a23b9089ac [IMP] website_*: improve profile view
*= forum, profile, slides, slides_survey

Purpose
=======
Give users a better experience when browsing website profiles
looking for courses, certifications, forum questions, ...

Specifications
=============
Add search bars for Questions, Answers and Upvotes, small UI changes
here and there.

Task-2676848
Based on #79372

Co-authored by: Fabio Barbero <faba@odoo.com>

Part-of: odoo/odoo#129123
2023-09-11 22:41:03 +00:00
Aaron Bohy 0d7acf60b4 [REF] *: remove legacy Markup
Use owl.markup instead.

Part of task~3439226

closes odoo/odoo#134793

Related: odoo/enterprise#47124
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-11 19:13:59 +00:00
Géry Debongnie e0fdb6a0b4 [IMP] *: rewrite module loader
This commit rewrite the module loader to simplify it and to improve error handling.
before this commit, you could have silent errors or "lucky" imports (import a module based on the fact that his asset will surely be load and if not, the error would be silent anyway).
e.g.: The tours cannot import modules extern to tours' bundle anymore. Or load module before your libs in assets.

TASK ID: 3266021

closes odoo/odoo#128502

Related: odoo/enterprise#44100
Signed-off-by: Bastien Pierre (ipb) <ipb@odoo.com>
2023-09-08 16:47:56 +00:00
Nasreddin Boulif (bon) 707f6cb92e [FIX] website_slides: adjust member completion percentage
Steps to reproduce:

  - Install eLearning module
  - Create a course with 2 slides and publish them
  - Add a user as a member of the course
  - Complete the first slide
  - Add a new slide to the course and publish it
  - Go to course and click on `Attendees` stat button

Issue:

  The member completion percentage is not updated.

Cause:

  When (un)publishing a slide, only the current user that publish the
  course have his completion percentage updated.

Solution:

  When (un)publishing, (un)archiving, unlinking or creating slide(s)
  (slide must be published for the creation case), or when user mark
  slide as (un)completed manually, update the completion percentage of
  all members of the course except the members that already have
  completed the course.

  From version saas-16.3 we do not need the custom context key we
  introduced in 94e2dd2 because we will not update the completion
  percentage of members that have completed the course even if they
  manually mark a slide as uncompleted.

opw-3225707

closes odoo/odoo#134845

X-original-commit: 2796b3163c02306f1309e2dde764fff2f1b287cc
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Nasreddin Boulif (bon) <bon@odoo.com>
2023-09-08 13:45:43 +00:00
Michael (mcm) 36061a4ab0 [IMP] web: simplify owl_compatibility
This commit tried to remove owl_compatibility completely but its last
uses are either in refactoring or a bit complex to migrate. Instead of
removing the helpers completely, this commit simplifies them a lot and
makes them more readable and safe.

closes odoo/odoo#134295

Task: 3439226
Related: odoo/enterprise#46899
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-08 11:12:39 +00:00
Aaron Bohy dc680a4429 [REF] web,*: stop using and remove legacy utils
*account,web_editor,website,website_sale,website_slides

This commit removes all legacy utils except Markup, which will be
removed in another PR. A lot of those utils were no longer used and
thus have just been removed. Those that were still used either
already existed in the wowl codebase, so usecases have been adapted
to use the new version instead. A few have been re-implemented (or
moved basically) to the wowl codebase (e.g. isEmail and humanSize).

Part of task~3439226

closes odoo/odoo#134620

Related: odoo/enterprise#47044
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-08 08:29:58 +00:00
Pierre Pulinckx (pipu) 6996b8a673 [REF] *:replace moment usages with luxon
luxon and moment are both used in the solution, but these two libraries
facilitate the manipulation of dates. It was decided to replace all uses of
moment with luxon so we can then remove moment.js from the code and lighten the
assets.

task-3391739

closes odoo/odoo#134470

Related: odoo/enterprise#46987
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-09-07 05:56:01 +00:00