Commit Graph
8353 Commits
Author SHA1 Message Date
Romain Derie b96354fa55 [FIX] web_editor, website: remove clone button on mega menu block
Step to reproduce:
- Create a mega menu
- Enter edit mode and select it
- You can duplicate the top level block (but not remove it)
- If you duplicate it, you end up with a second top level block that you
  can't delete ever, even by deleting inner elements one by one.

Technical details:
1. The remove button of the mega menu is already hidden thanks to commit
   [1] which used the `forceNoDeleteButton` editor option introduced
   with commit [2].
2. The table of content snippet also need to hide both the delete and
   clone button. It was done in an "non-ideal" way with commit [3].
3. The delete button removal for table of content snippet was actually
   improved to use the `forceNoDeleteButton` option of commit [2].
4. It's also commit [1] which prevent the deletion of the top level
   block when deleting inner elements one by one: when the last one is
   deleted, it regenerates the whole block.

This commit thus simply makes it so `forceNoDeleteButton` also hides the
clone button.
A first solution was made by introducing a new `forceNoCloneButton`
option, but there is good chances that you always want to either hide
both or show both, so merging those options for now is the simplest
solution.

It also takes the opportunity to remove the (now) useless code in the
table of content snippet.

[1]: https://github.com/odoo/odoo/commit/97810a9c40396bb27cb5779937734849d185cf1f
[2]: https://github.com/odoo/odoo/commit/7ef484377a493ebe558242480d0da6b542d6c247
[3]: https://github.com/odoo/odoo/commit/9fb2dad97cfbd412bee3cb5d1358a9835e721f60#diff-ea32a091d6b1a47aeea680fa39bbc9111260cbdaf07e9f388a9d04741806ea8fR128-R129

opw-3604033
opw-3627319

closes odoo/odoo#146745

X-original-commit: 44b006778df913b847c58b3e405d2a177fcb1a7c
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-12-19 11:03:54 +00:00
Yannick Tivisse 7466ecd400 [FIX] website: Make tests demo data independent
Part-of: odoo/odoo#146649
2023-12-18 23:32:05 +00:00
Pierre Paridans b9fd7c5ac9 [FIX] website: broken assets test on multi website
The `test_01_multi_domain_assets_generation` was introduced in PR [1].
But afterward, the commit [2] introduced a unique constraint on the
`domain` field. With this additional constraint, this test broke when
run with multiple existing websites as it assigns the same domain for
each of them.

This commit made the dummy domain assigned in this test non-unique,
which doesn't alter the original meaning of the test but, allows to run
it with multiple existing websites.

[1]: https://github.com/odoo/odoo/pull/118526
[2]: https://github.com/odoo/odoo/commit/507db4e179514d171ec82e8ea0cbaf2323a6c30d

runbot-20848

closes odoo/odoo#146666

X-original-commit: 0c522e42a82ec596e69611c556c4fc0d50e6e978
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Pierre Paridans (app) <app@odoo.com>
2023-12-18 21:13:03 +00:00
Benjamin Vray 078903948f [FIX] website: fix button snippet
The commit [1] of this PR [2] has been merged requesting some changes to
be made later, which are fixes to the button that can now be dropped
onto the page from the snippet menu.

This commit makes the following changes requested:

- Before this commit, when we duplicated a button (by clicking on the
"duplicate" button), the style of the new button was generated again in
Javascript in the "_adaptButtons" function even though it is not
necessary since we duplicate the HTML of the copied button. That is why
this commit adds the "adaptAppearance" parameter for the "_adaptButtons"
function.

- Prior to this commit, when a button was dropped between two buttons,
the style of the next button was copied as a priority. After this commit
, the style of the previous button is now copied as a priority.

[1]: https://github.com/odoo/odoo/commit/507b80a12574ce19bcb925d88868fb377b1c4b06
[2]: https://github.com/odoo/odoo/pull/126717

task-3555413

closes odoo/odoo#139621

Signed-off-by: Robin Lejeune (role) <role@odoo.com>
2023-12-18 10:58:39 +00:00
Benoit Socias 952ebac37d [FIX] website: fix border color or button preset preview
Since [1] when website was moved to backend, with the introduction of
the iframe, the preset previews are replicating the CSS of the page.
In [2] the mechanism was adapted to make it faster, but in the new
replication the `border-color` of buttons was wrongly copied from the
`background-color` of the buttons.

This commit uses the right variable instead.

