In courses home page, we use _prepare_user_value to get values from
search strings as render values.
But for example this cause an issue in case of edit_translations, it
has no value but if present is set to `{'edit_translations': True}` in
context.
But _prepare_user_value will set it to context as:
{'edit_translations': ''}
Which make translation not work on page that used
`_prepare_user_value(kw)` to get values for rendering.
opw-2305816
closes#55444closesodoo/odoo#55457
X-original-commit: 11c5daae47b50c26ceebe8feb736352b7a27a85b
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit add a breadcrumb in the badge frontend view to redirect
to the last page the user was.
It highlights the user profile line in ranking view (profile/users).
It add this line at the top of every pages except for the one where
it already was.
Part of https://github.com/odoo/odoo/pull/46634
task-2201708
PURPOSE
Before this commit when an administrator edit another user's profile it
was his own data that displayed for the changes.
This commit fixes this issue.
SPECIFICATION
Add a test in both controller route when displaying the edit view and
when submitting the changes that check if the edited user is the same
as the actual user.
LINKS
Task ID : 2222043
PR : #48262closesodoo/odoo#48575
X-original-commit: 4ab4de5b57a17002d8b14584c7d39a29e8bca357
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit adds a section to distinguish the certification badges from the
other badges users may obtain in eLearning. Certification badges are available
on the ranks page, linked to a running survey. Clicking on them directly
redirects into the linked course.
Task ID : 1961053
PR #32594
In this commit we rename stat_count into granted_count, and stat_count_distinct
into granted_users_count to reflect more what are those variables, aka count
of granted badges.
Task ID: 1961053
PR #32594
Purpose is to support both search term and karma gain group by in the
URL, using keep_query.
Clean some code and move karma computation to res.users model to avoid
having sql in controllers.
Also fix some display issues.
LINKS
Task ID 2003505
PR #34594
PURPOSE
Allow karma gain tracking enabling notably display of top users based on
weekly / monthly gain in website profile.
SPECIFCIATIONS
Each time a user gains karma a record is created in the gamification karma
tracking model. Scheduled activity runs to consolidate the records into
monthly gain records to avoid having crowdy table and unnecessary noise
in karma gain.
This model is made private and only accessible through some dedicated
compute methods / controllers used in website profile.
In website profile module buttons are added to see users ranking based
on their total karma (like before) but also by last week and last month
gains (using the newly introduced tracking model).
LINKS
Task ID 2003505
PR #34594
From now, you need to explicitely add sitemap=True if you want your controller
into the sitemap.
It's the default value, but if you forgot it, it will raise a Warning on runbot.
It will avoid wrong controller in sitemap and duplicate (empty) content.
From now, if your model contains a field website_id, the modelConverter for
sitemap will automatically add the domain:
"[('website_id', 'in', (False, current_website_id))]"
It avoid redundant declaration and ugly url in redirect/rewrite view.
Migration: need to remove it from url_from in website.rewrite
task-2065018
closesodoo/odoo#39427
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
There are too many image sizes. Since they are stored resized this takes time to
generate when saving a new image, it's more rows on the attachment table, more
files on the disk, ...
64px is close enough to 128px that it can be removed without a big impact on
download size.
It will even reduce download and number of requests when both images are
displayed because now only one has to be downloaded and then benefit from cache.
The difference between the two is typically around 1.5kB which is negligible
these days, especially when the request overhead is around 0.5kB already, not
even taking into account other factors such as latency.
If a 64px image must absolutely be returned, it is still possible to pass the
size parameters to the image route. But the current guideline is to handle
resizing in the views when necessary.
Views
=====
- remove width and height attributes when existing CSS rules are overriding them
(eg. `.oe_kanban_avatar` in the right context)
- add CSS rules instead of width and height attributes when possible
- use `object-fit: cover;` where width and height are forced to avoid distortion
of non-square images
- for products, use `object-fit: contain;` instead, keep ratio but without crop
- add new CSS rules where the expected size was max 64px*64px before due to the
image size itself
- remove `img-fluid` where using size classes to avoid conflicting rules
task-2060865
closesodoo/odoo#36147
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
As image fields have been renamed recently [1] we have to update controllers
of profile in order to write on image_1920, not image anymore.
Task 2067872 (eLearning internal testing)
Task 2058598 (survey internal testing)
PR #36756
[1] See 58a2ffa26f
image_original => image_1920 (now resized to 1920)
image_big => image_1024
image_large => image_256
image_medium => image_128
image_small => image_64
image replaced by image_1920 (when writing) or by image_1024 (when displaying
what was previously the big size)
+ add new intermediate format:
image_512
PR: #34925
This commit improves a few methods related to the user profiles:
- Change _prepare_all_users_values so that it
works with a batch of users
- Change the _get_user_certificates and rename it to _get_users_certificates
so that it works with a batch of users to avoid doing a search in a
list comprehension.
This method will also be used to get the number of certificates per users
TaskID: 1952064
PR: #32229
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
The error message now display a message containing the term of
the search and it is also not always displayed as it was before
Task ID : 2036652
closesodoo/odoo#35052
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Install website_slides, create a bunch of users all published on the
website. Using raw sql queries, give some karma to those users. Go to
the `/profile/users` web page. When connected the ranking is correctly
shown, when not connected all users are ranked 0.
The problem is that the public user (id: 4) can only access is own user
which prevent him to access the karma of the other user required to rank
them.
As the injected IR Rules are not adding any value and that a domain is
applied already, it is safe to skip the ir rules.
opw-2029105
closesodoo/odoo#34656
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Before this commit, if you was searching something that return no results,
you will call the sql query generating an error syntax:
Traceback:
ERROR: syntax error at or near ")"
LINE 8: WHERE sub.id IN ()
Now, we don't make more useless query if we know that there are no users.
+ preventive fix the call of this method without user_ids
This commit is related to #14667closesodoo/odoo#33715
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Move code from website_forum allowing to edit its own profile. Otherwise
fields to update are not white listed. Also add an unpublished flag when
seeing unpublished users in order to know it if you have access to
depending on ACLs.
Linked to task 1978530
Related to PR #33559
If a non website_published user was 2nd in karma position, the all users page was
displaying in the top 3 a user with position 4 (in rank) as "normal users" cannot see
non published users.
The field karma_position is now deprecated and will be removed in master.
Task ID : 2000687
PR #33475
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
* = tools, base, web, website_profile, website_slides
Before this commit it was impossible to pass those parameters in the URL because
they were received as string but expected as int.
The opportunity is also taken to properly use named parameters when calling
`image_process`.
closesodoo/odoo#33506
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
* = website_profile, website_slides
Before this commit, the returned Content-Type was not always correct, for
example if the image tool was changing the format, which happens when given
a BMP (converted to PNG), or other types being converted to JPEG.
The previous method `force_contenttype` was too specific and it wasn't available
in every controller. It didn't even need to be a controller method because it
didn't use self.
Now we create a generic helper to ease updating headers.
The Content-Type is only updated when it is safe to do. It is especially unsafe
for example for SVG files.
task-1958000
PR: #31811
* = hr, im_livechat, mail, payment, purchase, web, web_editor, web_unsplash,
website_profile, website_slides
Since the merge of all image tools into one function, the intermediary functions
are not needed anymore.
task-1958000
PR: #31811
* = website_partner, website_profile, website_sale, website_slides
Before
======
Since commit: 2e3848b394
The images that are resized have additional borders if the target ratio is
different than the image ratio. Those borders are transparent if the image
format supports it, and are white otherwise.
With that current solution, if the background where the image is displayed is
another color than white, it is looking really bad.
Moreover, most images are stored resized like this, so it is not even possible
to decide if it should have borders or not depending on the context, the
original image and ratio is forever lost.
It is also inconsistent because if the image is already smaller than the target
size then it doesn't include borders. In that case it keeps the original ratio
instead of the target ratio. So it isn't even guaranteed that the target
ratio is going to be respected.
After
=====
This commit will solve all of those problems by always keeping the ratio of the
original image.
This implies the views should be taking care of adding borders when necessary.
task-1958000
PR: #31811
There is a mix in the variable names: before this commit, what is called
`image_base64` is actually not base64 encoded, and what is called `content` is
actually base64 encoded.
The variables have been renamed to avoid further confusion.
task-1958000
PR: #31811
Merge ranks & badges pages. This commit adapt the final page
layout, controllers and templates.
Added the badge category filter. If used in url parameter, hide ranks and show
only the badge part of the page, filtered on matching badge_category.
Task ID : 1941250
PR #31567
Co-authored-by: @stefanorigano
Co-authored-by: @dbeguin
This commit adds the search bar in 'All users' page in order to filter on name or company name.
To be able to keep the position, a non stored computed field has been added on res_users
to get the position depending on the user's karma.
The podium (top 3 users) is now displayed only if there is no search applied and if the page = 1
because it has no sens anymore in other cases.
Special thanks to @jem-odoo who helped me finding smart solution for position computing.
Task ID : 1943788
PR #31321
Email validation was necessary on the forum to be able to begin to use the forum
(ask or answer questions, vote, etc..)
As the new elearning also uses karma since 705376a982,
the email validation is now also necessary in the eLearning platform.
This is why this commit is moving the email validation process to website_profile
and extend website_slides (eLearning) and website_forum to use this feature.
In function of where the user asked to send him the validation email,
the user is redirected on the forum or on the elearning when he clicks on
'Validate my account' in the received 'email validation' email.
Task ID : 1943788
PR #31321
If there are too much users to show on the page and to avoid performance
issues, a pager is now applied on the all users page.
A new pager based on website_pager is added in order to ease the navigation
through the potential high number of pages. 'Go to first page' and 'Go to last
page' buttons have been added and the design of the pager have been adapted
to be more integrated into the new eLearning platform.
Also add the pager on the slide page if search category is applied. The pager
was already computed in the controller but not displayed.
Task ID : 1946160
PR #31697
The main condition to be able to see a profile is that the user we want to
see the profile is website_published.
But if a new user sign up and wants to access his own profile, he must
get access to his own profile, even if he is (not yet) website_published.
Commit linked to task ID 1941250 and PR #31279.
As the eLearning (website_slides) is also using website_profile users,
the All Users page is moved from website_forum to website_profile, to be
useable in both forum and eLearning.
This page displays also the number of karma point, badges and certificates
of each user.
The users are sorted by their karma points and the first 3 users are
promoted on a podium.
Use span instead of b tag in profile page
Task ID : 1922159
PR #31109
Purpose of this commit is to
* clean user avatar controller and its calls;
* extract default image computation;
* add a controller to get slide image even when not having access to the slide
as all slide name and images are displayed even if not available to the
current user;
Commit linked to task ID 1941250 and PR #31133.
Purpose of this commit is to give a specific route to access users image
used as avatar in profile and various frontend applications.
Indeed current web/image controller basically checks record access rights
with current user. However in some cases we want to display user avatars
even if current user cannot read user records, which is generally the case.
Indeed res.users is a private and technical model.
To solve that issue we add a controller for avatar. Basically published
and frontend active user avatars are available.
This commit is linked to task ID 1936153 and PR #30770.
Since 56645335b7, when a user get a badge,
an email is sent. The subtype is not used anymore, so the alert
mecanism in forum to display a message to the user to show him
his new badges can not work.
This commit removes this dead code.
Task-1922159
Move Profile part from website_forum into this module in order to be usable in other modules
(like website_slides) that will depend of this module.
Applies gamification.ranks on website_profile page. Show the current rank and the next rank
but also the progression until the next rank. Adds also an 'about rank' page to allow users to know
more about available ranks.
The goal here is to make the profile page more modular and to allow other modules to add informations
or modify easily link or part of profile page in order to be specifically contextualised
for the module in question.
Task ID : 1922159
PR #30988