Commit Graph
197 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
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
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
Bastien PIERRE 65242e31e9 [IMP] *: Remove alias in JS files
Rename all imports with alias old system to the new js module system
Task ID: 3266759

closes odoo/odoo#127414

Related: odoo/design-themes#671
Related: odoo/enterprise#43716
Signed-off-by: Bastien Pierre (ipb) <ipb@odoo.com>
2023-07-27 11:58:34 +02:00
Nicolas Bayet d7245d2abf [REF] web_editor,*: convert wysiwyg to owl
The goal of this commit is to remove all dependency to legacy in the
wysiwyg because the wysiwyg has to be loaded on a lot of form view
(through the html_field).

To remove the dependencies, all the legacy widget that the wysiwyg
uses had to be converted to owl. In order to finish the PR faster,
only a partial conversion of the widgets is done, changing only the
part of the code that was necessary for it to work instead of
rewriting the whole widget from scratch. Another pass should be done
to convert all those widgets to fully embrace the owl paradigm.

task-3175256

Part-of: odoo/odoo#118966
2023-07-19 11:39:44 +02:00
Elisabeth DickinsonandFlorian Charlier 21531bd9b9 [IMP] website_forum, *: redesign forum's frontend
* = website_slides_forum, website_mail, website_profile

In `website_(slides)_forum`:
All forums page:
Course forums are displayed on the same level as regular forums (with
a tag "Course" to differentiate them).
We don't see this page if there is only one forum.

This new design resembles that of Discourse with a table for the list
of questions and a sidebar on the left.

Other pages such as the Tags, FAQ, and Moderation pages have also been
revamped. Some of the functionality comes in the following commits.

Notes: The table rows have been made fully clickable, but by doing so
other clickable or hoverable elements lose their function.
In order to counteract this, a `position-relative` and
`z-index-1` classes are added to them.

The image_url definition wasn't working properly: When a user didn't have
and avatar, a placeholder with their initial is generated. But it did
not take the size option defined in the widget. This has been
corrected by changing it to `request.website.image_url(...)`

In the posts' page, the answer box now comes up from the bottom of the
screen.

In the FAQ pages, the accordion has been replaced by BS accordion
component using `accordion-item` instead of cards. The web editor
however is still using the old system.

In `website_mail`:
A new template for the follow button has been created in order to
redesign it for the forum without disrupting this element in other
modules (ie: website_mail, blog).

Task-3083657
Part of Task-3316555

Part-of: odoo/odoo#123709
Co-authored-by: Florian Charlier <flch@odoo.com>
2023-07-18 16:58:43 +02:00
niyasraphy 538f9222e1 [IMP] website_profile: add karma_profile_min field to view
before this commit, currently the field karma_profile_min
field in website model is not added in any views and
the default value set for the field is 150, as it is
not added in any views, the end users have no option to
change the value of this field.

this field value is used in _check_user_profile_access
function and thus the non logged in users or logged in
users with karma less than 150(default value) is not
able to open any public profiles.

after this commit, end users is not able to change
the default value set for the field and also default
value is changed to 0.

closes odoo/odoo#123411

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-07-14 15:34:41 +02:00
niyasraphy 13f39faccf [FIX] website_{}: show correct placeholder in search bar
before this commit, in the mobile view, in the search bar
of the website users(forum) and events leader board,
the placeholder is shown as Search courses

after this commit, the wrong placeholder will be updated
to Search users in the placeholder as in the normal view.

closes odoo/odoo#125636

X-original-commit: b54f4387812ea20de42e56c22fa90b4a26b6a11e
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Hennecart Jérémy (jeh) <jeh@odoo.com>
2023-06-19 23:17:01 +02:00
Martin Trigaux 2afdda2576 [I18N] *: export saas-16.3 source terms
closes odoo/odoo#123046

X-original-commit: 137f5ca0cb703ee953cb01db525362f7a778e6bd
Related: odoo/enterprise#41703
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-06-01 11:43:51 +02:00
Louis Wicket (wil) 04189318cc [I18N] *: update master translations
Currently, only stable releases see their translations updated. This has
resulted in master accumulating outdated stuff for years, which can be
confusing for users testing master on runbot.

