Commit Graph
174 Commits
Author SHA1 Message Date
Romain Derie bd040caf66 [FIX] website: add step in tour to check website kanban override
See previous commit, it fixes a bug introduced by a recent change in the
javascript framework that broke the website kanban override.

This commit is ensuring that the kanban can be accessed and used.
Ideally, it should have been a QUnit test but since this has to be
merged ASAP (critical bug) and a test is more than welcome as it's not
the first time our custom kanban is broken, a hook in an existing tourµ
is used to easily and quickly test it in the meantime.

closes odoo/odoo#112369

X-original-commit: aca72bcdae98e1304c934f67efa65273d636863a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2023-02-10 07:17:03 +01:00
Aaron Bohy 49297bc7bb [REM] *: remove legacy basic views + some fields/widgets
This commit removes the legacy implementation of the form, kanban
and list views. It also removes the legacy view widget registry,
and all legacy widgets it contained. The legacy field registry
couldn't be removed yet as some fields are still used (e.g. in
client actions: FieldMany2One, FieldMany2ManyTags...), and
sometimes accessed from that registry (e.g. uom service). More
clean up will come later. Note that all tests using legacy views
have thus been removed, even though the tested feature might still
remain (e.g. FieldMany2One tests have been removed, but that field
is still there). However, those features are deprecated and
unlikely to evolve. They should be removed in the next saas, or the
one after.

Finally, this commit also removes the legacy view dialogs.

Task 3168640

Part-of: odoo/odoo#111809
2023-02-08 13:27:58 +01:00
Guillaume (gdi) 09b720eff1 [IMP] web_editor, website: initialize the editor's tooltips
The editor offers bootstrap tooltips, but these were not all initialized
and therefore appeared as standard HTML tooltips. This commit fixes that
by initializing all the tooltips so that they all have the same style.

Details:
- The bootstrap tooltips are now available in translate mode.
- With bootstrap 5, only one bootstrap component can be initialized on a
  HTML element. This is why the tooltips are now initialized on the
  first child when there is another bootstrap component.
- Some tests have been adapted.

task-2777738

closes odoo/odoo#85666

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-02-07 16:38:23 +01:00
Benjamin Vray 75166dbcd4 [IMP] web_editor, website: adds label input to links in the editor panel
This commit adds a new feature to the web editor of a website. A "text"
input field has been added to the link editor panel, allowing users to
edit the label of a link.

The label will only be updated when the input is changed, to prevent
loss of formatting (e.g. if one letter is bold).

However, only formatting applied to the entire selection will be kept
(e.g. if you have a "link <b>like</b> this", nothing will be in bold if
you update the label in the editor panel).

Additionally, if there is a media element (such as an image or icon)
included in the selection, the "text" input will be hidden.

task-2900529

closes odoo/odoo#99239

Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-02-01 16:39:48 +01:00
Géry Debongnie b53f78e224 [REF] web_tour,*: use the registry in collecting the tours
This is a step closer to a goal of avoiding dependence on asynchronous
modules. Starting from this commit, new tour definition should be
registered to `registry.category("web_tour.tours")` registry.

So, instead of the following:

```js
import tour from "web_tour.tour";
tour.register(name, options, steps);
```

We now do:

```js
import { registry } from "@web/core/registry";
registry.category("web_tour.tours").add(name, optionsWithSteps);
```

Notice the `options` and `steps` params are merged when registering
the tour definition. It should look something like so:

```js
registry.category("web_tour.tours").add("account_tour", {
  test: true,
  steps: [ ... ],
});
```

And if the `TourManager` instance is needed, one can get it from the
registry like so `registry.get("tourManager")`. Note however that
this instance is only available when the `TourManager` has been
instantiated -- so it's not available at top level of the module.

closes odoo/odoo#111103

Related: odoo/enterprise#36335
Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-01-27 23:17:35 +01:00
Benoit Socias 79c6025213 [FIX] website: default page list's website filter on current website
The "All Websites" list of views is confusing for users with its
combination of default and specific views.

This commit makes the "All Websites" filter only available in debug
mode, and defaults the selected website on either the current website
(if one is selected) or the first website of the list.
The test is adapted because only the current website's pages are
displayed now.

task-3092786

closes odoo/odoo#110898

X-original-commit: 01cb743f1c0c22621bcfa92005a7d10dfa92e746
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-01-24 23:21:54 +01:00
59101edb9b [FIX] website: prevent confirmation modal when discarding without changes
Before this commit:

When entering edit mode on the website and discarding directly, the editor
considers that there are changes in the DOM and displays a confirmation modal.

After this commit:

When entering edit mode on the website and clicking directly on discard, the
confirmation modal is not displayed.

Task-3056463

closes odoo/odoo#110515