[1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b
[2]: https://github.com/odoo/odoo/commit/7f5a9d040348048990b25c271875c77d2c314e4d

task-3642550

closes odoo/odoo#146587

X-original-commit: b69658898e6944f86d17460e214c529f68c66a10
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-12-18 09:31:45 +00:00
Odoo Translation Bot 304a6caa14 [I18N] Update translation terms from Transifex 2023-12-17 00:08:26 +01:00
xO-Tx bcfd1491db [FIX] website: prevent editing the record cover
Steps to reproduce [1]:

- Go to website (blog post page) > Change the layout of the cover
(Customize > 'Regular' Cover).

- Click on the cover (in edit mode) > You can type anything inside and
use the text tools (E.g. if you add an image from the toolbar, it will
be added on all blog posts).

Steps to reproduce [2]:

- Go to website (`/calendar` page) > Unpublish an appointment page.

- Go back to the `/calendar` page > Switch to edit mode > You still can
edit the "unpublished" tag on the items cover (add text, images,...
using text tools).

The editor uses some methods (`getContentEditableAreas()`,
`getReadOnlyAreas()`,...) to check if an area should be marked as
editable on load, there is already a cover selector used to define a
record cover as an editable zone, but this selector is targeting the
whole element, leading to the behaviour described in [1] and [2]. We
actually just need to set the savable content (usually the record `name`
and `subtitle` fields) as editable and not the whole element.

The goal of this commit is to fix this behaviour by removing the cover
along with its descendants from the initial editable zones (especially
to prevent the scenario in [2], see: $editableSavableZones) and only
setting the savable fields as editable areas.

opw-3561659

closes odoo/odoo#146407

X-original-commit: 333e437d6acb227f092f1d152fe68d49076cff94
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
2023-12-15 18:28:40 +00:00
Guillaume-gdi d94c46a1b0 [FIX] web_editor: prevent ZWS to break link tools
Since [this other commit], we add ZWS characters to the edges of links.
Unfortunately, this breaks the label option of the link tools that has
been introduced in [this commit].

Steps to reproduce the issue:
- Go to website
- Edit a page
- Click on the contact us button in the header
- Using the label option of the link tools, delete the final character

=> Nothing happens.

The final character is not deleted as expected.

[this other commit]: https://github.com/odoo/odoo/commit/ab40f484d55e151e175ccf9d6b3ea3bf34c56b35
[this commit]: https://github.com/odoo/odoo/commit/75166dbcd4962f30624fe19829757acbf8e76022

Related to runbot-44779

closes odoo/odoo#146361

X-original-commit: 593dc52cd5c3362c446395a52a7782f74f445e34
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
2023-12-15 13:05:36 +00:00
Romain Derie b42e9cc686 [FIX] website: restore default checked value for form checkboxes
Before this commit and since PR [1], the default "checked" value set on
checkboxes field on the form snippet were lost once the page is saved.

This is because [1] changed the rendering engine of qweb templates from
our own qweb js rendering code to owl templates rendering.
By doing so, `t-att-checked="'checked'"` would toggle the "internal"
checkbox checked value but would not add the checked attribute on the
element.

It's a deliberate choice made in owl. As the checked attributed does not
mean the same as the internal checked value, it makes sense.
Indeed, the checked attribute is about the default value of the checkbox
while the checked internal value is about the current checked state of
the checkbox.

In React, for instance, the same behavior can be seen. And if one wants
to really set the checked attribute, they got to go with
`defaultChecked`.
Same apply with `value`.

Maybe owl will implement the same `defaultXXX` behavior in the future as
it's something that was already discussed on their side.

Step to reproduce:
- Drag & drop a form in the website builder
- Add a new custom field and select "Multiple Checkboxes" type
- Set one of the checkbox checked by default
- It is visually checked, but the attribute is not set
- Save the page

-> The checkbox is back to unset state since the attribute was not set

[1]: https://github.com/odoo/odoo/pull/130467

opw-3607795

closes odoo/odoo#146328

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-12-15 11:40:44 +00:00
Romain Derie 2a2fd932af [FIX] website: fix toggle redirect compressed layout in page properties
Before this commit and since [1] when the website builder was moved from
the "frontend" to the "backend" of Odoo in Odoo 16, the option to enable
URL redirect when updating a page URL was "compressed":
- The toggle/switch element has not enough room to be displayed entirely
  if there were too many dependencies
- The toggle/switch label was split in multiple lines, words could even
  be split in 2.

Step to reproduce:
- Go to / in the website builder (so the / finds a lot of dependencies)
- Open page property
- Change the URL field, you see the redirect url field appear with the
  mentioned issues.

Note:
- In other languages, the switch label could be even longer, splitting
  the line makes even more sense
- Removing a class is generally something to be avoided in stable, but
  this type of class should not be xpath'd anyway. And given the
  template structure, it's unlikely someone would have xpath it as it's
  easy to xpath any element without relying on classes.
  One solution would have been to add a new class to cancel the first
  one but it seems overkill in this case.

[1]: https://github.com/odoo/odoo/commit/2ef7e788263b4742a8e0788f47673b7b31da3726

closes odoo/odoo#146244

X-original-commit: 8c17c487e6632192874133a2ce4265a0f1eaf6fb
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-12-15 01:36:01 +00:00
Romain Derie f57b92a8de [FIX] website: remove duplicate action in page list view
Before this commit and since commit [1], it was possible to clone a page
in the page list view.
It shouldn't be the case, cloning a page lead to bad result: a page
with the same URL which is not shown in the page list view because pages
are filtered by URL to remove duplicates.

Cloning a page has always had to be done through the page properties >
"clone page" button. Doing it this way will ask the user for a new page
name (and so a new url). The page will then correctly be listed.

[1]: https://github.com/odoo/odoo/commit/3192051806e0da1276604a31ad818f8768105362

opw-3591738

closes odoo/odoo#146173

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-12-15 01:35:57 +00:00
Benjamin Vray 3803406298 [FIX] website: fix misaligned elements in headers
This commit correctly aligns certain header elements when the CTA button
has a larger vertical padding.

Steps to reproduce the issue:

- Install 'eCommerce' on your website.
- In Website edit mode, click on the 'THEME' tab.
- Adjust the vertical padding of buttons to 25px.
- Click on the header in the page.
- In the 'STYLE' tab, select the 'Menu - Sales 1' header.
- Bug: The 'logo" and the 'menu items' are not aligned with the CTA
button.
- In the 'STYLE' tab, select the 'Menu - Sales 2' header.
- Bug: The 'menu items' are not aligned with the CTA button.
- In the 'STYLE' tab, select the 'Menu - Sales 4' header.
- Bug: Bug: The 'cart' button is not aligned with the CTA button.

task-3478334

closes odoo/odoo#145683

X-original-commit: d2f6710bcaa5cee7e77fc4df902929264ffa4830
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
2023-12-14 17:56:58 +00:00
Romain Derie dede76bd5c [FIX] website, website_form_project: set email_from as custom for task
Commit [1] removed the `email_from` field from the `project.task` model
but forgot to adapt/delete some field occurences.

One of those is related to the form in the website builder which allows
to create task when the form is sent.

Two errors were detected:

- Non critical:

  The field is still passed to the form field whitelisting process.
  Since the whitelisting is done in raw SQL, it didn't crash or log
  anything even if the column did not exist anymore.

- Critical:

  The field was still marked as model required in the form JS registry,
  altering the form builder behaviors.
  One of those is that when the form input related to this field was
  re-created (eg when changing / hovering an option in the right panel),
  it would lose it's "name" attribute.
  Two possible issues from that point:
  1. When a visitor submit the form, the "email_from" field value is not
     set anymore in the task description and that information is just
     lost. You then have no way to reach back to him.
  2. (Minor) The auto-fill behavior of the form was not working anymore

Probably more issues were introduced but only those ones got detected as
of today.

Step to reproduce:
- Drop a website form, choose "Create a Task"
- Focus the default "Email" field
- Hover the mouse on the "eye" icon ("Invisible") next to the Position
  attribute. If you inspect the DOM, the input has now lost the `name`
  attribute.
- If you save, you will face the issues reported above.
- If you then reopen the editor and focus the email field again, the
  tooltip will now say that the "null" field is required.

[1]: https://github.com/odoo/odoo/commit/a424cf481c676a230beeb6102fc67bedf472a882

opw-3626573

closes odoo/odoo#146170

X-original-commit: 6679fddbcaf7d9146ab242e0eed61ee0628f047f
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-12-13 17:12:01 +00:00
Xavier-Do 30db58e5e6 [FIX] base, website: don't cleanup invalid bundle
Before this commit the clean_assetbundle could unlink invalid
attachment, mostly when generating a no website assetbundle with
a different version than a website one, the website assetbundle will be
deleted.

Generating a new asset bundle attachment /web/assets/439-b4c80c3/1/web.assets_frontend.min.css (id:439)
Generating a new asset bundle attachment /web/assets/440-3723971/web.assets_frontend.min.css (id:440)
Deleting attachments [439] (matching /web/assets/%-%/web.assets_frontend.min.css) because it was replaced with /web/assets/%-3723971/%%%

The issue is that %-%/ will match 439-b4c80c3/1/ and not only
439-b4c80c3/

Note that it looks like this issue existed for a while but was invisible
because before 16.4 clean_attachment was invalidating the ormcache,
hiding the fact that a still valid asset was deleted and regenerated.

The proposed fix replaces the domain with %-_______/. The unique is
always 7 character long. Note that this change was already made in 17.0
when removing the id from the asset url so this doesn't need to be
completely forward-ported.

opw-3558552

closes odoo/odoo#145452

X-original-commit: 2ac466547e01bfd65415a53ae1efc9d45d9299fb
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-12-13 14:15:40 +00:00
Romain Derie 8bfc6bcb3a [FIX] website: restore page dependencies tooltip in page property
See commit [1] for in-depth explanation and framework-js change but
basically, `renderToElement` do not allow multiple root nodes since
[2].

The fix is just about using the correct method to render multiple root
nodes. Without the fix, it just crashed when you click on the page
dependencies links.

Step to reproduce:
- Go to /
- Open Page Properties
- Edit / to /test
- A list of possible dependencies will be shown, it's a link that can be
  clicked to open a tooltip to have more details
- Clicking on it crash without this commit

[1]: https://github.com/odoo/odoo/commit/2cff7e4094ebb4b56ab17a1462ff358b4b3e7ffd
[2]: https://github.com/odoo/odoo/commit/6303a3eacdca012649a2ffda627b65c17a7217f1

closes odoo/odoo#145715

Signed-off-by: Benjamin Vray (bvr) <bvr@odoo.com>
2023-12-12 17:03:41 +00:00
Thomas Lefebvre (thle) d8944533e3 [FIX] website: prevent default submit
Steps to reproduce:
-------------------
- on ecommerce, activate "Extra Info" feature;
- go to the extra info form;
- write something for "Your Reference";
- press Enter.

Issue:
------
The Bad Request message is displayed.

Cause:
------
Pressing Enter triggers the form's default submit.
To use the controller of the `/website/form/shop.sale.order` route,
we need to apply the JS logic of the `s_website_form`
widget (the `send` function).

Solution:
---------
Add an event for the `submit` which will prevent
the default behaviour and send the form data.

opw-3591135

closes odoo/odoo#145707

X-original-commit: 14fc7f3c923847f5e052888c2cfda0bf92316972
Signed-off-by: Thomas Lefebvre (thle) <thle@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-12-11 09:56:54 +00:00
Robin Lejeune (role) 41bc480b7b [FIX] website: avoid infinite redirects in iframe on Chrome
If you have the backend in a language A but the website in English only,
you can:
1) modify a record's (event, product...) name in language A (say "New
Name").
2) visit the page `/new-name-11` => the server will redirect you to the
English page `/origin-11`, with the only slug that actually exists on
the website. Chrome caches the redirection.
3) give the same name in English as in language A, try to visit
	=> the server now wants to access `/new-name-11`
    => Chrome uses the cache to redirect `/new-name-11` to `/origin-11`,
    => the server tries to redirect to `/new-name-11`
    => infinite loop, Chrome puts an end to it after ± 20 redirects.