This one-shot commit resynchronizes master translations based on the
content from 16.0 and removes empty PO files (i.e. no longer containing
translations).

closes odoo/odoo#121629

Related: odoo/enterprise#41171
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-05-22 17:52:07 +02:00
Martin Trigaux 077bbd0b0b [I18N] *: export master source terms
closes odoo/odoo#121563

Related: odoo/enterprise#41140
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2023-05-17 10:34:00 +02:00
Brieuc-brd 418413e499 [IMP] web, *: directional icons
This commit adapts the directional icons to improve the usability and
maintain consistency with the ui icons library.

task-2818586

Part-of: odoo/odoo#116641
2023-05-12 22:59:22 +02:00
amdi-odoo cda43b6076 [FIX] website_profile: fix rank image display
Fix the rank image display which has currently
disappear by making it appear again in the xp circle.
Also making sure the xp circle tooltip is correctly
showing on hover.

Task-3285548

closes odoo/odoo#120408

X-original-commit: e96bd5a7ee4397440503ab4605f2df29d3a2d6f2
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-05-03 13:57:27 +02:00
Renaud Thiry 87b0189ff1 [IMP] mail: remove default logo
Many templates use the company logo that is set by default on
database creation. As that logo is clearly a placeholder and the user
isn't necesserely prompted to update it. It's possible for a user to
inadvertently start sending emails with "your logo" placeholders
plastered all over.

This removes the default logo of the company and removes it from
templates conditionally.

The logo isn't simply replaced with a transparent PNG as the templates
set a fixed height for the logo, which would look weird.

task-3067315

Part-of: odoo/odoo#106307
2023-04-24 10:20:12 +02:00
niyasraphy 7eb3f91777 [IMP] website_profile: change badge decoration with xp
Before this commit, if an user receives an increase or decrease in the XP,
both are currently shown with success badge (green).

After this commit, if there is decrease in user XP, it will be shown with
warning badge (orange).

closes odoo/odoo#118068

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-04-12 14:02:35 +02:00
niyasraphy 85fc6e09d8 [FIX] website_profile: remove duplicated import in init
before this commit, the controllers directory is
imported twice in the init file.

after this commit, the duplicated import is
removed.

closes odoo/odoo#118105

X-original-commit: 3496c25b677dfe8695b00cea0cd5eff095941321
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-04-11 09:21:19 +02:00
niyasraphy 93527d58bb [FIX] website_profile: show + only when gained karma is positive
Before this commit, in the website profile frontend, if we filter the users
using 'This week' or 'This month' filters we always get a '+' displayed before
the karma gain.

If user gained negative karma, lets say -500, currently it displays as follows
--> +-500 , instead of -500.

After this commit, if the gained karma during the period is it will show
-500 instead of +-500.

closes odoo/odoo#117548

X-original-commit: 53b406bcf92e50e62329f1b128742bd851d22cb0
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-04-04 12:11:00 +02:00
Michael (mcm) ff0d6dd580 [REF] *: replace odoo module by native one
This commit converts almost all odoo module by native module.
The goal is to deprecate odoo.define in favor of native module and then
simplify boot.js by removing the regexp that finds module dependencies.

task id: 3162300

closes odoo/odoo#117305

Related: odoo/enterprise#39118
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-03 17:07:24 +02:00
Louis Wicket (wil) 0c53d28133 [IMP] *: remove "French spacing"
According to Wiktionary, French spacing is "the archaic practice (though
still current in French) of inserting a space around colons, semicolons,
question marks, and exclamation marks". This is not standard practice in
English and most languages of the world.

The purpose of this commit is to start purging the code from this typo,
as it may reflect poorly on the software for some people.

closes odoo/odoo#116167

Related: odoo/enterprise#38542
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-03-24 12:50:13 +01:00
amdi-odoo 9bbe43c47f [IMP] website_profile: change alert closing icons
Purpose
=======
Change the current alert banner closing icons
(a "x" in a gray box) by the new good-looking
bootstrap 5 closing button.

Task-3222588

closes odoo/odoo#115424