X-original-commit: 650a97d1bd59254cc2115d54d58940b6112a8d70
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
Co-authored-by: Dhaval Baraiya <dhba@odoo.com>
Co-authored-by: David Monjoie <dmo@odoo.com>
Co-authored-by: Nicolas Bayet <nby@odoo.com>
2023-01-20 16:54:18 +01:00
qsm-odoo bc1a1edfef [FIX] website: restore mega menu item edition (deletion)
This basically reverts [1].

After discussion with the related team, [1]'s purpose was to prevent
merging two links together if backspace was hit at the beginning of one
mega menu item. [1] however made mega menu creation impossible as it
prevented removing any mega menu item (well, you had one possibility if
you used Chrome which was to unlink the mega menu item and then remove
it via backspace but...).

After some more discussion, we decided that allowing to merge mega menu
items seems not bad (it is the same behavior as the rest of the editor
when two links are next to each other). In any case, being able to
remove default mega menu items is more important.

[1]: https://github.com/odoo/odoo/commit/9779145d9157e9687c36d2caa0ecea2862a2ac5a

opw-3109946
opw-3120070

closes odoo/odoo#109804

X-original-commit: 7de359470fb4d8eb81f018262a5e4c66a71c7043
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-01-13 17:32:47 +01:00
Michael (mcm) 11caf332ab [IMP] web: remove title attr from navbar items
This commit removes the title attribute on navbar items.
The title was only repeating the content so it was useless.

closes odoo/odoo#109230

Task: 3097276
Related: odoo/enterprise#35562
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2023-01-13 16:27:49 +01:00
Louis (loco) 2b3cb263bc [FIX] website: fix deleting a page from the page manager
Steps to reproduce the bug:
- Install the "Surveys" application.
- Go to the "Website" application.
- Go in the page manager ("Site" > "Pages").
- Select a page (typically "Home").
- Try to delete it.
- Error of type "'survey.survey' object has no attributes 'name'".

The error comes from the fact that records do not necessarily have the
attribute called "name". To fix this error, this commit uses
"display_name" that is defined in all models.

task-3082345
opw-3100483
opw-3111671

X-original-commit: d5aa5d7ebf9cd17a6df054252a1313ec8b85e83e
Part-of: odoo/odoo#109329
2023-01-06 16:34:20 +01:00
Guillaume (gdi) bc1b242021 [FIX] web_editor, website: debounce we-range events
This commit allows to debounce the events of the RangeUserValueWidget so
that the user can use this widget with the left and right arrows without
having a lag effect (especially on the image quality option).
In addition, steps were added in the website_gray_color_palette tour to
let the time for the debounce to trigger the changes.

task-2601533

closes odoo/odoo#109165

X-original-commit: dddec7489f5cb4e48368684a8783015517c394ee
Signed-off-by: Bojabza Soukéina (sobo) <sobo@odoo.com>
2023-01-05 15:37:34 +01:00
qsm-odoo 9cac574db7 [FIX] website: avoid race conditions during gray color palette tour
The "website_gray_color_palette" tour recently failed 4 times during
staging build on runbot, out of those 4 caught times, it seems that:

A) 3 were because the last step was marked as failed too soon
   (screenshots and logs seem to indicate the editor was still loading).

B) 1 was because of a "random" asset error (traceback when lazy loading
   the editor JS).

The cause of (B) was not found and should be later investigated if seen
again. This commit tries to avoid (A) which is probably related to a
known issue: when the website iframe has to reload it may sometimes take
more time than is allowed by the default timeout of tour steps. Some
improvements regarding that will be made at [1] and probably by further
PR after that (improving the editor loading speed in general).

Meanwhile, this commit reviews the tour to not save the editor as it was
actually not needed in this tour (nothing has to be saved).

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

runbot-14112

closes odoo/odoo#108747

X-original-commit: fa1819f09948c64ff7acf634eed075515f6a01d2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-12-28 14:40:51 +01:00
Arthur Detroux (ard) 7c66694cdb [FIX] website: add a test on snippet cache
The last two parent of this commit introduced fixes towards the Snippet
Cache, more specifically, the snippet cache according to the snippet
language.

Commit [1] introduced a Snippet template "Cache" that keeps the snippet
templates in memory throughout multiple instantiation of the
SnippetsMenu. Unfortunately, while this improved performance, it also
introduced bugs where the cache was not properly cleared. Starting
the edition in translate mode, then switching back to master edit mode
would sometimes lead to the Snippets being loaded in the wrong language.

The parent commits fix that but this one introduces a test to make the
snippet cache and translation more robust.

[1]: https://github.com/odoo/odoo/commit/03c552690b15cbf2e7d6b7812386ac64042219af#diff-52a4f9d2c217548e69e6b7fd097f286f1754a6389734eea254b87255e501cbefR18

closes odoo/odoo#108643

X-original-commit: a066dc8319cc9c204656a25af16fc78ae618cd71
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-12-23 21:19:51 +01:00
Benoit SociasandYounn Olivier ae0253da40 [FIX] web_editor, website: fix form custom fields starting with numbers
Before this commit, following this flow:
- Add a form
- Add a selection field
- Add an option starting with a number
- Save
=> The created form's option value is only the number