In effect, Chrome injects a "Too many redirects" layout inside the
iframe, which in turn raises a CORS error when the app tries to update
it.

At the time of this commit, the flow described here should be expected
of users, because the translation UI in the backend is not clear: the
default field displayed is in language A even though the website does
not use it, and the way to update translations is not obvious (you have
to click on the language tag, which doesn't look like a button).

Another way to artificially reproduce the issue would be:
- Create a website.redirect from /dog to /cat
- Same from /cat to /dog
- Go to /@/dog

After this commit, if we detect that behavior, we reload the iframe with
a new query parameter, making the URL brand-new (and not cached) for
Chrome.

opw-3479651

closes odoo/odoo#145306

X-original-commit: 16d47ddf128f31f13e8d0d74597635faf7f9702a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Robin Lejeune (role) <role@odoo.com>
2023-12-11 09:56:50 +00:00
Odoo Translation Bot 8ab45d4a85 [I18N] Update translation terms from Transifex 2023-12-10 00:12:46 +01:00
Guillaume-gdi d2fdecd7b3 [FIX] website: lower case industry name in configurator
This commit converts the industry name in the configurator to lowercase
it in order to optimize the IAP placeholder cache.

task-3626875

closes odoo/odoo#145231

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-12-08 00:08:50 +00:00
Benjamin Vray c0ce960582 [FIX] web_editor, website: fix highlight animated text icon
Steps to reproduce the bug:

- In Website edit mode, drag and drop a 'Text-Image' snippet onto the
page.
- Select the word "Subtitle" in the title of the snippet.
- Click on the 'Animate' button in the editor toolbar.
- Bug: The 'Highlight Animated Text' icon that appeared on the right of
the title ("Inline Text") of the editor toolbar is too big.

task-3597377

closes odoo/odoo#144892

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-12-08 00:08:48 +00:00
Romain Derie 5d50a6b20f [IMP] website: remove useless lang redirect on /robots.txt
Same as what was done:
- in 2019 for favicon.ico at [1].
- in 2018 for sitemap.xml at [2].
- in 2015 for many controllers at [3].

Note that it's not about crawlers/robots, because those won't go through
the lang redirect (see `is_a_bot()`).

It's just to avoid a redirect which has no meaning/sense when requested
by real users. /robots.txt is not language dependent.

[1]: https://github.com/odoo/odoo/commit/94bcbc92e5e5a6fd3de7267e3c01f8c11fb045f4
[2]: https://github.com/odoo/odoo/commit/708ad186d52aff9270ea73888326370ada2fbc71
[3]: https://github.com/odoo/odoo/commit/a696913364ffc4d5f1ce0675bc9be82f84f3ff93

closes odoo/odoo#145018

Signed-off-by: Jérémy Kersten <jke@odoo.com>
2023-12-06 11:22:09 +00:00
Guillaume-gdi fc6630a2d7 [FIX] web_editor, website: prevent drop elements next to editable media
In the past, it was possible to drop elements in non-editable areas.
Commit [1] fixed the issue but then commit [2] added a solution to be
able to edit a media element that is in a `o_not_editable` environment.
Unfortunately, the solution makes it possible to drop elements next to
the `o_editable_media` elements ignoring the editable context (ignoring
the first fix).

Steps to reproduce the issue:
- Enter website edit mode
- Drop a Team block in a page
- Click on the Team block

=> The user is able to drop a "Text highlight" block next to the team
member pictures.

This commit
- reverts the commit [1] because in the meantime, the commit [3] fixed
the issue.
- fixes the Team block issue.
- fixes the filterFunc for the drop-in.
- adds a test to ensure the issue doesn't come back.

[1]: https://github.com/odoo/odoo/commit/67924648676b37898aedd86bc32868299aee542c
[2]: https://github.com/odoo/odoo/commit/580f1b77ce0b96b7efbf83a0ccdf6979bbf0e904
[3]: https://github.com/odoo/odoo/commit/ae7452f18dbd6ed56dbf883ae8495382b336aa78

opw-3536227

closes odoo/odoo#144806

X-original-commit: 9b4c2498b8fa2bc0aca604b6256e6c805b9b4c10
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
2023-12-05 19:53:33 +00:00
Odoo Translation Bot 2ac98dc2e5 [I18N] Update translation terms from Transifex 2023-12-03 00:18:54 +01:00
Benoit Socias 9f845c0942 [FIX] website: survive missing manifests when generating templates
During upgrades, customization modules are defined in the database but
their codebase is not in the addons path.
Because of this, when running an upgrade the manifest of such modules
does not exist which makes `_generate_primary_snippet_templates` fail
because it cannot locate some default keys.

This commit adapts the access to the manifest in order to use a default
value in case the manifest is not available.

closes odoo/odoo#144222

Related: odoo/design-themes#751
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-12-01 18:14:16 +00:00
Benoit Socias cb5dcf4839 [FIX] website: avoid duplicate key generating configurator templates
If the first theme that generates configurator templates has the same
block used several times within a single page, a unique constraint is
violated because it tries to create several identical
`configurator_<pagename>_<s_snippet_name>` templates.

This commit avoids this by only considering unique snippet names.

The issue typically appears with `s_title` on `theme_monglia` and
`theme_real_estate` if they are installed by themselves.

Part-of: odoo/odoo#144222
2023-12-01 18:14:16 +00:00
Benoit Socias 7fecf17047 [FIX] website: enable pseudo configurator page in themes manifests
When shapes were extracted to configurator snippets in [1], some
configurator-specific snippets were created that do not appear on pages
of the specific theme.
Because in [2] the call to `_generate_primary_snippet_templates` is done
on a full list of themes instead of only the installed ones, the problem
was not noticed: if any theme defines a block, it's website-side
configurator-specific template is generated.
This is not the case during an upgrade: the templates are generated only
for the installed themes. Because of this some "useless" configurator
templates trigger an error when importing their XML definition because
their parent template does not exist.

This is fixed in design-themes by adding those templates in a pseudo
page `_` in the `configurator_snippets` entry of each theme's manifest.
This commit makes sure to not consider that `_` page name as an actual
page name.
In master, the templates will be removed instead.

[1]: https://github.com/odoo/design-themes/commit/d206c119720d557c11320ebb3d7339890b8f9efa
[2]: https://github.com/odoo/odoo/commit/928eeca714a161f6bc03343e4dc8af9b050b9841#diff-f49a1e9eda23df9f1d48121ba376a5fabafe70ea18b29d4eab23d737e5d4eeb6R446

Part-of: odoo/odoo#144222
2023-12-01 18:14:16 +00:00
Martin Trigaux 2d75cc8d90 [FIX] website: do not use shared category
The website_page_controller_expose is a technical model for portal and
public, not for employee

The side-effect of the change was that, before this commit, the
category Website was no longer a selection but a list of boolean only
accessible in debug mode

closes odoo/odoo#144342

Signed-off-by: Vranckx Florian (flvr) <flvr@odoo.com>
2023-12-01 17:08:03 +00:00
Julien Castiaux e5cc17323d [FIX] http_routing: error occurs if the path is not "latin1" string
For multi language website, when request http:/localhost/en/something,
Odoo reroutes from the requested path /en/something to the new path
/something with lang=en_US in context.

If the new path is a unicode string like http:/localhost/vi/xin-chào,
http:/localhost/ru/привет, a error should occur at
werkzeug._compat.wsgi_decoding_dance() because the path was not latin1
string.

The utf-8 encoding followed by a latin-1 decoding is required by the
WSGI specification[^1]. latin-1 is used as an encoding passthrought:
that encoding has a representation for all the 256 bytes, i.e. it is
impossible that decoding a text will raise a ValueError. The WSGI spec
uses this trick to save values until the actual charset (present in
the Content-Type header) in known.

[^1]: https://peps.python.org/pep-3333/#a-note-on-string-types

closes odoo/odoo#143898

X-original-commit: 9b69b87c08b1d62b3581fe651bee692a4f217dff
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-12-01 15:51:55 +00:00
xO-Tx b4ee432d11 [FIX] website: fix animated text selection
The goal of this commit is to prevent the text animation overlay from
blocking small text content selection.

Remark: This behavior was already fixed on 17.0 (by [1]) for text
animations and highlights and was backported here for text animation
options.

[1]: https://github.com/odoo/odoo/commit/f64c9f27f1a9106bc009ad2f696845f2c5c58066

Related to task-3285817

closes odoo/odoo#144086

X-original-commit: b69e105149e5f0dc6a469068ab037b717e017144
Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
2023-11-30 11:44:58 +00:00
Soukéina Bojabza f0e3682b80 [FIX] website: consider <span> icons in Social Media snippet
In the Social Media snippet options, only icons with a `<i>` tag are
considered when updating the social media classes (when adding a new
social network by copying the first one and when replacing the icon by
another one matching the URL). However, there are cases where the icon
is a `<span>` element (with a `fa` class) and not a `<i>`.

For example:
- Replace a social network icon by a real image.
- Re-replace this image by an icon.
=> the icon element tag is `<span>` and not `<i>`.

In this case, after setting its style correctly (e.g. adding the round
shape) to make it look like the other icons, we notice that it does not
behave like the other ones:
- It is not aligned with the other icons, because the CSS rule aligning
them only targets `<i>`.
- Its icon is not replaced by a matching one when changing the URL with
a "relevant" one (e.g. google, facebook).

This commit considers `<span>` icons in the Social Media options, in
addition to `<i>` icons, in order for them to all behave the same way.

opw-3538230

closes odoo/odoo#144076

X-original-commit: a8b5c3045bea0227304306e19ed9d50cf497f518
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
2023-11-30 11:44:56 +00:00
Soukéina Bojabza 4ff2e3252e [FIX] website: consider other media types for Social Media snippet icons
When using the "Social Media" snippet, there are two situations leading
to a traceback. Here are the steps:

1) First issue
- In edit mode, drop the "Social Media" snippet.
- Add a new social network.
- Replace the icon by a real image (so not by an other icon).
- Set the URL of the new social network to a "relevant" one (e.g.
google, facebook).
=> traceback