X-original-commit: 6f83f60f2f0d031c15df5c3b450fb583feaea3b9
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2023-03-16 09:37:08 +01:00
Guillaume (gdi) 2aaca97c75 [FIX] website_profile: prevent losing search params
Before this commit, the "rank by" parameter was deleted when a visitor
added a search criteria. This commit solves this problem.

Steps to reproduce the issue:
- Go to "/profile/users"
- Click on "Rank by" and select "This week"
- Search for a user (e.g. "admin")

=> The "rank by" parameter is lost and if you click on "This week"
again, the search (admin) will be lost.

task-3058239

closes odoo/odoo#114253

X-original-commit: eed9e3d8c1366f457d2f3170741c09ab2143d912
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-03-03 15:56:49 +01:00
Guillaume (gdi) 0314ce8b21 [FIX] website_profile: make the pager work when searching
Before this commit, following these steps:
- Have more than 30 users
- Go to /profile/users/
- Search for a letter that is in the +30 users names
- Go to the second page of search results

=> We lose the filtering of the users by the letter. This commit allows
to keep the filters when the user is on a result page and changes page.

task-3058239

X-original-commit: dbd52ed56bff2889b0d64b04314e61ff25a6e9c8
Part-of: odoo/odoo#114253
2023-03-03 15:56:48 +01:00
niyasraphy 0a6a901208 [IMP] website_profile: remove italic style from email
before this commit, when a verification email is
send to the user when validating the website user
profile, there is no spacing/overlapping between
the email(in italic) and !

after this commit as the italic is removed from
the email, there will be proper
spacing(no overlapping)

closes odoo/odoo#114073

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-03-02 16:01:08 +01:00
niyasraphy f8464c01bd [FIX] website_profile: correctly display tabs in website user profile
Before this commit, opening a user profile in website does not show the
tabs like About, Questions, Answers, Activity, Votes.

After this commit, it will display all the tabs in user profile.

closes odoo/odoo#112695

X-original-commit: 44cd55b5df3a08ae24e86796c69ab361f4f53fe4
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2023-02-14 18:11:50 +01:00
Martin Trigaux fde3f4d4b9 [I18N] *: export 16.0 source terms
closes odoo/odoo#102163

X-original-commit: 011d7aac5aacedb3ab373f247471ba69d67f50f3
Related: odoo/enterprise#32288
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-10-06 14:56:52 +02:00
Dossogne Bertrand 7c4da16b59 [IMP] mail, various: improve mail template usability
Allow our users to modify mail template more easily

- make the list accessible from the settings
- give them a link to update relevant views to update header/footer
- make the list and form of templates more readable
- add a description on templates, allowing to describe their usage

In order to better filter templates, a new category field is added that
is computed based on active flag, description being set and the template
having an xml ID. Master templates are active, with a description and an
xml ID.

Update master data to add description on some templates.

task-2944770

closes odoo/odoo#101730

X-original-commit: dfa867343ee8842f3f127ac62584fd471b41dde1
Related: odoo/enterprise#32079
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-10-04 09:55:46 +02:00
Umesh Gupta bc0716e767 [IMP] website_{slides, profile}: improve karma card and misc usability
Currently, there are severlar issues with the karma card, like:
1/ improve karma display
2/ images of the rank and badges are can be changed by user, but
   after saving the changes are discarded

Apart from that, in the course navbar, the hard-coded white
text color is given, due to which in some themes the text
becomes invisible. And in the courses cards below navbar,
the course title is not editable.

This commit improves the following points:

1/ Makes the next rank card (on course home page) a bit bigger, adds a
   tooltip on the progress bar that shows gained xp out of minimum xp
   needed for next rank (ex: "2500/10000 xp") if there is next rank,
   and improves the text below rank image that now shows xp to gain for
   next rank or if there isn't next rank, simply displays the earned xp.
2/ Makes the images editable (in karma card as well as in the
   user profile and in '/profile/ranks_badges' page)
3/ Makes the rank title editable
4/ Removes the hard-coded white text color from the course
   navbar and make the course title editable

taskID-2853264

closes odoo/odoo#92871

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-09-27 13:48:42 +02:00
Martin Trigaux 1a8772769e [I18N] *: export 16.0 source terms
closes odoo/odoo#100573