From the website_form options, the options HTMLElement of a form field
are generated using the field's records ids for their html element value
attribute (see FormEditor._renderField).

When [1] refactored the website_form options to use a generic
ListUserValueWidget, the list records id computation changed to use
parseInt instead of strings.

This commit changes the detection of parsable int to match only strings
that are made only of digits, and less than 16 of them so that their
value is not lost.

[1]: https://github.com/odoo/odoo/commit/9304f8fa7bb94f21dd4caa83f9679ffd1642691b

opw-2980760

closes odoo/odoo#108248

X-original-commit: 166f4aa4d23a01901585b60d69fac47fe70b7ebe
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Co-authored-by: Younn Olivier <yol@odoo.com>
2022-12-19 08:20:02 +01:00
Younn Olivier 19dfff16c7 [FIX] website: fix opening .xml pages from the WebsitePreview
Before this commit, following this flow on the website builder:
- Add a new .xml page,
- From the page manager, click on the record to open it,
=> There is a traceback as the website service parses the html document
as an editable one.

This commit fixes the test introduced in [1] to hide edit options on non
editable documents. The test is updated to check:
1/ If there is a dataset (the document of an XML file opened on Firefox
will not have a dataset),
2/ If the dataset has a websiteId key. It is the case only for website
pages, rendered using the 'website.layout' template, and not for other
files (js, css, scss, less, xml, csv).

[1]: https://github.com/odoo/odoo/commit/44da4bfcc30ca4fe78a1e0c5cb2f9f498ba6e72e

task-2687506

X-original-commit: bf2c6abdded1509ae22ed299abaa39fa066efb7d
Part-of: odoo/odoo#107860
2022-12-15 13:40:48 +01:00
Guillaume (gdi) 42e8d2edb0 [FIX] website: allow the scrollSpy to work with several TOC
Since the Bootstrap 5 merge, when there were several TOCs on the same
page the scrollSpy only worked for one of them. This commit fixes that.

Steps to reproduce the bug:
- Drop two TOC blocks on the same page
- Save the page

=> The second TOC is not working properly, it does not highlight the
current section.

Related to opw-3047375
Related to opw-3035502
task-2948895

X-original-commit: c182691bbfd6be8cc9aed26162635f5fdb117991
Part-of: odoo/odoo#107732
2022-12-14 18:33:15 +01:00
Guillaume (gdi) 400fa9e9f4 [FIX] website: permit to save when two TOC are on the same page
Since [this commit], when dropping several "table of content" blocks on
the same page, it was impossible to save. This commit solves this
problem.
Steps to reproduce the resolved bug:
- In edit mode, drop two TOC blocks
- Click on Save

=> the UI is blocked

[this commit]: https://github.com/odoo/odoo/commit/06b03ba5ef8375b1236f6ecb52ac468124e910ba

Related to opw-3047375
Related to opw-3035502
task-2948895

X-original-commit: a6de596017cdbd0da10b4050da132d46dc82a491
Part-of: odoo/odoo#107732
2022-12-14 18:33:14 +01:00
qsm-odoo 91435ba499 [FIX] website: properly flag website test tours as test tours
Commit [1] and [2] introduced test tours but did not mark them as test
tours properly, thus showing them to users (who are in debug=tests mode)
by mistake.

Note that [2] was silently fixed in the 16.0 forward-ported version...
that is why nothing shows up in this diff starting from 16.0.

[1]: https://github.com/odoo/odoo/commit/7655bface7f9e9bae8579e14e9a87b4f4801cc33
[2]: https://github.com/odoo/odoo/commit/a0c33c5f896718d1c03a6a50c981d6d75ce0d169

closes odoo/odoo#106755

X-original-commit: 101d83d483a329644d2d6afa8757a3e6d8a6bfb9
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-11-29 11:33:57 +01:00
qsm-odoo 57fa76c01f [FIX] website: prevent validation of conditionally hidden fields
Steps to reproduce the issue (see opw):
- Add a form to a page
- Add a checkbox
- Add a second checkbox that is required and visible only if the first
  checkbox is not checked
- Save
- Do not check anything and try to send => Good, you can't, the required
  checkbox is not set
- Check the second checkbox and try to send => Good, you can, the
  required checkbox is set
- Go back to the empty form, check the first checkbox and try to send
=> Bad, you can't but you should: the required checkbox is hidden, it
   is not supposed to be required anymore.

(Not that arguably, that two checkboxes setup should be replaced by a
required selection field but the issue of the OPW would remain as there
is another required conditionally-hidden field (a file upload) when the
second checkbox is checked.)

Conditionally-hidden fields should not require validation while they are
hidden. Indeed, their purpose is to be able to enter additional data
when some condition is fulfilled. If such a field is required, it is
only required when visible. The problem only occurred with checkboxes,
the other fields were already working in that case. Although there could
be issues with dates too, this commit added a series of FIXME and TODO
comments as well as some things need to be investigated.

