Commit Graph
8086 Commits
Author SHA1 Message Date
Michael (mcm) 36061a4ab0 [IMP] web: simplify owl_compatibility
This commit tried to remove owl_compatibility completely but its last
uses are either in refactoring or a bit complex to migrate. Instead of
removing the helpers completely, this commit simplifies them a lot and
makes them more readable and safe.

closes odoo/odoo#134295

Task: 3439226
Related: odoo/enterprise#46899
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-08 11:12:39 +00:00
Michael (mcm) 290a9b9055 [IMP] web_editor,*: use dialog service
*: 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
2023-09-08 11:12:39 +00:00
Arthur Detroux (ard) d8d71c5ce6 [FIX] website: fix traceback when refreshing with f5 or ctrl+r
[1] removed the `router.redirect` method but [2] which was forward
ported after from 16.0 used the redirect method where it still existed.

This causes a traceback when using f5 or ctrl+r.

This commit fixes that by using the proper method in 16.2+

[1]: https://github.com/odoo/odoo/commit/365fe390fdc814bc079419f0bd940b8edd652618
[2]: https://github.com/odoo/odoo/commit/45affc3a94f33478063d2e82be5e0c51df92fb5f

task-3458691

closes odoo/odoo#134764

X-original-commit: dec96bca556b8df23fb692587cb64b47a6a3206b
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-09-08 09:47:08 +00:00
Aaron Bohy dc680a4429 [REF] web,*: stop using and remove legacy utils
*account,web_editor,website,website_sale,website_slides

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

Part of task~3439226

closes odoo/odoo#134620

Related: odoo/enterprise#47044
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-09-08 08:29:58 +00:00
Lou (loha)andqsm-odoo 0d448d950c [IMP] website: generate text with a LLM for configurator pages
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

closes odoo/odoo#121021

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2023-09-06 22:40:22 +00:00
qsm-odoo bd456ec5b5 [REF] website: remove useless rendering check in configurator code
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
2023-09-06 22:40:22 +00:00
qsm-odoo fc80c15816 [REF] website: move code around the configurator_apply function
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
2023-09-06 22:40:22 +00:00
Arthur Detroux (ard) 9f82d4d98b [IMP] website: stay in backend on F5 or CTRL-R while in website preview
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

closes odoo/odoo#134444

X-original-commit: e69c6eaed4e82e08d6bbf807cf4698f6327a9cdd
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-09-06 21:27:00 +00:00
Guillaume (gdi) b16ab7b997 [FIX] website: allow to re-edit social media title
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

closes odoo/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>
2023-09-06 11:50:58 +00:00
Guillaume (gdi) 620cf19574 [FIX] website, web_editor: allow to re-edit social media icons
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
2023-09-06 11:50:58 +00:00
Pierre Paridans 0b8c9afb08 [IMP] website,*: removes compatibility layer for (really) old browsers
*: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
2023-09-05 19:58:08 +00:00
Benjamin Vray 7f730f81ec [IMP] web_editor, website: add an "on hover" option for animations
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

closes odoo/odoo#119197

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-09-05 18:44:17 +00:00
Julien Castiaux 94595ba992 [FIX] website: 308 wrongly set on all routes
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/78857

closes odoo/odoo#133960

closes odoo/odoo#134206

X-original-commit: 144a22c22c95004171860cdaecd1f7d7975dc468
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-09-04 19:58:33 +00:00
Benoit Socias 679ede2c32 [FIX] website: get the name of the visitor through the related field
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

closes odoo/odoo#134190

X-original-commit: a75673217aef2ffaaa93585526dc1e647a270495
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-09-04 19:58:32 +00:00
divy-odoo cea1cab535 [FIX] *: resolve the last tour step warnings
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

closes odoo/odoo#129239

Related: odoo/enterprise#46683
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-09-04 15:02:47 +00:00
Samuel Degueldre 910897fc97 [REF] web, *: remove tempusdominus date(time) picker lib
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.

closes odoo/odoo#133349

Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2023-09-04 09:19:08 +00:00
Romain Estievenart 507c368836 [IMP] *: remove jquery.ba-bbq 🍖
Task Id: 3439226

closes odoo/odoo#133763

Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-09-01 15:09:51 +00:00
qsm-odoo caca26ed41 [FIX] website: make gray colors test more robust
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

closes odoo/odoo#133889