Related: odoo/enterprise#31507
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2022-09-20 13:48:49 +02:00
Romain Estievenart 98a97d0fea [IMP] *: removes .form-group
this commit removes the usage of .form-group class which is deprecated
since BS5.

Here is the css rules that was used:

a) https://github.com/twbs/bootstrap/blob/8fa0d3010112dca5dd6dd501173415856001ba8b/dist/css/bootstrap.css#L1997
As we can see, it simply adds a `margin-bottom` of `1rem` which
corresponds to the `.mb-3` BS class.

b) https://github.com/twbs/bootstrap/blob/8fa0d3010112dca5dd6dd501173415856001ba8b/dist/css/bootstrap.css#L2326
As we already checked all `form-inline` in [1] and [2], we don't have to
do anything about these rules.

'''Breaking change: Dropped form-specific layout classes for our grid
system.
Use our grid and utilities instead of .form-group, .form-row, or
.form-inline.'''

https://getbootstrap.com/docs/5.0/migration/#forms

Notes:
- `position: relative` is already on `#new-password-group`.
- `.field-db`, `#editor-media-image`, `.unsplash_img_container` and
`#url-form-group` seems unused.
- Sometimes margins are unnecessary because of blocks overlapping.
  (e.g. `margin-bottom` is not needed if margin-top is set on the
  following node)
- CSS rules applied on `.s_website_form_rows > .form-group` are now in
the XML by adding `mb-0 py-2` BS classes.

Follow-up of:
[1] https://github.com/odoo/odoo/pull/97967
[2] https://github.com/odoo/enterprise/pull/30343

closes odoo/odoo#100052

Related: odoo/enterprise#31261
Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-09-16 20:51:56 +02:00
Romain Derie 5456dc499a [IMP] website, *: rename group publisher to restricted_editor
* portal, web_unsplash, website_*

This commit renames the `website.group_website_publisher` into
`website.group_website_restricted_editor`.

While the change in itself might look unuseful, it will help the dev and
tech community figuring which group is related to which feature.

Even internally when we discuss specs, we always have to remind which
group is the restricted editor: the publisher one or the designer one?

While it is probably, after all those years, now anchored in some dev
mind, there is no easy way to directly figure which of those 2 groups is
the restricted editor one.
Note that I myself always got confused about it.

Now, the "Restricted Editor" right will be reflected in its technical
name `group_website_restricted_editor`.
Same as for the "Editor & Designer" which technical name is
`group_website_designer`.

As we would like to have a fully working and ready system in v17 for the
community to be able to build themes easily, removing that dubious part
is a nice to have.

Part-of: odoo/odoo#98200
2022-08-31 23:50:06 +02:00
Romain Estievenart 36628c9b1c [FIX] *: removes .form-inline
this commit removes the usage of .form-inline class which is deprecated
since BS5.

here is the css rules that was used:
https://github.com/twbs/bootstrap/blob/8fa0d3010112dca5dd6dd501173415856001ba8b/dist/css/bootstrap.css#L2303

'''Breaking change: Dropped form-specific layout classes for our grid
system.
Use our grid and utilities instead of .form-group, .form-row, or
.form-inline.'''

https://getbootstrap.com/docs/5.0/migration/#forms

We also took the opportunity to remove some .input-group-append and
.form-group. We are currently working to remove all of them.

Part-of: odoo/odoo#97967
2022-08-16 09:19:08 +02:00
Julien Banken 21d1b99f2f [IMP] website_slides_survey: add certification attempts tab on user profile
This new commit will add a new tab on the user profile that will list
the certifications attempts made a given user. With this new tab, the
administrators can get a quick overview of the user activity.

task-2679881

closes odoo/odoo#81057

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-08-12 11:28:40 +02:00
Romeo Fragomeli 1fcd098af5 [REF] *: BS5: migration
Automated change made by a lot of RegEx to change all think that is
possible to automate.

https://getbootstrap.com/docs/5.1/migration

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Romeo Fragomeli 9b5c9484fe [REF] *: BS5: adapt changes in media query mixin
> Media query mixins parameters have changed for a more logical approach