opw-3003952

closes odoo/odoo#106204

X-original-commit: f501c25a9d33399cfbb45526d95038266d91686e
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-11-22 11:29:13 +01:00
Soukéina Bojabza c75f5d11f0 [FIX] web_editor: reallow the grid images to be replaced
In commit [1], a check was added to see if a media is editable in order
to prevent its edition if it is not the case. However, this also had as
effect to block the edition of some grid images. Indeed, as the columns
in grid mode containing only an image have their `contenteditable`
property set to `false`, the images don't pass the check because their
parent is therefore not editable.

This commit removes the `contenteditable` property from these columns
in order to make their images pass the check and therefore allow their
edition.

Tests are also added, ensuring that these grid images can be correctly
replaced.

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

opw-3028116

Fixes #103234

closes odoo/odoo#104899

X-original-commit: d8c374e3e6b31bf88aa42952aadf3379936f7600
Related: odoo/design-themes#617
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-11-03 23:35:10 +01:00
Nicolas (vin) 9d4dd8a742 [FIX] website: avoid timeout on website switching in testing suite
The tour snippet_cache_across_websites is at some point switching
between websites. The selector would be taking the second option in the
website list, which may not be correct if a module is adding a website
in its demo data.
This change aim to always switch from website 1 to website 2, without
caring about any other potentially existing website.

closes odoo/odoo#104596

X-original-commit: 7f756cfd5abc740e1a93a3225481c36279f094ed
Related: odoo/enterprise#33444
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
2022-10-31 12:42:25 +01:00
Younn Olivier 7b36c29417 [FIX] web_editor, *: fix link popover position in mobile edition
*: website, test_website

Before this commit, the LinkPopoverWidget element was not positioned
correctly in mobile edition.

With [1] that introduced the website edition using an iframe, the
element was appended on the global document, outside of the iframe, so
that it was not overlapped by the snippets manipulators (that were also
in the global document).

But Bootstrap popovers are not meant to be used "on top" of iframes.
Bootstrap uses the container's ownerDocument to compute placements, and
does not take into account whether or not the target is located inside
an iframe (therefore, skipping the iframe's offset and dimensions in the
placements computations).

This was leading to a visual bug in mobile edition: the iframe top, left
values were not computed by the popover, and it was not positioned
correctly.

Since [2] moved the manipulators inside the iframe, the popover can be
initialised using its target ownerDocument body, without being
overlapped by the manipulators.

Styles are adapted so that the popover stays consistent in the frontend
and the backend, and a container option is added to the widget so that
the element can be placed with other snippets manipulators from the
website builder.

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

task-2687506

closes odoo/odoo#103562

X-original-commit: 931d488af0d4dce529e4ea4ab3c8b827bda0d699
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Younn Olivier (yol) <yol@odoo.com>
2022-10-20 12:19:25 +02:00
Arthur Detroux (ard) e4da04ab78 [FIX] website, web_editor: translate snippet menu and snippet content
Prior to this commit, the language of the snippet menu would be the same
as the snippet content. This would cause issues if the user's language
was not the same as the website they were editing.

This commit fixes that by displaying the snippet menu in the user's
selected language but getting snippet content in the website's language.

This commit also fixes SEO data not being saved according to the
website's displayed language. Prior, it was saved according to the
user's current display language.

This commit also introduces a test for a fix made at [1] that
targets a previous version of odoo.

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

task-2687506

closes odoo/odoo#102799

X-original-commit: 55a978aa86967581956f855a1c5db33b7425bd15
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-10-10 11:56:58 +02:00
Arthur Detroux (ard) d7b2b7882f [FIX] website: invalidate snippet cache when switching website
Commit [1] keeps the snippet cache alive through different
instance of the website snippet menu.
This allows for the user to switch pages, even apps, while
keeping the snippets in cache, decreasing the startup time of the
snippet menu.

However, the cache is not invalidated when switching website or
installing a new theme.

This commit adds a `invalidateSnippetCache` property to the
websiteService. If this property is set to `true`, the cache will be
invalidated next time the menus loads its snippet.

This property is currently set to `true` when changing website and
switching theme.

[1]: https://github.com/odoo/odoo/commit/03c552690b15cbf2e7d6b7812386ac64042219af

task-2687506

X-original-commit: bb503962a36f3798c50049f2844e7b288b632955
Part-of: odoo/odoo#102799
2022-10-10 11:56:58 +02:00
qsm-odoo 2ae4e64341 [FIX] web_editor: restore overlay position computation
While working in the current state of the website configuration, the
overlay computation was not working anymore in case the scrollbar is
moved out of the wrapwrap. Indeed, in that case, the position was wrong
by the amount of the page scrolling.

