Commit Graph
4240 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
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
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
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
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
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
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
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
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
Jorge Pinna Puissant 7b1d82aa9b [REF] *: add t-key when needed on the template
As all the templates are now imported in the owl app, the templates must
comply to owl.

t-key is mandatory when using a t-foreach

Part of task~3443861

Part-of: odoo/odoo#130467
2023-08-11 14:32:27 +02:00
VAN BOSSUYT Nicolas 144e17e5d2 [FIX] website: prevent date input to fallback on today's date
The cause of the issue is that `datetimepicker('viewDate')` will return
the datetime of today by default event if the user selects nothing, to
remedy this, we now check if the user has chosen something before
storing the content of the field in `form_values`.

Step to reproduce:
- Install website_crm_partner_assign to have the "Partnership Date"
  field on res.partner.
- Install website_sale to have the "Create customer" capability on the
  website forms.
- Drag & drop a form snippet on any page
- Select "Create customer" as form action
- Add a custom field "Partnership Date"
- Submit the form without filling the Partnership Date field
- The field will be set to today's date while it should have been left
  void.

opw-3333364

closes odoo/odoo#131614

X-original-commit: 0a5668d36cc43cf346c5aecb9236d690a6694a45
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-08-11 10:29:24 +02:00
Louis Wicket (wil) f1722c7334 [IMP] *: unify sprintf and gettext
Improve gettext to directly handle value injection within translations,
removing the need for sprintf.

closes odoo/odoo#123932

Related: odoo/enterprise#45370
Signed-off-by: Samuel Degueldre (sad) <sad@odoo.com>
2023-08-10 18:14:04 +02:00
Julien Carion (juca) b1b4120f2a [FIX] website: replace notification.notify
This commit replaces notification.notify with notification.add so that
it works without the legacy notification service.

Steps to reproduce:
- go to website settings
- add a new website with any name
- follow the steps and upload an invalid file as the logo

fix for https://github.com/odoo/odoo/commit/caefcb8590301a0ebbe947a875003b33ce7d537a

task-3338012

closes odoo/odoo#131422

X-original-commit: 0d7971e0ed7eee5b5e983c27a13c6a34457f4505
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-10 09:12:34 +02:00
Stanislas Gueniffeyandqsm-odoo 7880c1599b [FIX] web_editor, *: add system for editable medias in non editable envs
*: website

Some specific media items are meant to be editable even though located
in non-editable environments. The typical case in 15.0 is the website
"Team" snippet: it is made of multiple bootstrap rows, each containing
a column with an image and a column with texts. The columns with the
image are only meant to hold that image, it was therefore marked as
non editable to prevent users adding text in there by mistake... but the
image is still meant to be editable. See [1], later fixed by [2].

The problem now is that the system that [2] had to use is quite messy:
the column is marked non editable thanks to the `o_not_editable` class
but the inner images were to be declared editable via some custom JS
method overrides (`_getContentEditableAreas`). The debate about if we
should keep a class-based system and/or a method-override system will be
left to master. This commit although comes with an uniformisation about
this, introducing a new class to declare "an editable media despite its
non editable environment". This is not a counter-part of the class
`o_not_editable`: we do not want the media to be marked with the
`contenteditable` attribute. Indeed, this is actually required since [2]
was not enough to solve the problem. See those steps:

- Add a company snippet in your page
- Change one of the images by an icon
- (Save / Reenter edit mode)
- Try to change the icon again / edit its options

=> You can't. Indeed [2] relied on the media being an image to re-enable
edition on it... but even if it did not, it would not have been enough.
Indeed, icons are forced to being `contenteditable="false"` by the new
editor library (since 15.0 then), last update on that at [3].
We thus needed a different way to differentiate editable media, hence
the introduction of the new `o_editable_media` class.