> media-breakpoint-down() uses the breakpoint itself instead of the next
> breakpoint (e.g., media-breakpoint-down(lg) instead of
> media-breakpoint-down(md) targets viewports smaller than lg).
> Similarly, the second parameter in media-breakpoint-between() also
> uses the breakpoint itself instead of the next breakpoint (e.g.,
> media-between(sm, lg) instead of media-breakpoint-between(sm, md)
> targets viewports between sm and lg).

https://getbootstrap.com/docs/5.1/migration/#sass

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:24 +02:00
Romeo Fragomeli 23c3a31a0d [REF] *: BS5: removal of .media class
https://getbootstrap.com/docs/5.1/migration/#grid-updates
https://getbootstrap.com/docs/5.1/utilities/flex/#media-object
https://github.com/twbs/bootstrap/pull/28265

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:19 +02:00
Romeo Fragomeli 9ea1351334 [REF] *: BS5: Migrate forms and inputs
- BS5 uses native inputs instead of pseudo-element for some
  input like checkbox, radio, ...
  in BS5 input checkbox don't have "virtual visual" checkbox anymore
  (::before), so we remove the relative's rules

- removed `.custom-control` class

- `form-switch` use a new layout system in BS5 we adapt the code to
  match the Bootstrap approach (inline SVG).

- In tests, we don't check the exact value of the background as it
  change in community/enterprise, and it's difficult to check the value
  of an SVG.

- Overflow in progressbar is now hidden.
  -> we had to restore it.

- In BS5 margins in forms/inputs has been changed
  -> we had to restore it (e.g. 'mb-3')

- .form-group, .form-row, .form-inline
> Dropped form-specific layout classes for our grid system.
> Use our grid and utilities instead of .form-group, .form-row,
> or .form-inline.

- .input-group-append and .input-group-prepend
> Dropped .input-group-append and .input-group-prepend.
> You can now just add buttons and .input-group-text as direct
> children of the input groups.

Ref:
[1] https://getbootstrap.com/docs/5.1/migration/#forms

Task ID: 2766483

Part-of: odoo/odoo#95450
2022-07-07 13:30:18 +02:00
Romeo FragomeliandStefano Rigano 41eebf822b [REF] *: BS5: handle contrast color
The logic not identical in BS4 -> BS5
The color contrast system in BS5 relies on WCAG 2.0 contrast algo.
So color-yiq is converted to color-contrast.
Note that there are some "texts/buttons/other visuals" elements
which will not have the same contrast as before.

$yiq-text-dark and $yiq-text-light are respectively replaced with
$color-contrast-dark and $color-contrast-light.

Note that we had to use '$min-contrast-ratio: 2.2' for .o_tag_color_X badge.

Task ID: 2766483

Part-of: odoo/odoo#95450
Co-authored-by: Stefano Rigano <sri@odoo.com>
2022-07-07 13:30:17 +02:00
Julien Castiaux da8def8e41 [IMP] core, web: Delegate delivery of static files
Rationnals
----------

Web servers can serve some resources (e.g. static files) right away
without any interaction with the web application. The network model of
most web servers makes them capable of handling thousands of
simultaneous requests when it comes to intensive IO operations such as
streaming data from a file. The network model of Odoo is different: it
is capable of a lot of processing power but can only serve a handful of
requests at a time, i.e. Odoo (with some help from postgres) is
optimized for CPU operations, not IO.

Some users don't configure their web server, they use a basic
configuration that relay all requests to Odoo. The result is that many
Odoo HTTP Workers can be busy streaming static files instead of
processing other requests. This can lead to a worker starvation, i.e.
all workers are busy streaming files and cannot process new requests.

X-Sendfile
----------

In this work, we add the support for the [X-Sendfile] header family,
they are multiples http headers that can be used by the web application
to communicate with the web server in order to delegate the delivery of
files stored on the file system. Odoo still receives the request but it
does no more stream the file content from within its HTTP worker,
instead it skips the response body altogether and sets the `X-Sendfile`
special header with the path of the file on the filesystem. The web
server intercepts that special header, open the file and stream it.

Using those headers, we can use the best of both the web application and
the web server. The web application is still responsible to locate the
resource and verify the access rights, the web server is still
responsible of streaming the content.