While we could include that scrolling value in the equation, this commit
chooses to restore the way it worked before the "website-in-backend"
merge at [1]: making the overlay be naturally positioned according to
the page scrolling wherever the scrollbar is. To do that, the overlay
had to be moved inside the content (the website iframe) which has the
disadvantage of risking the overlay design being broken by a theme. This
solution was chosen as it simplifies the code, and potentially allows
for performance improvements in the future: not forcing a position
recompute after each scroll (the animation should already be smoother /
more performant this way). This will actually be needed for another fix
/ improvement: the background image overlay has to be in the iframe too.

Note: a further commit will move back the scrollbar behavior out of the
`#wrapwrap`, this is thus especially needed.

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

closes odoo/odoo#102785

X-original-commit: 872bb20b3ac08cf82613e15e6634a2e7593ccf7a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-10-09 18:52:49 +02:00
qsm-odoo 0f2a9e4e85 [IMP] website: make website_style_edition tour more runbot-friendly
The tour contains this part:

1. Change the font-size
2. Click on save
3. Check that edit mode was left
4. Check the font-size is ok

The problem is that step 1 induces a series of RPC and processing
(rebuilding assets, reloading them in the client, etc) but those are
not awaited before going into step 2 which also induces a RPC (the save)
which is only done once the other RPC are finished.

While we will try to optimize the duration of those RPC in the future.
Meanwhile we could simply increase to the timeout of step 3 but it seems
better to change the tour to divide the multiple things to await:

1. Change the font-size
2. Check the font-size is ok
3. Click on save
4. Check that edit mode was left
5. Check the font-size is still ok

runbot-4706

closes odoo/odoo#102609

X-original-commit: c2bc6c2f8446e98c8a4089daf048e67457be277f
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2022-10-07 14:37:30 +02:00
qsm-odoo 28f0db302a [FIX] web_editor, website: fix saving multiple contents at once
Since [1], as part of the new translation system made with [2], saving
multiple elements in a website page was only saving the first one. E.g.

- Enter edit mode of your homepage
- Add something in the main area of the page
- Add something in the footer
- Save
=> Only the main area is saved, not the footer.

This was actually the same in translate mode... only translation of the
first edited area could be saved.

At least, with the bug fixed version of [1] comes the small advantage
of not saving multiple times the same field (except for view parts).
E.g.: an event's dates are displayed multiple times in different formats
-> in 15.0, 3 RPC were made by date changed, now only one is made.

[1]: https://github.com/odoo/odoo/commit/1b473cf0db4d85c2b523ac87fbab533bce5f3e21
[2]: https://github.com/odoo/odoo/commit/4e82c45abdb0b420edead2bd1d0ba9ff4bb4a224

closes odoo/odoo#100762

X-original-commit: c834d151afed0ca633ffb6bcba2f45b544689e74
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-09-22 01:00:04 +02:00
Chong Wang (cwg) 1b473cf0db [IMP] website, web_editor: frontend for new translate api 2022-09-15 22:37:50 +02:00
Gorash 39ea7a1fab [IMP] web/all: XML templates are now declared into the python manifest.
Adapt all manifest, split some XML file and update JavaScript files.

Part-of: odoo/odoo#95500
2022-09-14 20:25:01 +02:00
qsm-odoo accb4b3245 [IMP] website, *: review website tour utils
*: test_website, website_blog, website_crm, website_event,
   website_forum, website_hr_recruitment, website_mass_mailing,
   website_sale, website_sale_wishlist, website_slides

- Make sure that all website tours reaching the website preview before
  their first step use the related website util to register their tour.

- Rename the website util to register a tour starting on the website
  preview from `registerEditionTour` to `registerWebsitePreviewTour`.
  Having a method using "Edition" in its name and having a boolean
  parameter named `edition` was a bit... strange.

- For both non edit mode and edit mode as a first step, ensure the util
  sets a high timeout for the first step. Indeed loading both the
  backend and the frontend (in the iframe) and potentially starting the
  edit mode can take a long time in automatic tests. We'll try and
  decrease the need for this high timeout of course.

- Review the implementation of those utils to be more consistent and
  also fix one or two mistakes in them.

closes odoo/odoo#100024

Related: odoo/design-themes#588
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-12 17:33:39 +02:00
Younn Olivier 78c59afd13 [FIX] website, *: fix the website custom systray and menus in mobile
*: website_event, website_links

This commit fixes the navbar on the enterprise mobile mode. With the
enterprise modules, in mobile mode, the navbar menus are removed and
displayed in an an additional systray item, the BurgerMenu.

This behavior was not adapted to the website systray and contextual
custom menus, introduced in [1].

For the website systray, some elements are hidden in mobile:
- the "edit" and "translate" buttons,
- the mobile preview,
- the "+ new" new content button,

The logic for displaying the contextual custom menus is moved from the
navbar patch to a service, so that we can define a patch for the
BurgerMenu that uses that logic and has the same behavior as the
navbar.
For now, the "Menu Editor" and the "HTML/CSS Editor" menus are hidden in
mobile.

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

task-2687506