X-original-commit: 6f32c27d52f877bde18628eb06475f56bdd95432
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-09-01 13:21:05 +00:00
Pierre Rousseau 82697d0b18 [REF] web, *: remove owl2 compatibility
*: mrp_subcontracting, point_of_sale, project, web_editor, website,
website_slides

Part of task-id 3439226

closes odoo/odoo#133551

Related: odoo/enterprise#46526
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-09-01 13:20:56 +00:00
Benjamin Vray fa8f33ced6 [FIX] website: fix number comparison for form field visibility
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

closes odoo/odoo#133838

X-original-commit: e4d64c9f4470874ca853bd871064bb8374c8b5cc
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-08-31 17:27:51 +00:00
Pierre Pulinckx (pipu) ce38e06801 [REF] *:replace moment usages with luxon
luxon and moment are both used in the solution, but these two libraries
facilitate the manipulation of dates. It was decided to replace all uses of
moment with luxon so we can then remove moment.js from the code and lighten
the assets.

task-3391739

closes odoo/odoo#133144

Related: odoo/enterprise#46447
Signed-off-by: Bruno Boi (boi) <boi@odoo.com>
2023-08-31 14:14:59 +00:00
Benoit Socias f300b53b67 [FIX] website: remove stable fix of body line height option
In [1] the stable patch of the body line height option was mistakenly
included in the forward port to master.

This commit removes that patch.

[1]: https://github.com/odoo/odoo/commit/89c93aba75a9c4d7e304c4decd4d5d3673d4df08

task-3471117

closes odoo/odoo#133555

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-08-30 13:10:24 +00:00
qsm-odoo 2cff7e4094 [FIX] website, *: restore cc edition widgets and other qweb rendering
*: 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/6303a3eacdca012649a2ffda627b65c17a7217f1

closes odoo/odoo#133068

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-08-30 13:10:21 +00:00
Michael (mcm) 1f5e8f0fd4 [IMP] web,*: remove web.session
This commit removes the legacy session and adapts the modules where it
was used.

task 3439226

closes odoo/odoo#133153

Related: odoo/enterprise#46290
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-08-29 11:10:47 +00:00
Michael (mcm) 629a046e03 [IMP] web,*: empty services/core.js
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
2023-08-29 11:10:47 +00:00
Michael (mcm) 55f1822911 [IMP] web,*: remove services/config.js
This commit removes the module services/config.js and adapts the module
that imported it.

task 3439226

Part-of: odoo/odoo#133153
2023-08-29 11:10:47 +00:00
Benoit Socias 89c93aba75 [FIX] website: remove "rem" unit from body line height theme option
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

closes odoo/odoo#133401

X-original-commit: a368dad33d128c95262053769e3f5de852d2be3a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-08-29 07:48:17 +00:00
Benjamin Vray f7ac68c31d [FIX] website: fix images wall with link on image
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

closes odoo/odoo#133396

X-original-commit: 8b29eabbd5a01ab225c93f519ea39724bdf3c0b9
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
2023-08-29 07:48:15 +00:00
divy-odoo c6f8f78115 [FIX] website_*: replace manual tour with utils
In this PR,
Replace the manual tour steps with existing tour utils.

task-3279232

closes odoo/odoo#129317

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-08-25 13:58:34 +02:00
Pierre Rousseau 2d9f6fb324 [REF] web, *: remove legacy registry
*: website, website_slides

Part of task-id 3439226

closes odoo/odoo#133132

Related: odoo/enterprise#46272
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-08-25 10:59:55 +02:00
Pierre Rousseau 609a7b234b [REF] web, *: remove legacy storage
*: 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
2023-08-25 10:59:54 +02:00
Pierre Pulinckx (pipu) 5e5178eb66 [FIX] website: fix lints in tour_utils
Due to a problem with eslint configuration,
few eslint errors were introduced during
09535ef5e6.
In this commit, these errors are fixed.

closes odoo/odoo#132963

Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2023-08-24 20:03:38 +02:00
Samuel Degueldre 6f95be6884 [REF] *: remove web.assets_common
*: 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.

closes odoo/odoo#132190

Related: odoo/enterprise#45884
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-08-24 15:11:05 +02:00
Jorge Pinna Puissant 497a56b36c [REF] web, *: remove legacy delay
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
2023-08-23 11:12:25 +02:00
Jorge Pinna Puissant 5ce4f3dd93 [REF] web, *: remove legacy DropPrevious
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
2023-08-23 11:12:24 +02:00
Simon Goffaux (sigo) 11b9767b3e [FIX] website_form: fix translation issue in saas
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

closes odoo/odoo#132691