2) Second issue
- Drop "Social Media" and change the list in order to have the first
social network with a real image as icon: either replace the first icon
with an image, or add a custom one with an image an move it to the top.
- Add a new social network.
=> traceback

Both issues happen because only icons set as `<i>` elements are taken
into account when modifying a social network (`querySelector('i')`) and
this element may not exist if the icon had another tag (like an image or
a span or even a video (as the media dialog allows to upload them)). As
there is no check ensuring that the element exists before changing the
different social media classes, there is a traceback when the `<i>` is
not found.

For the first issue, it happens because when changing the URL, we first
check if it matches with relevant ones or if an icon matching it exists.
If it is the case, we then update the social media classes to set the
matching icon => it can only work if the icon is a `<i>`.

The second issue happens because when adding a new social network, it
actually copies the style of the first one (unless there are none, a new
one is created in that case). If the first one is an image, it fails
when updating the classes because it is not a `<i>`.

This commit fixes these issues by simply adding checks ensuring the icon
element exists before trying to modify it. It also adds tests, ensuring
these use cases work as expected.

opw-3538230

X-original-commit: 0132fa38baee6501f4257dad718359400f1369ad
Part-of: odoo/odoo#144076
2023-11-30 11:44:56 +00:00
xO-Tx 63a3c99872 [FIX] website: fix visible cookies bar container
Steps to reproduce:

- Enable the "Cookies bar" in website configuration > Go to website
(Edit mode).
- Select the cookies bar > Change its layout to "Popup" > The modal
container becomes visible in edit mode only.

The `#website_cookies_bar` element will automatically get one line
height (equivalent to its current `line-height` value) because of the
`contenteditable="true"` added to it, which makes it visible in edit
mode (The container has this default height in all layouts, but it's
hidden by the cookies bar content in "Discrete" and "Classic" modes).

The goal of this commit is to simply hide this element to prevent this
behaviour.

Remark: The same issue occurred on a `.s_popup` parent with an inner
`.modal` element and was fixed in [1] by keeping their visibility
synchronized.

[1]: https://github.com/odoo/odoo/commit/cfd53b8fae3ad9f677df49a03fe6d2945dbb5da2

linked to opw-3485565

closes odoo/odoo#143913

X-original-commit: 4374adfde3627852d0a932f3d10fa74fe0b76a83
Signed-off-by: Robin Lejeune (role) <role@odoo.com>
2023-11-30 07:37:16 +00:00
Romain DerieandVranckx Florian 7c6844fa6c [FIX] website: make forms work again when inside html fields
Recent commit [1] in Odoo 15 (which is a backport of commit [2] which
was merged in Odoo 17) introduced a security layer on forms but only
for forms which are inside `ir.ui.view`. The forms inside HTML fields
are thus not working anymore, because those don't receive the required
signature.