closes odoo/odoo#99605

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-12 17:33:11 +02:00
Arthur Detroux (ard) a45b94656b [IMP] website: adapt website stat buttons to OWL
This commit adapts the website_published button and the settings field
"website cookie bar" to OWL.

Note: The website_redirect_button was adapted by [1] but the legacy
redirect button is still needed by a single partner view.

[1]: https://github.com/odoo/odoo/commit/9434969d5dc06aadcdbbfc600514a0bdb5635ea2

Part-of: odoo/odoo#99150
2022-09-08 08:36:52 +02:00
Arthur Detroux (ard)andYounn Olivier b9fef88c47 [IMP] website: adapt ThemePreview to OWL
This commit will adapt ThemePreview views to OWL.

Those views use custom components to achieve the desired layout and
functionality.

Part-of: odoo/odoo#99150
Co-authored-by: Younn Olivier <yol@odoo.com>
2022-09-08 08:36:52 +02:00
Romain Derie 5456dc499a [IMP] website, *: rename group publisher to restricted_editor
* portal, web_unsplash, website_*

This commit renames the `website.group_website_publisher` into
`website.group_website_restricted_editor`.

While the change in itself might look unuseful, it will help the dev and
tech community figuring which group is related to which feature.

Even internally when we discuss specs, we always have to remind which
group is the restricted editor: the publisher one or the designer one?

While it is probably, after all those years, now anchored in some dev
mind, there is no easy way to directly figure which of those 2 groups is
the restricted editor one.
Note that I myself always got confused about it.

Now, the "Restricted Editor" right will be reflected in its technical
name `group_website_restricted_editor`.
Same as for the "Editor & Designer" which technical name is
`group_website_designer`.

As we would like to have a fully working and ready system in v17 for the
community to be able to build themes easily, removing that dubious part
is a nice to have.

Part-of: odoo/odoo#98200
2022-08-31 23:50:06 +02:00
Younn Olivier e4d7fbfca8 [FIX] web_editor, website: keep the text selection when changing columns
It was decided with [1] to keep the text selection, if there was one,
when changing a snippet's option.
It was not working for the layout_column option:
- Drop a text snippet,
- Click on the first paragraph (the text is selected),
- Change the number of columns,
=> The text selection is lost.

To add some columns on snippets like the s_text_block which has no rows
and columns, the layout_column option will first wrap its content into a
set of row and column, which will remove the selection.
To fix that, the selection is restored after wrapping the snippet's
content.

The same thing is done when removing all columns from a snippet (and
unwrapping its content).

Related to https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b

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

task-2687506

Part-of: odoo/odoo#98352
2022-08-30 00:46:35 +02:00
Benoit Socias afe148341a [FIX] web_editor, website: not show link tools if link contains a media
Since [1] the link tools got created when the destroyed sub-elements of
the link were clicked on. This causes a problem when the element is a
media because upon destroy the tools reset the link to an incorrect
state.

After this commit the link tools is not touched anymore if the element
that was clicked on is a media.
Also, it reflects the changes done in the popup into the media link
options, and the ones done in the option into the popup.

Steps to reproduce:
- Add an image-text snippet in the page
- Click on the image
- Set up a link
- DO NOT click on the image again
- Click on the left of the image (to click on the snippet itself)
- Click on the image again
=> The image was removed instead and a text link remained

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

task-2765857

X-original-commit: 11ee7d5520c3a14a381b3f5b973114670f1e2edb
Part-of: odoo/odoo#98845
2022-08-25 12:05:29 +02:00
Younn Olivier a0a184fdf6 [FIX] web_editor, website: update invisible elements panel on undo
Before this commit, after:
- Drop a popup,
- Click on the undo button,
=> The invisible elements panel was still displayed, with the popup
entry.

To fix that, the panel visibility is updated on the
'historyUndo'/'historyRedo' events alongside refreshing the snippets
editors.

task-2687506

closes odoo/odoo#98807

X-original-commit: 76704f47db46ac7e71a894f620d8061a3eb594a7
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-08-25 04:21:07 +02:00
Romain Derie 5ad404fbb5 [REM] website, *: remove the now useless backend_dashboard tour
* website_sale

That tour keeps failing. A fix attempt was made with [1] but wasn't
enough.
The tour was actually useless as since [2] google analytics dashboard
was not part of the website dashboard anymore (due to google not
allowing GA4 dashboard to be embed).
The tour, which was initially made to ensure that google analytics was
correctly shown even if not yet connected to was then not useful
anymore.

The opportunity is also taken to rename the misleading ID of related
records still mentioning Google.

[1]: https://github.com/odoo/odoo/commit/1a191357e3ac0c4542b2fc7c3a2aee18dc54699d
[2]: https://github.com/odoo/odoo/commit/985e49bdb5e22fa197ba267aa41d7a8ba7e50550

runbot-4498
runbot-4499
runbot-4466

closes odoo/odoo#98090