Using X-Sendfile is opt-in via the `--x-sendfile` CLI flag. We set both
`X-Sendfile` (apache) and `X-Accel-Redirect` (nginx). If you are using
apache, make sure `mod_xsendfile` is enabled. If you are using NGINX
you have to add the following location block:

    location /web/filestore {  # custom path, hardcoded within Odoo
        # Prevent access from the outside world, i.e. makes this
        # route only accessible via X-Accel. MANDATORY!!!
        internal;

        # Give access to the filestore using this server's
        # permissions. Odoo is in charge of verifying the access
        # rights.
        alias /path/to/odoo/data-dir/filestore;
    }

The Odoo [deployment documentation] has been updated accordingly.

[X-Sendfile]: https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile/
[deployment documentation]: https://www.odoo.com/documentation/master/administration/install/deploy.html#serving-static-files-and-attachments

Changes to the API
------------------

To benefit most from X-Sendfile, all APIs related to streaming content
over HTTP has to be adapted. They are: (1) `request._serve_static`,
(2) `ir.http._serve_fallback`, (3) `/web/content` and (4) `/web/image`.

Each used it own way to deliver content: (1) `_serve_static` was using
`send_file` (flask's send_file that as been vendored with odoo 10
years ago and not maintenained since then), (2) _serve_fallback was
handcrafting a `werkzeug.wrappers.Response`, (3) /web/content-image were
using the "binary server" `ir.http.binary_content` API.

I has been decided to remove all 3 APIs and to merge the code inside of
the new `http.Stream` object and the `ir.binary` helper model.

A Stream wraps what is going to be sent to the browser, it can be a path
to a file on the locale filesystem, a blob of raw data or an URL to an
external resource. The Stream also holds various metadata that are
mainly used for caching. The preferred way to create a Stream is via one
of its three factories so that all the metadata are set. The factories
are: `from_path`, `from_attachment` and `from_binary_field`. A stream
instance exposes a single method `get_response()` used to create the
corresponding HTTP response object out of the stream.

Inside of `ir.http` were a few methods that were not related to the http
routing and formed what was called the "binary server". All those
methods have been removed and the feature have been refactored inside of
the new `ir.binary` model. The removed methods are:

- `_xmlid_to_obj`
- `_get_record_and_check`
- `_binary_ir_attachment_redirect_content`
- `_binary_record_content`
- `_binary_set_headers`
- `binary_content`
- `_response_by_status`
- `_get_content_common`
- `_content_image`
- `_content_image_get_response`
- `_placeholder_image_get_response`

The new `ir.binary` abstract model exposes the following utilities:

**`_find_record`**

Find an attachment or a record with a binary-field out of an xmlid or
out of a pair record-model/record-id. Check the access rights and the
access token.

**`_get_stream_from`**

Create a Stream from an attachment or a record with a binary-field.

**`_get_image_stream_from`**

Same as `_get_stream_from` but adapted for images. It sets a sensible
ETag on the stream and has image resizing support.

**`_placeholder`**

Get the image placeholder blob.

Testing
-------

It is possible to test the web server configuration using the
`test_http` module. Install the module then run the unittest using the
`webserver` test-tag. By default it attempts to connect to a web-server
running on `http://localhost:80`, you can change this URL by setting the
`WEB_SERVER_URL` environment variable.

    odoo-bin -i test_http --stop-after-init
    WEB_SERVER_URL='http://localhost:80' odoo-bin --test-tags webserver --stop-after-init

closes odoo/odoo#88134

Task: 2801675
Related: odoo/documentation#2083
Related: odoo/enterprise#26191
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-06-01 02:53:59 +02:00
MAHAMADASIF ANSARI 1e2d8cf44a [IMP] base: website_profile: improve the rank layout
Currently if a user is having huge number of karma/xp (for example
10000), when viewing the website profile, these numbers overlap the
design of a next rank layout card.

This commit formats the karma/xp into decimal number (allowing up
to two decimal points so that the information is meaningful) and
thus reducing the space being occupied by large numbers.

task-2792149