For the record:
- `ir.ui.view` = `website.page` pages, some part of the controller pages
- HTML fields = the most part of the editable areas in controller pages

[1]: https://github.com/odoo/odoo/commit/17c6f6f30bf13bd3c303b28d9a314bd76dd8f4dc
[2]: https://github.com/odoo/odoo/commit/7d25e7bf9243367c87b1b2005587ae728730b49c

opw-3586333

closes odoo/odoo#143139

closes odoo/odoo#143879

X-original-commit: 5e5a14ae4a522a589f6112d1687bb910f86f9a6d
Signed-off-by: Jérémy Kersten <jke@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Co-authored-by: Vranckx Florian (flvr) <flvr@odoo.com>
Co-authored-by: Romain Derie <rde@odoo.com>
2023-11-30 07:37:14 +00:00
Romain Derie 731811e409 [REV] website: revert 17c6f6f30bf13bd3c303b28d9a314bd76dd8f4dc
X-original-commit: 49215f2cd31777d4ba0e845819e181daed82f887
Part-of: odoo/odoo#143879
2023-11-30 07:37:14 +00:00
Benoit Socias 3fa6af39c9 [FIX] web_editor, website: fix ignoring unapplied device invisibility
Upon drop, the fix in [1] did consider invisible the blocks that were
visible within the current preview mode (mobile/desktop).
Because of this `onTargetHide` was be called instead of `onTargetShow`.

This commit changes that behavior so that the correct method remains
called according to the actual visibility, but the `DeviceVisibility`'s
`onTargetShow` is adapted to only add the override if it matches the
current preview mode.

No steps to reproduce for this first change, but third-party options
could have been impacted by it.

This commit also adds that condition on the cleanup that was added in
[2] to keep the `dataset.invisible` state consistent upon toggling the
preview mode.

Steps to reproduce this second issue:
- Drop a Columns snippet.
- Make a column visible only on mobile.
- Make another column visible only on desktop.
- Toggle preview mode several times.

=> `dataset.invisible` was set to `1` on all columns having
device-dependent visibility.

[1]: https://github.com/odoo/odoo/commit/acfca25e48ac9bc227234de860fe8128f0312ed4
[2]: https://github.com/odoo/odoo/commit/174e9fe0d8665d1a81c90a6f7bf5cc9e3361f161

task-3538535

closes odoo/odoo#143640

closes odoo/odoo#143875

Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-11-30 07:37:13 +00:00
Guillaume-gdi 3b1e3329b9 [FIX] website: change OLG call timeout to 20s
This commit changes the timeout of the OLG call to 20s. We don't want
users to wait too long for the creation of a new website.

Related to task-3248852

closes odoo/odoo#137703

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-11-30 07:37:01 +00:00
Guillaume-gdi b9f8eb73e8 [FIX] website: prevent console error when email in link tools
This commit prevents the editor to search for anchors when the link URL
is an email. This way we prevent an error in the console.

Related to runbot-18747

closes odoo/odoo#143791

X-original-commit: e767c7d4b0ccdeb016cf224b80e269afce4b3028
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
2023-11-30 01:05:42 +00:00
Soukéina Bojabza c3781985e5 [FIX] web_editor, website: allow "Position" for grid image hover effects
In grid mode, if an image is in an image column (with the class `o_grid_
item_image`), it has the "Position" image option, allowing to select
between "cover" (= the image takes the whole grid-area, which means it
could be "cropped") and "contain" (= the image is entirely visible and
keeps its ratio in the available space). When there is a shape on the
image, this option is hidden and it is "contain" by default (or else the
shapes would be cropped). See commit [1].

Commit [2] added the "On Hover" animation option, to add hover effects
on images. In order for the effect to be applied, a shape is needed and
if no shape is specified, a dummy square shape is used instead. As there
is a shape, if it is a grid image, the "position" is forced to "contain"
(because of commit [1]).