Related: odoo/upgrade#3774
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-08-17 19:48:28 +02:00
Guillaume (gdi) caf1ca67e9 [FIX] website: permit to open the image wall modal correctly
Since the bootstrap 5 merge at [1], when you click on an image in the
Image Wall block, the modal no longer opens. This commit restores that
and adds a test to make sure this problem does not happen again.

Steps to reproduce:
- Drop the "Image wall" block in a page
- Save
- Click on an image
-> The modal does not open

[1]: https://github.com/odoo/odoo/commit/971e5a91aab96d36129a823e03f1f9f1b1293968

task-2937538

closes odoo/odoo#97053

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-08-17 19:48:21 +02:00
Arthur Detroux (ard) ddf2e74b4c [FIX] website: fix gray color picker
Commit [1] changed the way styles are handled. Now that the edition of
website is done in an iframe, the styles are computed inside the iframe
instead of the top window / global document element.

But for computing the gray colors, a base style defined
by `web_editor/color_palette.scss` is needed. This style is not part of
the frontend assets, so using the iframe to fetch it creates bogus gray,
which results in the feature not working.

Steps to reproduce:
- Go on the website editor
- Select the THEME tab
- At the bottom expand the gray color picker
- Use the settings
- The preview is not updated while sliding.
- The colors are not updated in the page.

This commit fixes the bug by fetching the base style from the top
window (where backend assets are present).

[1]: https://github.com/odoo/odoo/commit/212a8bfdd21269b18054200b9e2585e1c95540d6

task-2687506

Part-of: odoo/odoo#94564
2022-08-10 20:28:48 +02:00
Arthur Detroux (ard) 24ca4ae3fb [FIX] website: (re)start widgets on a cloned snippet
Commit [1] moved the website builder in the backend and in doing so
transferred event handling to the wysiwyg_adapter from the edit button
widget. Unfortunately, during that process, handling of event for
cloned snippets was forgotten.

This commit restores that and adds a test.

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

task-2687506

Part-of: odoo/odoo#94564
2022-08-10 20:28:48 +02:00
Younn Olivier 1a191357e3 [FIX] website: fix backend_dashboard tour
The tour .test_03_backend_dashboard was failing inconsistently with a
"failed to fetch" error (which happens when fetching the frontend
assets, from the iframe).

The test is adapted to start directly in the backend, which seems to
prevent that error from happening.
It is also adapted to [1] which was merged during the investigation of
that error.

[1]: https://github.com/odoo/odoo/commit/985e49bdb5e22fa197ba267aa41d7a8ba7e50550

runbot-4418
runbot-4003

Part-of: odoo/odoo#95890
2022-08-09 11:31:59 +02:00
Géry Debongnie 9434969d5d [REF] website: reimplement redirect field in owl
The redirect field in website does not work properly in the new views.
With this commit, we just reimplement it to make it work with the new
code.

closes odoo/odoo#96865

Related: odoo/enterprise#30178
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2022-08-08 12:33:12 +02:00
Younn Olivier 29dcb119f5 [FIX] website: copy frontend link when using the anchor option
Before this commit, clicking on the "anchor" icon from a snippet editor
would copy the client action's url (introduced in [1]).

This commit changes the snippet's path computation to use the target's
ownerDocument location instead of the global one.

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

task-2687506

Part-of: odoo/odoo#96401
2022-08-08 12:32:51 +02:00
Younn Olivier 9a542f121b [FIX] website: fix theme options background widget state
Before this commit, the Page Layout > Background option's widget of the
Theme section of the SnippetsMenu was not updated correctly after using
the option.
The #wrapwrap was queried in the global document when it should be
queried in the target's ownerDocument.

Related to https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b

task-2687506

Part-of: odoo/odoo#96401
2022-08-08 12:32:50 +02:00
Younn Olivier e8112e2865 [FIX] website: keep focus on text when using snippet options
Before [1] was merged, for this flow:
- Drop a snippet in the page
- Click on some paragraph
- Click on a snippet option's widget
=> The text selection was lost on Chrome, but kept on Firefox.

With [1] instantiating the SnippetsMenu on a different document than the
snippets one, it was possible to keep the text selection (the snippets
document selection) when clicking on the snippets options (on the global
document).
Some code was added to preserve the Chrome behaviour and lose the text
selection. This code is reverted to keep the Firefox behaviour.

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

task-2687506

Part-of: odoo/odoo#96401
2022-08-08 12:32:50 +02:00
Romain Derie 7f1653a1de [IMP] website: remove the iframefallback in test mode
This commit gets rid of the iframefallback in test mode. It is not
helpful there and slows down the tests as it involves some HTTP
requests.
Its purpose is only for the end users to have a smoother UX during page
transition. It is irrelevant in tests. Note that it means the tests
wouldn't break if that iframe fallback was to be breaking something in
real use cases.

task-2687506

closes odoo/odoo#96229

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-08-08 10:50:56 +02:00
Benoit Socias 3d3f9ffaa7 [FIX] website: navigate backwards in configurator
Since [1] the back button did not navigate within the steps of the
website configurator anymore.