Part-of: odoo/odoo#87996
2022-05-04 17:46:12 +02:00
Victor Feyens 42bad1a6d2 [IMP] *: remove useless keys from manifests
Remove most values uselessly specified because giving the same value as 
the default one (see _DEFAULT_MANIFEST in odoo/modules/module.py)

* auto_install is Falsy by default
* author is Odoo SA by default
* summary & description are empty strings by default
* application is False by default
* test, demo, depends and data are empty lists by default

This will reduce noise/inconsistencies between manifests specifications, 
simplify analysis of manifests content, ...

closes odoo/odoo#90209

Related: odoo/enterprise#26807
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2022-05-03 13:31:16 +02:00
MAHAMADASIF ANSARI f89172974c [FIX] website_{profile,slides}: fix the rank layout
In the current layout that displays user rank in the website profile,
the image overlaps content so the information is not fully readable.

This happens due to wrong value being set as a variable with q-web
directive.

With a recent refactoring (see commit[1]), the `_compile_format`
method replaces % into %%. So in our case, we are trying to set the
width in % (for ex 50%) which is parsed by qweb and converted into
50%%, and thus the CSS property is not applied correctly.

This commit fixes the issue by using `t-value` instead of `t-valuef to
avoid the string formatting related parsing, and thus making sure
that the proper css property is applied.

commit[1] - https://github.com/odoo/odoo/commit/e830953570d5f28aee9bdcdf97af18d3e3246030
task-2792149

closes odoo/odoo#90150

X-original-commit: 97628ef8b5998de546bac44d138ebf5b8a3a43ec
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-04-29 15:26:07 +02:00
Jorge Pinna Puissant bc20eb4790 [IMP] test_lint, *: enable no-unused-vars rule
Part-of: odoo/odoo#85569
2022-03-02 13:05:42 +00:00
Fabien Pinckaers 6b87526048 [IMP] Speed Imp: remove unnecessary base64 encode & decode
Avoid to base64 encode, then decode to process assets and images for a ~25% speed improvement.
Change image processing tool to work on images, rather than base64 encoded strings.

Performance is ~25% faster on assets & images:

  /web/assets/...frontend.min.css:    13ms to 7ms,  base64 enc/dec: 2 -> 0
  /web/image/XML_ID:                  10ms to 8ms,  base64 enc/dec: 3 -> 0
  /web/image/res.users/2/avatar_128:  40ms to 20ms, base64 enc/dec: 6 -> 2

closes odoo/odoo#82851

Related: odoo/enterprise#23537
Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-01-22 11:51:42 +00:00
Martin Trigaux 4107d17b01 [FIX] website_profile,forum: avoid relative links
The origin parameter must be an absolute link (starting with a /)
To be consistent and always have a leading slash (and avoid relative
links if the developer forgot to add a leading slash)
2021-12-20 11:39:03 +01: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
Thomas Josse 255cdfe4f6 [IMP] website_profile: improve profile display when no leaderboard
Purpose
=======

This commit improves the front-end when we have no leaderboard yet

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

It hides the `Show All` button when we have no leaderboard.
It also modifies the leaderboard view if a user manages to get to it.

task-2597345

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

Part-of: odoo/odoo#75646
2021-10-22 11:09:17 +00:00
Romain Derie 7d8a8ddea0 [IMP] website(_forum/_profile): remove _get_http_domain method
Before Odoo saas-14.4, one should call `_get_http_domain()` on website to get
its domain. Indeed, that method was in charge of cleaning that domain, as it
was done with commit [1].

Since Odoo saas-14.4, that cleaning is automatically performed on domain before
saving it into database, thanks to commit [2].

Thus, we can now remove the `_get_http_domain()` and use directly the domain as
it is considered clean.

Note that migrated databases coming from version older than Odoo saas-14.4
could still have an incorrect domain (trailing slash, no scheme..).
This will be handled during migration with [3].

[1]: https://github.com/odoo/odoo/commit/3ad775aab717b395a5d11527aeb3596af66afa99
[2]: https://github.com/odoo/odoo/commit/042c95b0219bb0aa13e73385e092fa76ff1a1b0a
[3]: https://github.com/odoo/upgrade/pull/2951

closes odoo/odoo#78766

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-10-21 15:47:22 +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