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.
closesodoo/odoo#134295
Task: 3439226
Related: odoo/enterprise#46899
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
*: mass_mailing,website,website_sale
Before this commit, the ComponentWrapper was used to mount some
components which then render a dialog. This commit replaces these cases
by using the dialog service.
Task: 3439226
Part-of: odoo/odoo#134295
*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
closesodoo/odoo#134620
Related: odoo/enterprise#47044
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
When building a website with the website configurator, you get pages
with a nice layout. However, the text inside is not adapted to your
company, industry or even, most of the time, language.
Using a LLM, we could easily get text much more relevant to customer
needs. The scope of this work is static pages generated with the website
configurator (homepage, about us, pricing, ...).
Later, in other tasks, we also want users to be able to generate text
inside the website builder.
This commit implement the bare minimum to generate and replace a website
content by AI generated sentences (based on the information provided by
the user).
Related IAP PR at https://github.com/odoo/iap-apps/pull/656
task-3248852
closesodoo/odoo#121021
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
During the rendering of website configurator pages, we check that the
rendering of each snippet is done for some reason. That check is useless
because:
- Either the rendering fails and in that case, there is a raised
exception that we catch (note that catching it could also be useless
actually: we will check that post 17.0 release).
- Either the rendering is empty (weird case to cover ?) and the
remaining code should work regardless anyway.
Note that in the original code, that `if` covered the case of trying to
render a non existing view... but was changed in [1] such that in that
case, an exception (that we catch) will be raised.
[1]: https://github.com/odoo/odoo/commit/880954ebfc1106411b7f7a7d60aee05dfae60893
Related to task-3248852
Part-of: odoo/odoo#121021
The configurator code organization should be reviewed. This is a first
step that will be needed for the integration of a new feature: this
removes the one-call inner functions inside that `configurator_apply`.
Related to task-3248852
Part-of: odoo/odoo#121021
Since [1], it was no longer possible to refresh the page and stay in
the backend at the same time. This was known at the time and was an
accepted downside.
However, with this commit, a compromise has been found, if the keyboard
shortcut for a refresh (CTRL-R or F5) is used while the Website Preview
is shown (mounted), then the website preview will do its best to keep
the user inside the backend.
This will make developing features for the website modules easier, as
before, every refresh would require an extra click to return to the
backend.
To note: the debug=[mode] param would also be lost
on refreshing a website page. Starting 16.4, since [2], this would make
tracebacks harder to read as for every refresh, they would no longer
point to the source, rather just the minified file. Therefore, with
this commit, we also keep the debug mode in the URL when doing a
keyboard refresh.
[1]: https://github.com/odoo/odoo/commit/1c18b79972c3b0a97197b98390e0ba9fda703585
[2]: https://github.com/odoo/odoo/commit/59f49d6a8c856a5d8ca28dcfd7840baaa1c7672f
task-3458691
closesodoo/odoo#134444
X-original-commit: e69c6eaed4e82e08d6bbf807cf4698f6327a9cdd
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit allows you to change the title of the social media block
after the first save. If an element is in a parent that has the class
`o_not_editable` then it is only editable if it has the contenteditable
attribute set to true. We rightfully remove this attribute at saving but
without putting it back when we return to edit mode. This commit allows
to fix this case. Note that we have to improve this system in the future
(so we can get rid of this patch).
This part of the fix is very similar to [this other fix] for the team
block.
[this other fix]: https://github.com/odoo/odoo/commit/b7d53d2fcb20a447fd3098adf94ffb33bc49dda9
task-3073171
closesodoo/odoo#134281
Part-of: odoo/odoo#105964
X-original-commit: 44b0bcbdd67721e3b45567d26da00e4a3910f541
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
This commit allows you to change the icons of custom links of the social
media block after the first save. Thanks to [this other commit], there
is now a class that permits to inform the editor that a media is
editable even if it is a non-editable parent. This commit permits to use
the new class to fix the issue.
Steps to reproduce the bug:
- Drop a social media block on a page
- Add a custom social media
- Save
- Edit
- Try to change the icon of the custom social media with a double-click
=> The icon cannot be changed.
Note that [another commit] had already been made and fixed the problem
halfway (the icon change didn't work on double-click). This commit
reverts it and fixes the problem correctly with the new system.
[this other commit]: https://github.com/odoo/odoo/commit/6ead397f33512c918f51feb2b32fb3e15ffedf34
[another commit]: https://github.com/odoo/odoo/commit/bb291b35e46e42ca098aa3e04ac0b473f72be423
Fixes https://github.com/odoo/odoo/issues/104048
task-3073171
X-original-commit: b844351b9814ff2167d2183ab3216e2d1ec1d216
Part-of: odoo/odoo#134281
*:web_editor,portal
This commit aims at removing the need to rely on `$.browser`, which was
mainly the case to support deprecated and unsupported browsers like MS
Internet Explorer or old version of Firefox.
Doing so, this commit removes the `data-browser` attribute initialy
introduced by odoo/odoo@a7e0b73930 as not
needed anymore nowadays and to generally promote "feature detection"
instead of "user-agent sniffing" to handle browsers' feature support and
edge cases.
task-3439226
Part-of: odoo/odoo#133916
This commit adds an "on hover" option for animations. We've added the
"on hover" option to the animation selector. This feature is only
available for images. It allows you to pick an animation that triggers
when you hover your mouse over an image. There are six different
animations to choose from. This new animation option doesn't work with
animated shapes and devices shapes.
task-3094258
closesodoo/odoo#119197
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Users sometime want to rename existing controllers URL, e.g. /shop as
french /magasin. The feature is possible within Odoo thanks to 308 type
redirections that can be configured via a hidden ?debug=1-only website
menu.
Upon generating the routing-map (the structure that links URLs to
controllers), when a URL is found inside of the `website.rewrite` model,
two links (called Rules in werkzeug jargon) are registered: the new,
translated, URL is linked to the controller and the original URL is
linked to a redirection to the new URL.
For the context of this PR, it is important to note that the redirection
only applies to the very URL saved inside the `website.rewrite` model:
if a controller has multiple routes, e.g. `/shop` and `/shop/shop`, only
`/shop` is redirected to `/magasin`, `/shop/shop` is left as-is.
Without 308 redirection:
/shop -> def shop()
/shop/shop -> def shop()
With 308 redirection:
website.rewrite(from_url='/shop', to_url='/magasin')
/shop -> /magasin
/shop/shop -> def shop()
/magasin -> def shop()
The redirection is set on the routing dictionnary of the endpoint, this
is the dictionnary that collect the informations set via the `@route`
decorator (auth=, method=, type=, ...).
Prior to [HTTPocalypse], that dictionnary was duplicated so that the
redirection was applied on the single route endpoint that matched
the `website.rewrite` record. With [HTTPocalypse] that duplication has
been wrongly removed: all original routes redirected to the new
translated one.
Bug introduced in [HTTPocalypse]:
website.rewrite(from_url='/shop', to_url='/magasin')
/shop -> /magasin
/shop/shop -> /magasin <-- wrong
/magasin -> def shop()
This PR fixes the problem, it makes sure that the redirection is saved
*only* on the route that matched the website.rewrite record, not the
other routes.
[HTTPocalypse]: https://github.com/odoo/odoo/pull/78857closesodoo/odoo#133960closesodoo/odoo#134206
X-original-commit: 144a22c22c95004171860cdaecd1f7d7975dc468
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Since [1] if the partner related to a visitor belongs to a company that
cannot be accessed by the current user, an error is raised when trying
to display the list of visitors.
This commit makes the name obtained through an additional sudo on the
`partner_id` record which might not be accessible to the current user.
This is equivalent to using the `name` field of visitor, except that
accessing the `partner_id` field will fail if `website.visitor` itself
cannot be accessed.
Steps to reproduce:
- Go to Settings / Companies
- Create a second company
- Go to Website / Reporting / Visitors
- Select "Edwin Hansen"
- Navigate to its linked partner in the contact field
"Gemini Furniture, Edwin Hansen"
- Navigate to its company "Gemini Furniture"
- In the "Sales & Purchase" tab, assign the second company as the
Company
- Save (this creates an error - but it is saved)
- Go to Website / Reporting / Visitors
=> The page was not displayed and an access error message was
displayed.
[1]: https://github.com/odoo/odoo/commit/d348bed1ad9d3d16b295f013f015706be6c07820
opw-3462104
closesodoo/odoo#134190
X-original-commit: a75673217aef2ffaaa93585526dc1e647a270495
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
When we haven't provided a custom action, the tour step runs the default
action. In the final step of the tour, when there is no `run` or
`isCheck` provided, It shows warnings of 'ignoring action (auto) of last
step' as it can lead to a race condition.
This commit resolves the warnings: `ignoring action (auto) of last step`
task-3429500
closesodoo/odoo#129239
Related: odoo/enterprise#46683
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
As tempusdominus relies on jQuery, we have written our own date(time)
picker in owl. This commit converts the remaining uses of the
tempusdominus date(time) picker and replaces them by our own.
closesodoo/odoo#133349
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Since a recent change at [1], a race condition seems to occur in the
gray colors palette test. Indeed, the change removed some delay in the
hackish code that is meant to wait for CSS reload.
Instead of restoring that otherwise-useless delay, this commit actually
fixes an extra_trigger that was incorrectly made in this test when it
was introduced at [2].
In any case, we should develop a more consistent and uniformed way to
wait for a CSS reload during edition test tours. It is currently done
different ways in different tests.
Note: this targets 16.0 to fix the wrong extra_trigger at the source,
even though [1] was only made in later versions.
[1]: https://github.com/odoo/odoo/commit/c6f8f781150902f585e16087f4a3868a855f3bd8#diff-795af7752739f5f510f74e5ee9b5b04d18a851062a1a6b7350cbe406e30a409dL18
[2]: https://github.com/odoo/odoo/commit/ddf2e74b4cf503ba651174bc7f280bf2f31a215e
runbot-24371
closesodoo/odoo#133889
X-original-commit: 6f32c27d52f877bde18628eb06475f56bdd95432
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Steps to reproduce the bug.
- In website edit mode, add a form snippet to a page.
- Add a "number" field within this form.
- Modify the label of this field in the options and name it "Field 1".
- Add a "text" field to the form.
- In the options of the "Text" field, select "Visible only if" for the
"visibility" option.
- Then, choose "Field 1" and "Is greater than" in the two dropdowns that
follow.
- Enter "10" in the input below.
- Save the page.
- Enter "2" in the "Field 1" input.
- Bug: The text field is displayed, even though it should only be
visible if "Field 1" is greater than 10.
This bug exists since the "conditionally show form fields" feature was
added to Website (in this commit [1]). The bug happened because we were
comparing strings instead of numbers.
[1]: https://github.com/odoo/odoo/commit/2dcbfecf3c10687a2cd3af36335d5be70c904fce
opw-3449900
closesodoo/odoo#133838
X-original-commit: e4d64c9f4470874ca853bd871064bb8374c8b5cc
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
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
closesodoo/odoo#133144
Related: odoo/enterprise#46447
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
*: web, website_sale_stock
Since [1], the widgets allowing to edit the different colors of a color
combinations are gone, except the first one. This is because the qweb
rendering calls have been modified to use the new `renderToElement` util
which silently ignores root nodes if there are multiple ones in the
rendered template. In the same way, a specific dynamic snippet and a
stock feature were also broken.
After this commit, those three features will be restored. A crash will
now also occurs in case `renderToElement` is called to render a template
with multiple root nodes (that is actually how the two last broken
features were found, breaking during existing tests). For the first
feature, a specific test has been made too.
[1]: https://github.com/odoo/odoo/commit/6303a3eacdca012649a2ffda627b65c17a7217f1closesodoo/odoo#133068
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit removes the legacy session and adapts the modules where it
was used.
task 3439226
closesodoo/odoo#133153
Related: odoo/enterprise#46290
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
This commit removes almost all exports of the module services/core.js
(only the bus is left) and adapts the module that imported it.
task 3439226
Part-of: odoo/odoo#133153
Since [1] the line height is specified as an absolute height instead of
a ratio of the font size. This leads to multiline text with big font
sizes to overlap.
This commit removes the `rem` unit from the `body-line-height` primary
SCSS variable.
Steps to reproduce:
- Drop a text snippet.
- Select a paragraph.
- Change font size to 62.
=> Lines of paragraph did overlap.
In case the value had been edited before this fix, it will be shown
with the "rem" text within the option, which can be removed to update
the value to the correct behavior.
[1]: https://github.com/odoo/odoo/commit/388e4bb2bfcaebdd4ff30277fb49a034592d7086
task-3471117
closesodoo/odoo#133401
X-original-commit: a368dad33d128c95262053769e3f5de852d2be3a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
After this commit, we prevent the slideshow from appearing when clicking
on an "Images Wall" snippet image that has been set as a link.
Steps to reproduce the bug:
- Drag and drop an "Images Wall" snippet onto the page.
- Add some images in the snippet.
- Click on an image within the snippet.
- In the editor text toolbar, click on the "Link" button.
- Set the URL of the link to "/contactus".
- Click on the "Save" button in the modal.
- Save the page.
- Click on the image with the link.
- Bug: The slideshow briefly appears before redirecting to the "contact
us" page.
task-3425624
closesodoo/odoo#133396
X-original-commit: 8b29eabbd5a01ab225c93f519ea39724bdf3c0b9
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
In this PR,
Replace the manual tour steps with existing tour utils.
task-3279232
closesodoo/odoo#129317
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
*: web_editor, website, website_sale, website_slides
This commit removes the legacy storage (localStorage and sessionStorage)
and replaces it with the storage coming from browser.
Part of task-id 3439226
Part-of: odoo/odoo#133132
Due to a problem with eslint configuration,
few eslint errors were introduced during
09535ef5e6.
In this commit, these errors are fixed.
closesodoo/odoo#132963
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
*: auth_password_policy, bus, event, im_livechat, mail, mass_mailing,
mrp_subcontracting, point_of_sale, pos_self_order, project, stock,
survey, web, web_editor, web_tour, website, website_event,
website_forum, website_sale, website_slides, base
Historically, the web.assets_common bundle was used to contain assets
that were needed by both the frontend and the backend. In practice, this
caused a bunch of issues where people would add things in assets common
that were not needed by both, and it was also abused as a way to get
bootstrap working in unrelated places by only using that bundle's css.
Because of this, as a first step, the assets_common stop being used in
the frontend, but was left everywhere else.
This commit removes the bundle completely, and moves the files that used
to be in that bundle in the other bundles that need them, this will
allow those bundles to evolve independently going forward.
in im_livechat and mail, some of the unneeded legacy code was removed, this
allows us to avoind including all of the legacy code from web in the
livechat embed bundle and in the dicuss public bundle respectively.
closesodoo/odoo#132190
Related: odoo/enterprise#45884
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
In our continued effort to remove legacy code, this commit replaces
usage of the legacy delay util with a new delay util. The legacy
delay has been removed.
Part-of task-id 3439226
Part-of: odoo/odoo#132559
In our continued effort to remove legacy code, this commit replaces
usage of the legacy DropPrevious util with the KeepLast util. The legacy
DropPrevious has been removed.
Part-of task-id 3439226
Part-of: odoo/odoo#132559
In a SaaS server, the _meta_data variable will be translated when the
HTTP worker is spawned and it will be translated into whichever language
is set on the DB that spawns said worker. This causes issues when other
DBs use this worker as the variable may be translated into a language that is
not present in that DB. To rectify this issue, we use lazy translate so
the translation lookup is executed at rendering.
opw-3385997
closesodoo/odoo#132691
X-original-commit: b7a538998cfbb2428e6575bbac892a9aff26f0c5
Signed-off-by: Simon Goffaux (sigo) <sigo@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
This commit moves the ZoomOdoo library out of the web module and the
backend bundle (through the common bundle) to the website module (as
it's used by it and its dependent modules).
Part-of: odoo/odoo#130875
Issue
=====
The previous commit forced consistency between `check_access_rule` and
`_apply_ir_rule`. Now the parent model `ir.rule` (via inherited) is also
checked before the unlinking (`check_access_rule("unlink")`). The
`website.page` unlink override sometimes calls `unlink` on its parent
view and because view_id has `ondelete="cascade"`, it will actually
deletes the `website.page` itself. Then calling to `super().unlink()`
with self will raise a MissingError.
Fix
===
Batch the old logic and remove already unlinked record from `self`
before calling `super`.
closesodoo/odoo#125916
Signed-off-by: Raphael Collet <rco@odoo.com>
In this commit, all usages of env._t() are replaced by _t().
In templates files, env._t() didn't work because terms used
in attributes where not extracted into the translation files.
Only string are exported from .xml files to translation files.
So, to make it works, we set a variable that is then used
in attributes.
For example :
<t t-set="string_to_translate">String to translate</t>
<Dialog title="string_to_translate>...</Dialog>
task-3292454
closesodoo/odoo#131390
Related: odoo/enterprise#45631
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
Entering edit mode in the website builder is bound to ALT+A.
But often, you are on the frontend version on the page you want to edit
where you first have to navigate to the backend version of the page to
enter edit mode.
This commit adds the same shortcut in the frontend pages.
It's a low effort/small code added to have a really useful shortcut.
Even if there is no hint about this shortcut existence, it will be
found quite easily as people used to keyboard will, out of habit, press
this keyboard even in frontend (after a page reload eg, which navigates
to the frontend).
closesodoo/odoo#132236
X-original-commit: 09287915371032753593295df6c616f3bcb55ac9
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
__Current behavior before commit:__
If there is no link in one of the hamburger menu element,
`el.querySelector` will return `null` and an error will be thrown when
it tries to access `classList`.
__Description of the fix:__
Add a check on `itemLink` and `navLink` before accessing `classList`.
__To reproduce:__
1. Add 2 pages with long names to the website, make sure they are
included in the navbar
1. Open Website Editor
1. Click on the navbar
1. In the **CUSTOMIZE** tab, inside the **Navbar** section, change
**Mobile Menu** to `Off-Canvas`
1. Set **Mobile Menu > Off-Canvas Logo** to `Text`
1. Reduce the width of the page *just enough* so that the hamburger menu
appears instead of the navbar menus only when the web editor is on
1. Click on the hamburger menu, and remove the link of the "My Website"
text at the bottom
1. Exit the Web Editor
([Video](https://watch.screencastify.com/v/dWI3g6NnT5uRcp2KmBOO))
opw-3443200
closesodoo/odoo#131373
X-original-commit: 5b9eb3a1d016a16d395e9888ccd1606543eb99e2
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
Steps to reproduce (on Chrome with browser cache enabled):
- Go to website > Create a new blog post.
- Switch to edit mode > Add an image to the blog cover from unsplash.
- After save, switch to a secondary language > Unsplash images disappear
and you need to refresh the page to get them to appear.
This behaviour is a "very specific" Chrome related issue: when switching
language, Chrome cannot load inline background images correctly right
after the redirect... and unlike other image URLs, background images
don't have the language code prefix (The `url_for()` will add the
language code before the image "src" E.g. `<img src="/unsplash/...."/>`
=> `<img src="/fr_BE/unsplash/...."/>` when switching to `fr_BE`...).
The goal of this commit is to prevent this behaviour by adapting the
"background-image" URLs in the same way as image "src".
opw-3412961
closesodoo/odoo#131891
X-original-commit: 5f20f50f9a9fd4bc5145d380609cdca80a8d7511
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Change version of Chart.js from V2.9.3 to V4.3.0
You can find changelog on
https://www.chartjs.org/docs/latest/migration/v4-migration.html
Version 4.3.0 of chart.js no longer uses moment.js. This task is a
prerequisite to completely remove the use of moment.js (task 3391739)
Why add aspectRatio : 2 ? => Canvas aspect ratio (i.e. width / height,
a value of 1 representing a square canvas). Note that this option
is ignored if the height is explicitly defined either as attribute
or via the style. The default value varies by chart type; Radial charts
(doughnut, pie, polarArea, radar) default to 1 and others default to 2.
Why no more Chart.animationService.advance(); ?
There is no longer an equivalent in this version.
However, we have verified that the problem is no longer present in this
version.
Why use now getElementsAtEventForMode ?
It's clearly noted in the changelog. follow the link above.
task-3392075
Part-of: odoo/odoo#127259
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.
Part of task~3443861
Part-of: odoo/odoo#130467
As all templates are now rendered with ow engine, we need to replace
qweb.has_template with it's owl equivalent.
Part of task~3443861
Part-of: odoo/odoo#130467
As all the templates are now imported in the owl app, the templates must
comply to owl.
t-set of a property of an Object is not allowed in owl.
Part of task~3443861
Part-of: odoo/odoo#130467
This commit removes the qweb.render method, instead it will use the owl
render engine (renderToString or renderToElement).
Part of task~3443861
Part-of: odoo/odoo#130467