The issue is that while it is logical for some hover effects to never be
"cover", as they could be cropped (i.e. "Dolly Zoom", "Outline", "Mirror
Blur" and any effect with a shape selected), it is not the case for the
other effects when there is no shape.

This commit improves this by allowing the "Position" option to be used
with these other hover effects when no shape is selected (so only with
the dummy square shape).

Steps to reproduce:
- In edit mode, drop the "Banner" snippet.
- Add the "Overlay" hover effect on the big image.
=> The image became "smaller" because it was forced to "contain".

[1]: https://github.com/odoo/odoo/commit/faf19ef7f87fc043fb9a814516e01b8eeafd9b61
[2]: https://github.com/odoo/odoo/commit/7f730f81ec541cc7791fc6b3fded17c838433f85

task-3568406

closes odoo/odoo#141468

Signed-off-by: Robin Lejeune (role) <role@odoo.com>
2023-11-29 21:33:53 +00:00
Xavier-Do ad993e673d [FIX] base: avoid no autoinstall propagation
A custom script is modifying the output of
load_information_from_description_file to disable the
auto-install of modules during local testing. It was naively adapted for
v16.0 by replacing the corresponding methods. Since a lru cache was added
(nice optimization in most cases) this is an issue because running lint
test afterward will get the cached value with an incorrect autoinstall
value. It makes sens to avoid reading the file on the filesystem each
time, but making a deepcopy looks like an acceptable safeguard to avoid
hard to debug behaviors.

closes odoo/odoo#143628

X-original-commit: ad10ff4410ccf7c38f6154480484495bb57c53ff
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2023-11-28 06:19:55 +00:00
Robin Lejeune (role) 9e9b9aa941 [FIX] website: fix email sharing subject format
Steps to reproduce:
- Drop a "Share" snippet anywhere on the page and save.
- Click on the email icon.
- Your default email client should open with, as a subject line, the
title of the page where spaces are replaced by +.
=> This should not be the case, spaces should show as spaces.

Since the sharer refactoring in [1], the title of a page used in share
buttons of the `s_share` snippet is encoded as a `URLSearchParams()`,
which encodes spaces as "+" characters (see the specs [2] of the
built-in method). This works fine for most share buttons, but not for
email clients, which do not properly parse the "+". Typically, that
means that the subject line of the mailto link is something like
"Home+%7C+My+Website", which renders as "Home+|+My+Website" in a mail
client, instead of showing spaces.

This commit uses another way to encode the title parameter, so that it
works for every share button. It also replaces a space that was encoded
twice for Whatsapp.

[1]: https://github.com/odoo/odoo/commit/5297388cd2aa1f693b04538c846c7025e243b09d
[2]: https://url.spec.whatwg.org/#ref-for-urlsearchparams%E2%91%A4

task-3603556

closes odoo/odoo#142876

Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
2023-11-27 12:39:53 +00:00
Julien (jula) 458d80b721 [FIX] website: perform _search_exact before _search_with_fuzzy
__Current behavior before commit:__
When searching for an **Internal Reference** of a product variant on the
website shop, the fuzzy search is likely to return a wrong result.

If the **Internal Reference** of a product template resembles the
searched term, it will take it as a fuzzy term and will not even search
for product variants internal references.

This is because the method `_basic_enumerate_words` only parses the
fields of the model considered but not the "subfields", in this case the
`product_variant_ids.default_code`.

__Description of the fix:__
Run `_search_exact` in any case and only then, if no result is found,
run a fuzzy search.

__To reproduce on runbot 15.0:__
In the website shop, search *FURN_0096*. Although there is a variant
of *Customizable Desk* that has this exact **Internal Reference**, the
search will only return *Office Chair Black* because this product
template has a **default_code** set (*FURN_0269*).

opw-3476643

closes odoo/odoo#143635

X-original-commit: 5887b4f7246dac734f192025404d65002fff6f20
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-11-27 09:51:09 +00:00
Odoo Translation Bot 3ffba892de [I18N] Update translation terms from Transifex 2023-11-26 00:20:02 +01:00
xO-Tx 56e37a6f55 [FIX] web_editor, website: fix invisible elements translation
Steps to reproduce:

- Go to website (in "Edit" mode) > Drop a new popup snippet > Make it
visible on all pages ("Show On" = "All Pages") > Save.

- Add a new language (e.g. fr) > Try to translate the page > A warning
is displayed: "Action 'get_page_option' was not able to be handled."

- Try to save > The "save" button just keeps loading and the same
warning is displayed again.

Now let's try to do the following actions [1]:

- Go to website (in "Edit" mode) > Drop a countdown snippet in the
footer > Set a conditional visibility on it (e.g. "Visibility" =
"Conditionally" = "Visible for Logged In") > Save.

- Try to translate the page > Save > We get the same error described
above.

Technical details:

Starting from [2], user has the possibility to translate invisible
blocks by allowing `_updateInvisibleDOM()` in "Translate" mode, which
makes them accessible in the edit bar.

In the case of an "All page" popup (The snippet is moved to the
`<footer/>` element to make it available on all pages...), the snippet
editor will be created with the parent's one (`<footer/>` in this
case) leading to the following behaviour when saving the page content
in "Translate" mode:

A- `cleanForSave()` called for all snippets...

