The introduction of Milk has brought new app icons.
Using the svg format creates a lack of anti-aliasing on the edges of the
shapes, which makes the icons look bad.
Since the png size has been reduced, we can afford to use the png format
to have the best possible quality without having a lack of performance.
task-3326633
Part of task-3326263
X-original-commit: e07cb722f2b11407a3ad093bd688b7d37afd5a88
Part-of: odoo/odoo#121886
When a new user is created from the website, the company id was always
set to the first company of the database even if the website was the one
of another company. This flow has been already fixed if there is the
"Specific User Account" setting activated (see [this other commit]).
This commit fixes the same issue but for every case.
Steps to reproduce the issue:
- Create 2 companies A & B
- For each company, create a website linked to a different URL
- Activate 'Free sign up' for company B
- As a public user, go to website of company B
- Go to 'Sign in > Don't have an account?' and create an account
=> If as an admin you check the company of the created user, it is
company A instead of company B.
[this other commit]: https://github.com/odoo/odoo/commit/77c708c516beb322df37220634e178ba82e894c9
task-3277317
closesodoo/odoo#121834
X-original-commit: 3fbfb5301c7583583e4f46c9b4ef16e048e5800c
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Signed-off-by: Dieleman Guillaume (gdi) <gdi@odoo.com>
Before this commit this tour was often failing. It seems to be because
there were some requests still being executed / received after the test
was marked as successful and browser getting killed.
According to the logs, even when the tour is actually not failing, there
is still some unexpected requests going on.
With this commit, saving and waiting the edit mode to be exited will
prevent all those requests issues, as it seems like the requests done
after exiting edit mode are all awaited before marking the test as
successfull.
== Before the fix success case ==
- Tour snippet_editor_panel_options on step: 'The text toolbar should still be visible, and the text still selected. (trigger: #oe_snippets .o_we_customize_panel > #o_we_editor_toolbar_container)'
- GET /website/static/src/img/snippets_options/header_template_default.svg HTTP/1.1" 200 - 0 0.000 0.003
- [Same GET for 10 other header templates]
- test successful
- Session expired
- POST /website/theme_customize_data_get HTTP/1.1" 200 - 3 0.001 0.003
- [2 lines above x10]
- Deleting cookies and clearing local storage
- Navigating to: "about:blank"
- Navigation result: {'frameId': 'A538603CC37A4E9EBA99B8624C1CD34E', 'loaderId': '9187051DD3D9477FA4EDEB1A544D584E'}
- Waiting for frame 'A538603CC37A4E9EBA99B8624C1CD34E' to stop loading
- waiting for threads: [<Thread(odoo.service.http.request.139669352166976, started 139669352166976)>]
== Before the fix error case ==
- Tour snippet_editor_panel_options on step: 'The text toolbar should still be visible, and the text still selected. (trigger: #oe_snippets .o_we_customize_panel > #o_we_editor_toolbar_container)'
- GET /website/static/src/img/snippets_options/header_template_sidebar.svg HTTP/1.1" 200 - 0 0.000 0.004
- [Same GET for 10 other header templates]
- test successful
- GET /web/static/img/smile.svg HTTP/1.1" 200 - 0 0.000 0.001
- GET /web/static/img/spin.svg HTTP/1.1" 200 - 0 0.000 0.001
- Failed to fetch
- Asking for screenshot
- Trying to set result to failed (TypeError: Failed to fetch) but found the future settled (<Future at 0x7f8fa1a25120 state=finished returned bool>)
- Deleting cookies and clearing local storage
- Screenshot in: /data/build/tests/36222061-master-all_no_autotag/screenshots/sc_20230513_220042_739175_TestUi.png
- Navigating to: "about:blank"
- Navigation result: {'frameId': 'E1A779132E972A440E5FE892BBBC9FEC', 'loaderId': '822ACED443DB0C84F57DD4A1FF451D5B'}
- Waiting for frame 'E1A779132E972A440E5FE892BBBC9FEC' to stop loading
- waiting for threads: [<Thread(odoo.service.http.request.140254747010624, started 140254747010624)>]
== After the fix case ==
- Tour snippet_editor_panel_options on step: 'iframe body:not(.editor_enable)'
- GET /web/static/img/spin.svg HTTP/1.1" 200 - 0 0.000 0.003
- POST /website/theme_customize_data_get HTTP/1.1" 200 - 8 0.002 0.035
- [Many other POST/GET requests]
- test successful
- Deleting cookies and clearing local storage
- Navigating to: "about:blank"
- Navigation result: {'frameId': '4B87BC8A50A3FEBD7D508394DD5BDB19', 'loaderId': '7CCB3B6434B52B456A1AA470C3CFA1BF'}
- Waiting for frame '4B87BC8A50A3FEBD7D508394DD5BDB19' to stop loading
- waiting for threads: [<Thread(odoo.service.http.request.139744500471360, started 139744500471360)>]
runbot-15312
closesodoo/odoo#121795
X-original-commit: 936cc061ab20dc1fe4587b24f59dc322d0e7ad9b
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
The generation of the assets may make this step fail randomly.
The pregenerate is not enough because this is generating assets for
website2.
This issue will be partially solved in master with this PR [1] by not
generating an asset if a close one is found in the database.
For now just increase the timeout for this test.
[1]: https://github.com/odoo/odoo/pull/121376closesodoo/odoo#121777
X-original-commit: c3209aec9741cda8597525add88b0a932fb7532a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Before this commit, links scrolling to an anchor with a special
character did not work and displayed a traceback. The issue was that to
check that the anchor is valid, we don't need to check that the anchor
is a valid url as we have been doing since these commits [1], [2]. But
we only need to check if the jQuery selector is valid to correctly
target the element to which the page must scroll.
Indeed, the anchor widget returns stuff like 'ok%C3%A9%25' when typing
'oké%' wich is not valid jQuery selector. It has to be encoded to
'#ok\\%C3\\%A9\\%25' to be valid and that's what this commit does.
We also changed the way to display a new anchor to the user in this
commit. Before, we showed the anchor unencoded in a notification and now
we show it encoded. That way, if the user copies the anchor from the
notification, it's the real anchor.
Also, this commit detect if the success URL of the redirect of a from is
the current page to perform a scroll to the anchor instead of a
redirect. To make this comparison, we needed to add the url code of the
language of the current page to the session info.
Also, before this commit, the page froze when we clicked on the "submit"
button of a form that redirected to an anchor that did not exist.
[1]: https://github.com/odoo/odoo/commit/0abfaeda96c2eaa868cc7fc5fa1926dfa90fc420
[2]: https://github.com/odoo/odoo/commit/b492bde6a121be1c15ed90ce0827fcfd72a12f5c
task-2172312
closesodoo/odoo#121656
X-original-commit: f09a3fc47b5fd088c3aa5112a0fac5f442d9c915
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Cast website_id so that if it contains more than 1 digit, we do not
browse() a tuple with each digit. For example, if we pass pagenew() the
website_id '123', this is the current behavior:
- browse('1', '2', '3')
After this fix:
- browse(123)
To reproduce the erroneous behavior:
- Create at least 10 websites so that the id of this website is at
least in the double digits.
- Create a new page within this website with a double digit id.
- It will throw an expected singleton error.
Issue was introduced in this commit: https://github.com/odoo/odoo/commit/d6014c60acc4231a5e56d492d2a39deaf789cbe8
opw-3290571
closesodoo/odoo#121586
X-original-commit: 3855829a0daf4321ab54cce3a71a92eb68c216b3
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
One of the most costly part of a page loading when the ormcache is cold
is computing the assets node, the unique identifier of an attachment to
validate whether the existing attachment is still valid with the current
version of the static files.
This operation needs to glob assets path in the filesystem,
get the modification date, check attachments, ...
Right now this task is not really optimized and can take some time
because of an excessive number of glob on the filesystem, unnecessary
exists to define absolute path, double computation of file list and
modified times when getting js and css bundle separately, ...
A list of modifications mainly discussed in the pr message are made
with this commit to speedup things.
- split css and js unique
- prepare api for an in memory glob
- change api to propagate absolute path and meta information through
`ir.asset._get_paths`-> _get_asset_paths -> `_get_asset_content` ->
`AssetsBundle`
closesodoo/odoo#121159
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Before this commit, when a cookie bar was displayed on a page and
elements of that page were animated (on scroll and on appearance), those
animations did not work while the cookie bar was present. This commit
fixes that and enables animations even if a cookie bar is displayed. The
problem was that we were looking to see if a modal (cookie bar, popup)
was displayed and if it was, all animations were based on the scroll
height of that modal. However, this should only be done for elements
that are in the modal. The other elements should always base their
animation on the scroll height of the page.
task-3151000
closesodoo/odoo#121543
X-original-commit: 406fc8a59a36313f382a34aaba143ab2a9845718
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Dieleman Guillaume <gdi@odoo.com>
Steps to reproduce:
- Log in as admin
- Install `eLearning` module
- Create a course and add a youtube video as a lesson
- Publish the course
- Go to the website and click on the course
- Enable `Editor` mode (top left corner)
- Click on lesson to open it in fullscreen
- Click `Back to course` button
Issue:
Video is playing in the background.
Same issue occure with video snippet in the website editor (by default
video is mute but still playing in the background).
Cause:
When editor mode is enabled, there is a fallback iframe that clone the
content of the current page that we leave into it.
Since the youtube video has `autoplay=1` in the URL, it will
automatically start in the fallback iframe.
Solution:
For regular website pages, remove the `autoplay` param from all
media video iframes urls (targeting all `div.iframe` that have a class
`media_iframe_video`).
For eLearning, override the `WebsitePreview._cleanIframeFallback`
method to remove the `autoplay` param from youtube videos URLs.
opw-3226002
closesodoo/odoo#121475
X-original-commit: ad78585cd514f5ff16647572d34937c18a112529
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit fixes a bug with the navbar links in the header of a website
on mobile. When the text of a link is long enough to be wider than the
screen, the text does not wrap to the next line as intended, but instead
overflows to the right outside of the screen, causing part of the text
to be hidden.
Steps to reproduce the bug:
- Edit the text of one of the menu links on a website to make it longer
than the width of the mobile screen.
- Bug: In mobile view, part of the link text is hidden.
This bug occurs with both the "default" hamburger type and the
"off-canvas" hamburger type.
opw-3233684
closesodoo/odoo#121464
X-original-commit: eae10f2e154a1b6bf9f385460b1371faf9869a3f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Vray Benjamin (bvr) <bvr@odoo.com>
Prior to this commit, `o_navbar` wasn't fully hidden when we were in
edit mode and created an offset at the top of the loader when we loaded
something (eg. changing the header template).
This commit fixes this issue.
task-3326604
Part of task-3326263
closesodoo/odoo#121387
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
The cookie policy banner template includes nested selectors, such as
o_cookies_bar_text_policy within o_cookies_bar_text_secondary.
The process for switching the banner layout involves copying selectors
based on the order defined in CookiesBar::selectLayout()::selectorsToKeep.
However, a bug caused o_cookies_bar_text_policy to be copied before
o_cookies_bar_text_secondary, resulting in its content being overridden
by its parent content. The fix involves reordering the selectors so that
o_cookies_bar_text_secondary is copied before o_cookies_bar_text_policy.
opw-3302511
closesodoo/odoo#121324
X-original-commit: 720ae005bce261ce3b9e32dc8ade1f1d97f1aee1
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Prior to this commit, after [1], when a user is trying to visit or view
their website from a domain that is not their current website, a
traceback would appear if the redirect took too long.
This is because when redirecting, we do not set any URL as the iframe
iframe source, so it loads the `about:blank` page. When trying to push
that page into the history (done to change the name and url displayed in
the browser), the browser crashes and displays a CORS error.
On top of that, it seems some users do not understand what is happening
and feel like they are being logged out if they're not logged into their
custom domains.
This commit prevents replacing the history state if the page displayed
in the iframe is `about:blank`.
It also displays a dialog before redirecting, explaining to the user why
it is necessary.
Steps to reproduce:
- Go to website settings
- Set a domain for your website that's different from the one you are
currently using to access Odoo (Could be anything but for a realistic
setup, if accessing from localhost, use 127.0.0.1 or the other way
around, or use different 127.0.0.X ips)
- Toggle a slow network mode from your browser's dev tools
(This is to ensure the traceback appears as it does not if the network
is quick enough with its redirect)
- Go on the website app
=> A traceback appears (and disappears as the page is unloaded)
[1]: https://github.com/odoo/odoo/commit/59b96b0742fe8da31eecf896f7a6157811d49de5
opw-3250663
closesodoo/odoo#121311
X-original-commit: 15a31cbcec9f51c72abac8df69932cc1a742baef
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Before this commit, now that multiple files can be uploaded in a form,
we could observe that the file input is not convenient to manage this
situation:
- Clicking again on the input to choose other files replaces the
previously uploaded ones, we can therefore not upload files one by one.
- A file cannot be deleted in an obvious way: we need to cancel a new
upload, as it will replace the file by nothing and therefore delete it.
- When multiple files are uploaded, only the number of files is
displayed and not their name (they are only displayed on hover).
This commit improves these behaviors:
- Clicking again on the input adds additional files instead of replacing
them (unless the number of files allowed is 1);
- The button text content is modified after the upload of files,
displaying "Add Files"/"Replace File" (if multiple/single files are
allowed) to show its role better.
- When files are uploaded, blocks containing each files name and a
cross to delete them are displayed.
In order to make these improvements, the file input is hidden and
replaced by an input of type=`button` when files are uploaded. This was
done for two reasons:
- It is not possible to modify the content of an input of type=`file`
but we can change the value of a button.
- The input did not look good with the file blocks, because it has a
text displaying file informations, which was redundant with the blocks.
task-2798576
Part-of: odoo/odoo#89055
Currently, we can only upload one file in a form File Upload field and
this file does not have a size limit. (Note that the server can have a
limit to prevent files too large from being uploaded but the file input
itself does not have one.)
This commit adds options to the form file inputs in order to set a
maximum number of files and the maximum file size (in MB) allowed to be
uploaded in these fields. The default values are 1 file and 1 MB. Note
that the option for the number of files is not displayed for the fields
where only one file is supposed to be uploaded.
If the uploaded files do not respect these limits, the form is not sent
and a message is displayed.
task-2798576
Part-of: odoo/odoo#89055
Edition of block links has been broken several times.
This commit adds a test that makes sure it does not happen again by
changing the URL of a card of a mega menu with the Cards template.
task-3300977
closesodoo/odoo#121362
X-original-commit: b4b5816a4acd953eb4dabfd14d2a142934dee357
Signed-off-by: Vray Benjamin (bvr) <bvr@odoo.com>
Before this commit : The library underscore.js and
underscore.string.js were used in the ODOO solution.
After this commit : Every usages of a function from
underscore.js lib has been replaced with native javascript.
The goal is to remove all usages of underscore.js and to
not use anymore this library in ODOO.
---
TaskId : 3246238
closesodoo/odoo#120437
Signed-off-by: Géry Debongnie <ged@odoo.com>
[FIX] *: selectors in tours
[FIX][TMP] account: CogMenu selector in tours
[FIX][TMP] web*: Breadcrumb targetting in tours
Adds a `o_breadcrumb` class to target the whole breadcrumb, no matter
how much elements it contains (collapsed parts, visible path, single
name...).
add classname on last breadcrumb item
[FIX][TMP] project: View buttons selector in tours (moved away from CP)
[FIX][TMP] project: Kanban selectors in tours (quick create)
[FIX][TMP] *: SearchBar selectors in tours (toggle menu)
[FIX][TMP] *: ButtonBox selector in tours
[WIP][IMP] web: add toggleSearchBarMenu in search helpers
adapt and unskip 3 list tests
adapt and unskip calendar tests
unskip web_tour test that actually pass
post rebase fix
allow to lose cell focus after multi edition (given to searchbar) - bug reported, to check later
post rebase fixes
fix
Part-of: odoo/odoo#116641
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
*: hr_holidays, stock, sale, product, web, sale, purchase, stock,
website, survey
Adapt some custom control panels (mainly for custom reports) to the
milk controlpanel.
hr_holidays:
Move the buttons to create a new time off or a new allocation to the
"create button" slot and transform it into a dropdown (creating
allocation requests is clearly a secondary action, not a primary one)
stock:
3 lines does not fit, must be on 2 lines
Part-of: odoo/odoo#116641
This commit brings the ControlPanel into a single line with 3 main
sections:
- buttons & breadcrumb
- layout related actions (ie. the SearchBar in multirecord view or
ButtonBox in formView)
- navigation (pager, switch view...)
Add new search bar menu, this is a merge of the following components
into one big component display in column:
* comparison_menu
* favorite_menu
* filter_menu
* group_by_menu
Also adapt navigation hook.
Part-of: odoo/odoo#116641
Depending on Milk, this commit adds some missing borders.
Also adapts default `border-radius` to apply milk design.
task-2818586
Part-of: odoo/odoo#116641
*: website
Old 'website_hr_recruitment' templates looked outdated, so they have
been improved in terms of usability and design, by applying the
following changes:
- Old images used in `/jobs` and `/jobs/detail/` have been replaced by
new ones, taken from the Odoo official profile in social media.
- A `Connect with us` section has been added to the right column of
`/jobs`, including a separator, links and social media icons.
- Job entries in `/jobs` now show the city of the office, its country
and its department, as shown in the filters.
- In `/jobs/*`, old header with a breadcrumb has been replaced by
the topbar seen above, including a link to previous page in the
navigation flow.
- Design in `/jobs/detail/` has been improved, including a redesign of
the `Our Product` block or the image gallery at the end of the page.
- Header in `jobs/apply/*` has been improved and includes a column with
the address of the job position.
- In `jobs/apply/*`, the design of the form group has been revamped and
also has been added a right column including a snippet with the contact
information of the recruiter tracking the job application process.
- Overall design has been improved in the `/job-thank-you` view,
including the recruiter snippet seen above.
- Job description is now editable and not truncated. Additionally, a
default job description has also been added.
- Every new job entry has now a default short description, editable.
- If there is either no available job or not any valid job after the job
search, the `No jobs available` view has also been improved.
- Illustrations with dynamic colors have been included in
`/jobs/detail` (`Our Product` block) and `/job-thank-you`.
- `boolean_toggle` widget used in `website_hr_recruitment`'s
backend, in its job entry kanban has been improved.
- Syntax has been adapted to BS5.
- Tests have also been updated to the changes in the templates.
task-2406626
Part-of: odoo/odoo#67913
Co-authored-by: Benoit Socias <bso@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
New data will be introduced that involve the "product" word... while
this is a word a fuzzy test is based on. This commit adapts the test so
that its results are based on words that are less likely to appear in
default data.
task-2406626
Part-of: odoo/odoo#67913
Co-authored-by: Benoit Socias <bso@odoo.com>
W3C validation does not like async="1", there is not supposed to have
any value for this boolean attribute. "async" as value should be
accepted as a value is needed in this XML definition.
closesodoo/odoo#120311
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Website default templates contain phone number links using the `tel:`
syntax as "href". That syntax is not allowed to contain spaces (even
if it works, W3C validator does not like it).
This commit focuses on fixing the default values in default templates.
Extra work should be done to prevent user entered numbers to be used as
`tel:` without removing the spaces (either via backend fields or via
the website builder).
Part-of: odoo/odoo#120311
*: website, website_blog, website_event
This commit adds the TikTok social network to the other social networks
stored in DB. Thus, users of the Website application will be able to
reference their TikTok page on their websites. This commit also updates
the different templates and the social media block to integrate this new
social network.
task-3235451
Part-of: odoo/odoo#116837
Since [1] when the fuzzy search was introduced on website pages, the
filtering on most specific pages only happens at the end of the search
operation. Because of this, the search happens on pages that would be
excluded anyway, the limit might be wrongly applied and the count might
be wrong.
This commit makes the page search begin by keeping only the most
specific pages, then performing the actual search within those pages.
Steps to reproduce:
- Install `website` only and drop a search snippet.
- Search "ax".
=> No results found, but the "All results" link is displayed.
[1]: https://github.com/odoo/odoo/commit/7559626c54e34b41e1549e28276a650accec6986
task-3203794
closesodoo/odoo#120950
X-original-commit: 9725a14be22ad0f20bb6591054b60d91663ca88f
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
Before this commit an ir_assets generated automaticaly by the web editor
will generate an url ending with ...custom.addon.bundle_name.ext
After this commit the url will start with /_custom/addon.bundle_name/...
This will make it easier to spot at immediately if it is a custom asset
and thus it is useless to apply the glob. Actually, it will fail on the
/_custom when trying to glob, making it faster.
This is mainly useful to clarify and debug but in a case with mainly
customised ir_asset for one bundle, it may have an impact on speed.
An upgrade script was created for this change.
closesodoo/odoo#120699
Related: odoo/upgrade#4636
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Steps:
- Go to website/shop (with price range widget enabled)
- Change the language to Arabic
Issue: the numbers on the price range widget are overflowing
Cause:
The element leftCounter's right style property is always set to 0px.
So when changing the direction it's always on the right as his position
is absolute.
Solution:
Built-in handle by Bootstrap with end-0
Fixes#108557
opw-3221051
closesodoo/odoo#120568
X-original-commit: 4e05d93dce31f9a829961bded855a6cb7e8de7f3
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit avoid to invalidate the cache on creation of 301/302 that
have no impact on the routing_map as only 308 and 404 alter the routing
map:
- 404: remove entry from routing map
- 301/302: served as fallback later if path not found in routing map
- 308: add "alias" (`redirect_to`) in routing map
closesodoo/odoo#120500
X-original-commit: 1430644908d7d9a3119a1315389f5bf11888356a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
*: test_website, website_blog, website_crm, website_hr_recruitment,
website_mass_mailing, website_sale, website_sale_wishlist,
website_slides
This commit creates a new util which clicks on edit and waits for the
edit mode to be started. This way, we make sure that the edit mode is
enabled before testing the next step of the test. This avoids race
conditions during tests.
This commit replaces all the uses of the old util with the new one, it
also removes the steps that are waiting for the edit mode to start.
Finally, from [this other commit], we can start a tour in edit mode. For
these tests (which have `edition: true`), it is useless to check if the
edit mode has started at the beginning of the test because this check is
already done by default. This commit removes unnecessary / duplicated
steps.
[this other commit]: https://github.com/odoo/odoo/commit/99b50d18e220aedf14de806f4bf1b2d35c32de35#diff-c7720501ec33f5f92c907d8bb41de50edd832a4564317073e801a6915796a6bdR278
task-3203820
closesodoo/odoo#120481
X-original-commit: https://github.com/odoo/odoo/commit/9fd5d25f59578abc9c608578a7d2e2953880b582
Related: odoo/design-themes#656
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Guillaume-gdi <gdi@odoo.com>
== Issue ==
A business code error was detected by the internal team on our
production. The cache and assets where invalidated !WAY! too often for
the past months.
It was hard to figure but finally the error was tracked down to be
located in the assets retrieval stack of our code when a database is
accessed through multiple different domains.
In our production use case, whenever one was accessing `odoo.com/web`
after someone accessed `accounts.odoo.com/web`, the assets would be
invalidated and recomputed, again and again, whenever someone accessed
the backend on a domain after someone else did with another domain.
Obviously, on our production, this could be occuring multiple time per
minute.
Technically, this is because the "assets retrieval stack" had a mismatch
in multiple endpoint when trying to find if a current website was
involved (serving for the frontend).
Some business method were using `env.context.get('website_id')` while
others were using `env['website'].get_current_website(fallback=False)`.
From there, when the code was called without a `website_id` in the
context, `get_current_website()` would still return a `website_id` when
called from `http://odoo.com` as there is a website having its domain
set to it. `get_current_website()` is then finding it and returning it.
But it would not when the user is on `http://accounts.odoo.com`.
Since we have a custom scss override (done through our website builder,
basically an ir.asset linked to a "url type" attachment:
`/website/static/src/scss/options/colors/user_color_palette.scss`) for
our website to define the website colors which is shadowing the scss
file from disk.
So, depending of the host/domain, either the real file disk for this URL
or the ir.asset linked to our website for this URL would be fetched to
generate the bundle hash (which is basically the last modification date
of the files/attachments).
Obviously, the file on disk and the ir.assets have a different last
modification date.
The system would then consider the assets as outdated and would
regenerate it.
You can see it in the logs where the attachment id of the assets URL
would get higher and higher everytime you access the DB through another
domain.
Using `get_current_website(fallback=False)`:
- `_get_related_assets()` https://github.com/odoo/odoo/blame/30d3b97b5ece379d9ddcbceda9d12c03dc7f4a48/addons/website/models/ir_asset.py#L14
- `filter_duplicate()` https://github.com/odoo/odoo/blame/30d3b97b5ece379d9ddcbceda9d12c03dc7f4a48/addons/website/models/ir_asset.py#L41
- ..
Using `get_current_website()`:
- `_get_custom_attachment()` https://github.com/odoo/odoo/blame/30d3b97b5ece379d9ddcbceda9d12c03dc7f4a48/addons/website/models/assets.py#L162
- ..
Using `context.get('website_id')`:
- `_get_asset_url_values()` https://github.com/odoo/odoo/blame/30d3b97b5ece379d9ddcbceda9d12c03dc7f4a48/addons/website/models/ir_qweb.py#L23
- ..
== Fix ==
A fix could have been to aligned those to use the same way of retrieving
the website but it would be too fragile (definitely some other places
where the same bug is involved but not yet found).
What is done in this commit is something we wanted to do for a long time
(see [1]) but was based purely on guess and feeling rather than concrete
bug / use case, but now that we found a real use case, we will do it:
- It doesn't seems to make sense to consider the request host/domain
when we are in the backend
- Same for the forced session, those should only impact the frontend
calls.
But this seems to have too much impact in stable to be changed, as it
would require to check every caller to also check for the session if
it makes sense. This will be done in master as not really needed to
prevent the critical bug fixed here.
- When something wants to alter the backend with a website, it should
explicitely be passed in the context, which is still considered
regardless if it's a backend/frontend call.
- If something needs to consider the forced website in session in the
backend, it should explicitely check it, not relying on
`get_current_website()`.
== Step to reproduce ==
- Start a db with website installed
- Enter the website builder in edit mode and change the "Theme Colors"'s
first "Color Presets"'s background color (it is white by default).
- Set the website domain to `http://127.0.0.1:8069/`
- Go to `http://127.0.0.1:8069/web` and login
- Go to `http://127.0.0.2:8069/web` and login
- Now start refreshing those 2 pages one after each other.
Everytime you will refresh the page, it will take a very long time
(~5-10 seconds) before loading the page, and monitoring the logs will
show something about invalidating the cache and huge query count.
== Benchmark ==
For the explained "multiple domain access" case, the backend /web will
now be loaded in less than 10ms and with ~10 SQL Queries when website is
installed, while it was taking ~4 seconds and ~200 Sql Queries before
the fix.
Before the fix:
```
odoo.modules.registry: At least one model cache has been invalidated, signaling through the database
GET host1.com/web HTTP/1.1 200 - 222 0.135 3.840 <-- 222 Queries, ~4s
odoo.modules.registry: At least one model cache has been invalidated, signaling through the database
GET host2.com/web HTTP/1.1 200 - 181 0.101 3.692 <-- 181 Queries, ~4s
odoo.modules.registry: At least one model cache has been invalidated, signaling through the database
GET host1.com/web HTTP/1.1 200 - 215 0.121 3.704 <-- 215 Queries, ~4s
odoo.modules.registry: At least one model cache has been invalidated, signaling through the database
GET host2.com/web HTTP/1.1 200 - 181 0.100 3.616 <-- 181 Queries, ~4s
```
After the fix:
```
odoo.modules.registry: At least one model cache has been invalidated, signaling through the database
GET host1.com/web HTTP/1.1 200 - 101 0.043 0.353 <-- 101 Queries, ~0.3s
GET host2.com/web HTTP/1.1 200 - 11 0.004 0.007 <-- 11 Queries, ~10ms
GET host1.com/web HTTP/1.1 200 - 11 0.003 0.005 <-- 11 Queries, ~10ms
GET host2.com/web HTTP/1.1 200 - 11 0.003 0.008 <-- 11 Queries, ~10ms
```
[1]: https://github.com/odoo/odoo/pull/94161#discussion_r904780031 (Also other PR/task but couldn't find those.)
closesodoo/odoo#120364
X-original-commit: 28dd35eb3c681b630f0b3c109a7d8209f9fa42d8
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Steps to reproduce:
- Go to a website page > Add a 'Form' block > Add a new 'Selection'
field.
- Go to the page (in 'edit_translations' mode) > The selection field
options are not translatable.
The goal of this commit is to make the select options translatable
by adding an intermediate `.o_translation_select` element.
This element will handle option's text translations from the linked
`<select/>`. The final values are copied to the original element
right before save.
opw-3233360
closesodoo/odoo#120363
X-original-commit: 5ff53d7f289ec531f8369a47d02bd58252bb98a5
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Current link in settings leads to 404 error page,
changing the path to the right one
opw-3279614
closesodoo/odoo#120356
X-original-commit: beffb2fcab99439c9bf9b398e500e2437e38f9f9
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
With the BS5 upgrade script of 16.0, countdowns' data-display may have
been converted to data-bs-display by mistake. This will fix the DOM at
page load for good measures, maybe even allowing to remove this code in
a few years as hopefully all current countdowns will have been removed
or edited (or when a proper upgrade script in a future version of Odoo
will be made, if necessary).
opw-3240041
opw-3240532
opw-3258751
opw-3272731
closesodoo/odoo#119767
X-original-commit: ce506f32e3471eea1785312d4140417eba0ce355
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Commit [1] made sure that to be considered active, the current page URL
should have the same query strings as the ones defined in the menu URL
(if any).
But it was not fully accurate as extra query strings on the page URL
would make the menu not active even if the menu URL query strings would
be found in the visited page URL.
With this commit, when trying to determine if a website.menu is active,
we only take into account the subset of menu's query arguments.
For ex, a menu with an url of `/my-page?country=BE` should be
considered active if the request url is:
`/my-page?country=BE&utm_source=marketing-campaign&utm_medium=email`
[1]: https://github.com/odoo/odoo/commit/065ca15closesodoo/odoo#120188
X-original-commit: bc1f2c092122e171950348c3e32438e8b862f231
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Xavier Alt (xal) <xal@odoo.com>
This commit gives a small refresh to the web_editor UI. To do so we
remove the borders from the buttons and inputs. We also increase the
border radius to 4px instead of 2px. The nested menus such as in Themes
tab now have the same background color than the rest of the UI.
The box shadows on the `we-title`, `we-customize-block-options` and the
checkbox switch have been removed.
All the buttons and select components are now taking the full available
width. The inputs fields remain unchanged except their font which is now
set to sans-serif.
Finally a `<div>` have been added to the replace media snippet to make
it consistent with the other buttons having an icon. Maybe in the future
we'll need a better way to define those.
task-3265187
closesodoo/odoo#119697
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Before this commit:
The scheduled action will repeatedly time out if the number of visitors
to remove is too high. In the case of the client, he has ~ 4 millions
inactive visitors to remove. This might happen after a bot spam attack.
After this commit:
The visitors are removed by batch of 1000, reducing the number of old
visitors with time
opw-3256349
closesodoo/odoo#119757
X-original-commit: b69917ec0e508f8354d831525c5c48ee79b5967a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>