Note: this system is not perfect, but so is not the whole system about
determining what is editable or not at the moment. In this case, it may
exist cases of a media marked with the class to be editable but end up
in an environment which is not editable by force (xpath somewhere etc)
... and ends up being editable anyway. Most cases work though and at
worse it will be about a non editable image being editable but not
possible to save in very rare cases. As advertised, the whole system
about what is editable or not should be improved.

[1]: https://github.com/odoo/odoo/commit/30db617bc8ff7727f40d7ef58c6578e84a13f284
[2]: https://github.com/odoo/odoo/commit/61270ee8bffb6e85f8ff0d19c7a3889fdce2f486
[3]: https://github.com/odoo/odoo/commit/7646429e894f28f398b7b212e893822c06c7b03d

task-3226172

closes odoo/odoo#131139

X-original-commit: 436265e815684046a37a8b80e4cd520c2bd637f0
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
2023-08-09 21:01:17 +02:00
Nasreddin Boulif (bon) 070d257fb0 [FIX] website: allow to translate appointment page on website
Steps to reproduce:

  - Install `website_appointment` module
  - Activate a second language on main website
  - Activate debug mode
  - Go to Website -> Configuration -> Online Appointments
  - Share multiple appointment and copy the link
  - Open the link in a new tab
  - Switch to second language
  - Open editor and click on `Translate` button

Issue:

  Traceback is raised.

Cause:

  When sharing multiple appointment and opening the shared link, we are
  redirected on the page to select the right appointment and we have the
  key `filter_appointment_type_ids` (with the IDs of the appointments)
  with the value already encoded.
  e.g: `[1, 3]` => `%5B1%2C+3%5D`.

  When translating a page by redirecting to the same URL (but encoded)
  with param `edit_translations` set to 1, the URL is re-encoded and
  therefore the value of the key `filter_appointment_type_ids` is double
  'encoded' and broken/not possible to parse.
  e.g: `%5B1%2C+3%5D` => `%255B1%252C%2B3%255D`.

Solution:

  Don't re-encode the updated URL; `goToWebsite` is expecting a non
  encoded path and is in charge of the re-encoding it.

opw-3409757

closes odoo/odoo#131150

X-original-commit: 574d7847bda5c6e21934f815f64d0d4ce3f70b8b
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-08-09 03:07:50 +02:00
Pierre Pulinckx (pipu) b1ebe3b6f4 [REF] *: Replace core._t imports
In this commit, _t import from import { _t } from
"@web/legacy/js/services/core" and from
 web/static/src/legacy/js/core/translation.js are replaced by
@web/core/l10n/translation.js.

task-3292454

closes odoo/odoo#130865

Related: odoo/enterprise#45270
Signed-off-by: Michaël Mattiello (mcm) <mcm@odoo.com>
2023-08-09 00:13:08 +02:00
Michael (mcm) 00d8aef1c7 [REF] web, *: remove legacy patch
This commit removes legacy patch/unpatch functions and adapts their use
by using the modern patch. There was also a custom patch function used
in tests which has been replaced too.

closes odoo/odoo#130867

Related: odoo/design-themes#685
Related: odoo/enterprise#45271
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-08-07 10:58:48 +02:00
Aaron Bohy 435834915e [REF] web, website: move initAutoMoreMenu to website
There's a single usecase left for this helper, which is in website.
This commit directly moves the function definition in the file
using it.

Part of task~3439226

closes odoo/odoo#130843

Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-08-04 16:34:51 +02:00
Aaron Bohy 6774530101 [REF] web,*: remove KeyboardNavigationMixin from website
This mixin was still applied on the RootWidget but was useless
since the website relies on the hotkey service [1].

This commit ends the life of the frontend_legacy asset.

[1] https://github.com/odoo/odoo/commit/daf5963845a8dda4d669e512a4ef6dcfebdd8813#diff-fe005825c9360edbc616517111aa67926161221c42003cad29f88a0214cd909eR13

Part of task~3439226

Part-of: odoo/odoo#130843
2023-08-04 16:34:50 +02:00