X-original-commit: b7a538998cfbb2428e6575bbac892a9aff26f0c5
Signed-off-by: Simon Goffaux (sigo) <sigo@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-08-22 20:00:53 +02:00
Pierre Paridans a7b01e4a6a [IMP] web,website,website_*: moves zoomodoo lib out of web module
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
2023-08-22 18:58:54 +02:00
Rémy Voet (ryv) 1bceb01ff4 [FIX] website: fix unlink page with ir.rule
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`.

closes odoo/odoo#125916

Signed-off-by: Raphael Collet <rco@odoo.com>
2023-08-21 19:56:56 +02:00
Pierre Pulinckx (pipu) c07181b20b [REF] *: Replace env._t() by _t()
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

closes odoo/odoo#131390

Related: odoo/enterprise#45631
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-18 19:17:16 +02:00
Gorash 774a3fad0e [REF] base,all: Update modifier syntax: view migration
Apply of the migration script to update all view modifiers.

Part-of: odoo/odoo#104741
2023-08-18 09:49:13 +02:00
Romain Derie 594bf0c200 [IMP] website: add a shortcut to enter edit mode from frontend
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).

closes odoo/odoo#132236

X-original-commit: 09287915371032753593295df6c616f3bcb55ac9
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-08-17 19:51:21 +02:00
Romain Derie ec6677b79f [FIX] website: allow again external website redirect
Broken by commit [1], where only the `url_to` should've been part of the
check for 301/302. The rest of the `if` was about relative URL check,
routing map check and converter check, all related to 308 only.

Note that in the meantime, commit [2] was added in those checks and
needs to be part of 301/302 too.

[1]: https://github.com/odoo/odoo/commit/14a850976711431f36b7f889ea9cf31b1114513d
[2]: https://github.com/odoo/odoo/commit/26fa923f6ab01298bf1a1e9f6a615c9aa9e2e5ed

Fixes https://github.com/odoo/odoo/issues/129290

closes odoo/odoo#132114

X-original-commit: ec27fd45868318542f365ec4ec1b3c9d5084f586
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-08-16 20:03:42 +02:00
Julien (jula) a44fb24cb5 [FIX] web: check if navLink exists
__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

closes odoo/odoo#131373

X-original-commit: 5b9eb3a1d016a16d395e9888ccd1606543eb99e2
Signed-off-by: Luca Vitali (luvi) <luvi@odoo.com>
2023-08-16 16:05:22 +02:00
xO-Tx e70cc2ea86 [FIX] website: adapt background image URLs on language switch
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

closes odoo/odoo#131891

X-original-commit: 5f20f50f9a9fd4bc5145d380609cdca80a8d7511
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-08-16 14:21:46 +02:00
Pierre Pulinckx (pipu) 7e3c1ecdb8 [REF] *: Update Chart.js to V4.3
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
2023-08-16 12:47:34 +02:00
Arthur Detroux (ard) 276dbdad5a [FIX] website: properly check for title in SEO dialog
Commit [1] adapted the SEO dialog to OWL and to the move of the website
in the backend. While doing so, it omitted checking for the default
title when validating whether a keyword was contained in the page's
title.

In [15.0] the way this was checked was through a simple look through the
page's <title> tag.

However, in this commit, we do not look through the HTML, rather we use
the metadata "default_title".

[1]: https://github.com/odoo/odoo/commit/ac55f2bb113ecf7c774fe6e96d28e716184a97d1
[15.0]: https://github.com/odoo/odoo/blob/8deeabdbfbee20289d79151fa2821ce04585d0bd/addons/website/static/src/js/menu/seo.js#L233C16-L233C45

opw-3435547

closes odoo/odoo#131809

X-original-commit: ee200b4dd97d9725c69d6f8da427ce81eb6d0e8e
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-08-14 13:42:08 +02:00
Jorge Pinna Puissant e338487028 [REF] *: remove owl="1" from the templates
As all the templates are now imported in the owl app, there is not need
anymore to specify the owl="1" attribute in the templates.

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:30 +02:00
Jorge Pinna Puissant 123ba4ffcc [REF] website: replace qweb.has_template with owl equivalent
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
2023-08-11 14:32:30 +02:00
Jorge Pinna Puissant 363251986d [REF] *: remove t-set of a property of an Object
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
2023-08-11 14:32:28 +02:00
Jorge Pinna Puissant f956e83c74 [REF] *: remove qweb.render
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
2023-08-11 14:32:28 +02:00