B- `toggleTargetVisibility()` is then called for the `<footer/>` (which
doesn't have a `o_snippet_invisible` class).

C- `onTargetShow()` is consequently called allowing `_isShown()` to
check the footer visibility via the `get_page_option` action.

Since the navbar action widget (`ContentMenu` in this case) that handles
the action is not available in "Translate" mode, the action demand will
be aborted and we get the warning above.

Implemented solution:

- In "Edit" mode (for `s_popup` snippets):

The initial goal of this commit was to fix this behaviour by excluding
the parents when creation the `s_popup` editor in "Translate" mode.
But after some discussion, we prevent this behaviour for all `s_popup`
snippets (even in "Edit" mode) since they should not display their
parents options.

- In "Translate" mode (for all invisible snippets):

As described in [1], the issue will always occur if an invisible element
enables a parent option that needs action handers... And since we only
need to hide / display invisible elements to translate them, we also
prevent creating parents editors in "Translate" mode.

[2]: https://github.com/odoo/odoo/commit/04409af0571ed763c5712dbf857ea7dda81b2374

opw-3485565

closes odoo/odoo#143269

X-original-commit: 33e5bc36ecb5a4316ad7a61380461cb1663cb38a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
2023-11-23 16:24:15 +00:00
Benjamin Vray 5941411376 [FIX] website: fix configurator pages with only one snippet
This commit fixes a bug in page creation by the configurator. This only
happened with pages containing only one snippet, like the "Pricing" page
or the "Privacy Policy" page (default themes). Because of this bug, the
snippet that should be placed in the page had its parent element
"<section>" replaced with a "<div>", so the section options were no
longer available in edit mode, such as background options,
delete/duplicate/save the snippet, etc.

When there was multiple snippets, it worked by chance:
`<section></section><section></section>` was parsed as
`<div><section></section><section></section></div>` using the etree lib.
The web_editor `save` method then copied each children and put them in
the targeted oe_structure.
However, with only one snippet:
`<section><div class="container"></div></section>`
it was parsed as it is, then same: each children was copied and put in
the targeted oe_structure... but the only child here is the `container`.
Then the classes of the section were transferred on the oe_structure
element.

Steps to reproduce the bug:

- Create a new website using the configurator.
- Check the "Pricing" box in the list of features to create the
"Pricing" page.
- Once the website creation is complete, go to the "/pricing" page.
- In edit mode, click on the "comparisons" snippet.
- Bug: Some options are missing for the snippet, for example, it's not
possible to delete the snippet or change its background.

task-3570903

closes odoo/odoo#143049

X-original-commit: 68ffe065c6fa03874ee8c99b91ca317d1c2755a3
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-11-22 23:58:14 +00:00
Robin Lejeune (role) c7b4035e26 [FIX] website: fix dropping form snippet
Since [1], dropping a form snippet generates a `TypeError: Cannot read
properties of undefined (reading 'disconnect')`.
Note that it only happens if this is the 1st snippet dropped, and if it
is dropped as a section, not as inner content of another snippet.

This is due to the SnippetEditor being destroyed before being started,
as `destroy()` is synchronous but `start()` is async. A field from
`s_website_form` (specifically the field `.s_website_form_dnone`) is
removed through `_addHiddenField()` when dropping a new form. The result
is that it gets destroyed immediately and tries to disconnect an
observer that doesn't exist yet, but the async start() ends a little
later - and creates + connects the observer that will never be
disconnected.

To solve the issue, this commit makes sure (1) in `destroy()` that the
observer was initiated and (2) in `start()` that if the SnippetEditor
was destroyed, it should not create an observer.

[1]: https://github.com/odoo/odoo/commit/f64c9f2

task-3598997

closes odoo/odoo#142291

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-11-20 04:58:29 +00:00
Arthur Detroux (ard) 458c26d307 [FIX] website: fix traceback when saving anchor with unchanged name
Since commit [1], anchor dialog is now in OWL. During adaptation, a line
of code was forgotten which lead to a traceback when an anchor is saved
with an unchanged name.

Steps to reproduce:

- Drop a Text-Image snippet and set an anchor on it.
- On the anchor notification, click on "Edit"
- In the dialog, do not modify the anchor name (or change it but then
  set the original one again)
- Click on "Save & Copy"
=> Traceback

[1]: https://github.com/odoo/odoo/commit/57ed8bc0bf9d1ae2b7542d677a4d7e8fd1899ea2

task-3576975

closes odoo/odoo#141936

Signed-off-by: Soukéina Bojabza (sobo) <sobo@odoo.com>
2023-11-20 04:58:28 +00:00
Arthur Detroux (ard) e820187381 [FIX] website: prevent creation of duplicate anchors
Before commit [1], anchors would not have a duplicate name as checks
were in place to prevent it from happening. However, after [1], those
checks were no longer valid. They would check in the global variable
document, which was no longer the editable document.

This commit fixes that by using the ownerDocument of the target, which
should always return the correct document.

Steps to reproduce:

- Drop a text snippet.
- Click on create anchor (link icon)
    -> notification shows "/#Text".
- Drop another text snippet.
- Click on create anchor (link icon)
    -> notification shows "/#Text".
=> It should instead show "/#Text2".

[1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b

task-3576975

X-original-commit: fa75fe60b32537d3c564ddba8117207f468c1004
Part-of: odoo/odoo#141936
2023-11-20 04:58:28 +00:00
Odoo Translation Bot f6fe982853 [I18N] Update translation terms from Transifex 2023-11-19 00:28:08 +01:00
nda 4612f6a7ee [FIX] auth_signup, website: make reset password multi website friendly
The "reset password" feature does not take into account
multi-website.

steps to reproduce:
- create a website A
- uncheck 'Shared Customer Accounts' on website A
- create a portal user user@example.com on website A
- create a website B
- uncheck 'Shared Customer Accounts' on website B
- create a portal user user@example.com on website B
- reset password for user@example.com on any website

before this commit:
An error is raised "No account found for this login"
(which is false, actually 2 accounts are found)

after this commit:
Only the user linked to the current website is properly
selected

opw-3551540

closes odoo/odoo#142110

X-original-commit: a2196253d6cf90dca3042a777703e0679f74f542
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-11-16 23:35:57 +00:00
Robin Lejeune (role) f6d9f80e6e [FIX] website: prevent page overflow with mobile menu open
Since [commit 1] replaced the mobile menu, a bug appeared on Safari
where the `#wrapwrap` element would still be scrollable even with the
menu open and even though the `body` has `overflow: hidden;`.
This commit fixes it.

[commit 1]: https://github.com/odoo/odoo/commit/bc13176de8d66bbdc1c536017b1f046c5fd31a86

task-3584299

closes odoo/odoo#141154

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-11-15 16:54:45 +00:00