After this commit the window location change that happens within the
browser is copied back into the state - thus causing a redraw of the
correct configurator step.

Steps to reproduce:
- Create a new website
- Go to second step
- Press browser's Back button
=> Did not navigate to previous configurator step.

[1]: https://github.com/odoo/odoo/commit/56cc3dfab156f21c7ef97b3c407f1480b094fe93

task-2789075

closes odoo/odoo#96766

X-original-commit: d32f8a9d64f0487e1e61ec7cee7cffde21b8ddb2
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-07-27 08:00:07 +02:00
Benjamin Vray 9fe6d82deb [FIX] website: fix "over the content" option not saved
Since this commit [1], when you select the Header position option and
set it to "Over The Content", the change is not saved if you did not
edit something else in the page too.

Indeed, now that the "save" works correctly (and that it no longer saves
the page every time). It does not detect the change made by this option
which is to add a class on the '#wrapwrap' element. (The editor looks
for changes inside the wrapwrap but not on it).

This commit checks if any page option is dirty on save on top of
checking if the content of the page has been modified.

Additionally, this commit fixes a bug that would occur on Firefox based
browsers where the hidden input used to display the status of these
options would be auto-completed by the browser in some conditions.
(https://bugzilla.mozilla.org/show_bug.cgi?id=520561).
This could result in an incorrect state being displayed.
To reproduce:
  - Change the option, click on cancel, start the editor
  - the incorrect state is displayed

A test is also added by this commit to verify that all the page options
works correctly.

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

task-2871426

X-original-commit: ea7a69b344d970cc2b31555f4cd8fd7c5e2fc6d2
Part-of: odoo/odoo#94949
2022-07-27 02:18:05 +02:00
Romain Derie 985e49bdb5 [FIX] website: remove Google Analytics dashboard (deprecated)
==== Short version ====

Google is deprecating Universal Analytics in July 2023 and Google
Sign-In in March 2023. Google Analytics Embed API is based on Sign-In,
meaning it won't work anymore. It actually already doesn't work anymore
for accounts created somewhere after mid-2020 apparently.
There is no plan for now for Google to allow Analytics 4 dashboard to be
embed in external website.
We therefore can't do anything to keep the Google Analytics dashboard in
Odoo.
In previous stable version, it was kept but is displaying a warning
about it (as until mid 2023 old accounts can still embed it).
All this is about the embed dashboard, not the tracking in itself for
which Odoo is already adapted in Odoo 15.0 for Analytics 4.

==== Detailed version (following short version, read it first)  ====

- Universal Analytics EOL July 2023, see [1].
- It will be replaced by Analytics 4 for which Odoo is already ready and
  actually using it since version 15.0 with [2].
- Google Sign-In EOL March 2023, see [3]. Analytics Embed API was based
  on it, it won't work anymore.
- There is no plan (for now) for Google to allow Analytics 4 to be able
  to be embed in external websites. They seem to just have dropped the
  "feature".
  This was confirmed by Google here [4] and indirectly here [5] in the
  DOC:
  `Note: This API does not support Google Analytics 4 (GA4) properties`
- While the EOL is planed for 2023, the dashboard integration is already
  not working anymore for new accounts.
- Old projects/keys/accounts can still embed their analytics dashboard.
  The threshold seems to be somewhere mid-2020, according to [6].
  It seems to be accurate as my own key from 2018 still works, while my
  keys from 2021 do not.

==== Fix ====

- In stable, warn user about it in their Odoo Analytics dashboard (this
  PR) and also add a warning about that on the doc.
- In master, simply drop the whole google analytics dashboard
  integration and remove the doc about it, see [7].

==== Useful links ====

[1]: https://support.google.com/analytics/answer/11583528?hl=en
[2]: https://github.com/odoo/odoo/commit/78bc86cbeccfc5df16218aee2b0d7c501e5c05b5
[3]: https://developers.googleblog.com/2022/03/gis-jsweb-authz-migration.html
[4]: https://issuetracker.google.com/issues/233738709?pli=1
[5]: https://developers.google.com/analytics/devguides/reporting/embed/v1
[6]: https://support.google.com/analytics/answer/11583832
[7]: https://www.odoo.com/documentation/15.0/applications/websites/website/optimize/google_analytics_dashboard.html

Finally, note that it means that from July 2023 to Octobre 2023, while
Odoo 14.0 is still supported, Google Analytics won't work anymore in
that version as it will still be designed for Universal Analytics and
not Analytics 4.

opw-2710910
opw-2855405
opw-2881515
opw-2892370
task-2790245
task-2820890

closes odoo/odoo#96280

X-original-commit: d065595f77790fb5ab9480f6de5b88549352324b
Related: odoo/enterprise#29666
Related: odoo/upgrade#3698
Related: odoo/documentation#2499
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-07-26 15:48:43 +02:00