Commit Graph
7428 Commits
Author SHA1 Message Date
Romain Derie af320bad34 [IMP] website: make code snippet more obvious to edit
Some (most?) people keep trying to double click on it to edit it.
The wording was not helping as "Replace this" doesn't really tell the
user how to do it. He actually has to click on the "Edit" button on the
right panel.

Personal experience, the first times I tried that code snippet, I didn't
find that button and it took me a few times before understanding how it
works.

The new wording and the shortcut button to edit it should be more clear.
Another idea was to allow dblclick to enter edit mode, but this seems
overkill and the 2 improvements here should be enough to make it easy to
figure.

Also added a comment about the `&#10` and one-liner, it is far from
obvious when reading the code..

task-2978786

closes odoo/odoo#99922

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-16 19:17:02 +02:00
Pierre-Yves Dufays e94d65519d [FIX] website: fix issue when creating account / relogging
When creating an account from the website (through the link "Don't have an
account?") while having been previously identified, the creation lasts a very
long time and ends-up with a http 502 error (actually a timeout). Same when
logging although being already logged.

Technical note: The problem was due to a database deadlock because of going
twice through authentication. A record was deleted in one transaction while
being written in another (_merge_visitor deletes it and _update_visitor_last
visit writes it but with different environment).

Task-2950241

closes odoo/odoo#99723

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-09-16 19:16:59 +02:00
qsm-odoo 53724aa3cc [IMP] website: review frontend mini UI "Edit" button
The mini UI on the frontend as a connected backend user was a bit
confusing: the "Edit" button used the exact same design and wording as
the "Edit" button in the backend but it had not the same effect as it
did not enter edit mode but just redirected the user to the website
preview (client action iframe).

We still want the same behavior, we just needed another button design:

- Change the label from "Edit" to "Editor".

- Change the "pencil" fa icon with the website app icon (same as app
  switcher in enterprise).

- Use a dark color instead of the primary color. This reuses a dark
  color of the website edit mode.

closes odoo/odoo#100355

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-09-16 16:20:42 +02:00
Chong Wang (cwg) f8c2b02abe [FIX] *: adapt code to jsonb translations
Website: the context install_filename='dummy' is used to prevent
arch_updated from becoming True while updating translations of
ir_ui_view.arch_db (if arch_update becomes True, test_inherit_specific
fails)

Fuzzy search for jsonb translated fields has been adapted in the case of
website.  It may require some refactoring later.
2022-09-15 22:37:50 +02:00
Chong Wang (cwg) 654600e6f3 [FIX] website: support test for jsonb translated field
arch,arch_db will call xml_translate to clean itself.
So, the value read from them may not be the same as the value assigned to them
2022-09-15 22:37:50 +02:00
Chong Wang (cwg) 1b473cf0db [IMP] website, web_editor: frontend for new translate api 2022-09-15 22:37:50 +02:00
ef00294e71 [IMP] core: store translated fields as JSONB columns
Translated fields no longer use the model ir.translation.  Instead they store
all their values as JSON, and store them into JSONB columns in the model's
table.  The field's column value is either NULL or a JSON dict mapping language
codes to text (the field's value in the corresponding language), and must
contain an entry for key 'en_US' (as it is used as a fallback for all other
languages).  Empty text is allowed in translation values, but not NULL.

Here are examples for a field with translate=True:

    NULL
    {"en_US": "Foo"}
    {"en_US": "Foo", "fr_FR": "Bar", "nl_NL": "Baz"}
    {"en_US": "Foo", "fr_FR": "", "nl_NL": "Baz"}

Like before, writing False to the field makes it NULL, i.e., False in all
languages.  However, writing "" to the field makes its value empty in the
current language, but does not discard the values in the other languages.

Here are examples for a field with translate=xml_translate:

    NULL
    {"en_US": "<div>Foo<p>Bar</p></div>", "fr_FR": "<div>Fou<p>Barre</p></div>"}

Change for callable(translate) fields: one can now write any value in any
language on such a field.  The new value will be adapted in all languages, based
on the mapping of terms between languages in the old values.  Basically the
structure of the value must remain the same in all languages, like before.

Reading a translated field is now both simpler and faster than the former
implementation.  We fetch the value of the field in the current language by
coalescing its value with the 'en_US' value of the field:

    SELECT id, COALESCE(name->>'fr_FR', name->>'en_US') AS name ...

The raw cache of the field contains either None or a dict which is conceptually
a subset of the JSON value in database (except for missing languages).  For the
sake of simplicity, most cache operations deal with the dict and return the text
value in the current language.

Trigram indexes have been adapted to the new storing strategy, and should enable
to search in any language.  Before this change, only the source value of the
field ('en_US') could be indexed.

Computed stored translated fields are not supported by the framework, because of
the complexity of the computation itself: the field would need to be computed in
all active languages.  We chose to not provide any hook to compute a field in
all languages at once, and the framework always invokes a compute method once to
recompute it.

Code translations are no longer stored into the database.  They become static,
and are extracted from the PO files when needed.  The worker simply uses a cache
with extracted code translations for performance.  This is reasonable, since
fr_FR code translations for all modules takes around 2MB of memory, and the
cache can be shared among all registries in the worker.  Changing code
translations requires to update the corresponding PO file and reloading the
worker(s).

Performance summary:
 (+) reading 'model' translated fields is faster
 (+) reading 'model_terms' translated fields is much faster (no need to inject
     translations into the source value)
 (+) searching translated fields with operator 'ilike' is much faster when the
     field is indexed with 'trigram'
 (+) updating translated fields requires less ORM flushing
 (-) importing translations from PO files is 2x slower

Some extra fixes:
 - make field 'name' of ir.actions.actions translated; because of the PG
   inheritance, this is necessary to make the column definition consistent in
   all models that inherit from ir.actions.actions.
 - add some backend API for the web/website client for editing translations
 - move methods get_field_string() to model ir.model.fields
 - move _load_module_terms to model ir.module.module
 - adapt tests in test_impex, test_new_api
 - because env.lang is injected into SQL queries, its returned value is
   now guaranteed to correspond to a valid active language or None
 - remove wizard to insert missing translations (no longer makes sense)

task-id: 2081307

Co-authored-by: Fabien Pinckaers <fp@openerp.com>
Co-authored-by: Raphael Collet <rco@odoo.com>
2022-09-15 22:37:50 +02:00
Arthur Detroux (ard) f0e3c5146d [FIX] website: hide the 'discuss' window when in edit mode
With [1] moving the website in backend, it is now possible to display
a backend discuss chat window while browsing your website.

This window is unfortunately hidden behind the SnippetEditor when it is
open.

The choice was made to hide the chat window when the edit mode is
activated, as it could hide some content of the page.

Steps to reproduce:
- Open a Discuss chat window using the systray item from the app grid
- Open website
- Click on Edit

Chat window is hidden.

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

task-2687506

closes odoo/odoo#100098

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-15 18:22:09 +02:00
Younn Olivier 7b16b06838 [FIX] website: do not set a current website when fetching websites
Before this commit, the website service method fetchWebsites was not
clearly defined: it was fetching the user groups, the websites, the
current website and it was also setting the service's current website.

There is a difference between the get_current_website backend method and
the getter from the website service, introduced in [1]: the
websiteService.currentWebsite value referes to the website currently
edited in the WebsitePreview client action. From that value depend other
components visibility (like the contextual menus).

So when a fetchWebsites call was done from outside the client action,
from a PageListController with [2], it was breaking the flow by setting
a currentWebsite outside the client action and it could lead to bugged
flows:
- Go to the "Pages" list view
=> The contextual "This page" menu is not shown, it's correct
- Refresh the page
=> The "This Page" menu is shown (and broken).

To fix that, the fetchWebsites method is divided into a fetchUserGroups,
the searchRead on the websites, and another call to get_current_website,
located in the client action. It allows to load the client action iframe
with the last viewed/edited website.
Also, the menu "This Page" is shown only when there is a pageDocument at
the website service level.

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

task-2687506

closes odoo/odoo#100055

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-15 18:22:06 +02:00
Romain Derie 507db4e179 [REM] website: remove multi-website by country
Short summary:
- People can now use the snippets option to show/hide based on country
- We never use / test / maintain this feature, if it still works since
  its introduction 4 years ago that's by luck
- It is probably barely used, we never got a single question or issue
  about it

-----------

When we introduced the multi-website feature, it came with 2 main use
cases:
1. Multi website by domain -> Every website has its own domain and based
   on that we serve the expected website
2. Multi website by geoip -> Multiple website can have the same domain
   and based on GEOIP/country we serve the expected website

We never really supported, highlighted or promoted the geoip case.
We actually never use it ourselves when doing tests, and we don't
consider it when doing specs / improvements.
At most, only a very few people know about it in Odoo.

That GEOIP case is probably not useful at all, as displaying a whole new
website based on lang is not easy since nothing can be shared out of the
box -> Every website has its own COW records.

For instance, one could think of having its main website A and another
website B on which he just added 3 products specific to that website B
country.
But such a case won't even work properly, as any adaption on website A
won't be reflected on website B (design, theme etc).

closes odoo/odoo#99938

Related: odoo/upgrade#3892
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-15 18:22:00 +02:00
Adrien Dieudonné 27bba0c2ce [FIX] website: Convert missing BS5 attributes
Before this commit, clicks event were blocked even if there was
no backdrop.

closes odoo/odoo#99338

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-09-14 21:21:25 +02:00
Adrien Dieudonné 51939d09f8 [REF] web, website: avoid compensateScrollbar JQuery override
In this commit, we simply set 'position' to 'sticky' on 'o_header_affixed'
to avoid to manage it's position with 'padding-top' and 'right'.

- 'padding-top' css property was used to compensate the navbar height
   at the moment where the stacking context change because of the
   fixed position.
- 'right' css property was used to prevent the menu to overlapp
   the scroll bar.

Part-of: odoo/odoo#99338
2022-09-14 21:21:24 +02:00
Adrien Dieudonné cb7cf77ed0 [FIX] web, website: avoid traceback when cookie bar is activated
Before this commit, we had a traceback if we tried to activate
the cookie bar on the website:
`_updateScrollBar` function of s_popup's 000.js

This is due to the fact that _checkScrollbar, _setScrollbar and
_resetScrollbar doesn't exist anymore in BS5.
It's why overrides of these functions were already removed
during the migration as you can see here:
https://github.com/odoo/odoo/commit/0b94da214b7017e8580e671cbaa68ade6de2fbc7#diff-348097d5de2047358549a91803882338f589af18c5dafed9f653250e150ce679L116-L138

Because of this, we have to delete _updateScrollbar and its usage.
Instead of trying to control the scrollbar, another possibily would
be to simply manage it with 'overflow' css properties.

Desired behavior:
a) Popup/Cookie bar WITHOUT backdrop, we should be able to
 - scroll the content behind
 - scroll the popup content itself
 - click on elements behind
b) Popup/Cookie bar WITH backdrop, we shoudn't be able to
 - scroll the content behind
 - click on elements behind

To do this, we now allow the scroll on '#wrapwrap' (the content).
In BS a popup has a backdrop by default and there is nothing to do
to block scroll and clicks behind the modal (on '#wrapwrap').
If the popup doesn't have a backdrop, we set 'pointer-events' to 'none'
to allow pointer event to pass through the backdrop element and annihilate
his effect. Note that 'pointer-events' property is reset by BS to 'auto'
for the popup content to override inherited value from the parent.
https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events#formal_definition

Also note that now we have the same behavior as on desktop. If the size is set to
'Full', the cookie bar is displayed without any margins and sticks
to the screen borders.

Steps to reproduce:
- Enable cookie bar in settings
- Access a website page

Related commits:
- https://github.com/odoo/odoo/commit/e5a5f98819b3a70b3e2564fb91722cab415ceea9
- https://github.com/odoo/odoo/commit/97c8cf3ac263884b3eeb9862b84a426162d9794e
- https://github.com/odoo/odoo/commit/a0ddaa8931601a3d5e91a5ba5859ba58658e8710
- https://github.com/odoo/odoo/commit/0b94da214b7017e8580e671cbaa68ade6de2fbc7
- https://github.com/odoo/odoo/commit/43ccc785546bbce7787ca2075aa18ebc76a6d36b

Part-of: odoo/odoo#99338
2022-09-14 21:21:24 +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
Gorash 5410b7c238 [IMP] base/web: XML templates are added into the asset bundles.
XML files are now declared in python module manifests. During the qweb
't-call-asset' directive, assetbundle will fetch the declared xml files,
apply the inheritance (t-inherit) and create a javascript service (for
eg: 'web.assets_backend.bundle.xml') which is added at the end of the
*.js mimifier file.

When the debug mode is activated, comments are added in the template
indicating which file the template comes from as well as the
inheritances applied to it.

****

JavaScript:

assets.js (module @web/core/assets) takes care of loading libraries,
javascripts and styles.
`loadJS(url)` (loads the javascript and returns a resolved promise when
the templates are also loaded via the '*.bundle.xml' service)
`loadCSS(url)` (loads the style a resolved promise when the file is
loaded)
`loadXML(xml, app=assets.defaultApp)` (load template into
application/owl, used by the `*.bundle.xml` services)
`getBundle(bundleName)` (get the bundle descriptor)
`loadBundle(desc)` (load the files and bundle from a descriptor)

templates (XML element content all owl templates)

A new `ready(serviceName)` method on boot.js lets you know when a
service is loaded are the require.

The xmlDependencies attribute no longer exists.

Python:

The xmls taken into account by assetbundle.py, applying `t-inherit`
inheritances and adding an `name_of_the_bundle.bundle.xml` service in
the generated JavaScript file.

****

Every manifest changes is into the next commit, except 'web_tour' in
this current commit as example.

Part-of: odoo/odoo#95500
2022-09-14 20:25:01 +02:00
Arthur Detroux (ard) da007eabdf [FIX] website: do not cache footer based on website_id
Commit [1] introduced t-cache on the footer making it cached depending
on its website id. This is wrong as the footer can be visible or hidden
depending on the page it is currently rendered in.

This commit adapt the t-cache so that the footer is cached based on the
page.

Steps to reproduce:
 - Go in edit mode and click on the footer
 - Turn off "Page Visibility"
 - Save

 Footer is now hidden on every page depending on which page rendered it
 first.

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

closes odoo/odoo#99832

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-09-13 20:30:10 +02:00
Romeo Fragomeli 312a50e949 [FIX] website: fix mega-menu layout
In this commit two errors in the rendering of the mega menu are fixed:
* the position of the mega menu when the option `Sub Menus` is `On Hover`
  this bug is due that we show the mega menu manually adding the `show`
  class on the element in our code. However, in the `On Click` mode,
  it's Bootstrap's javascript that handle the show/hide state.
  Bootstrap adds the `show` class and also adds the attribute
  `data-bs-popper="none"` to the element. In `On Hover` mode this
  attribute was missing.

* the render of mega menu in the `+ icon` (`o_extra_menu_items`).
  This error occurs because in Bootstrap 5 the width is set with the
  `width` property and in Boostrap 4 it was `max-width`. In Odoo
  `col-XX-YY` CSS rules are overridden when the mega menu is in the
  `+ icon`, but the `max-width` was not changed by `width` during the
  Bootstrap 5 migration.

closes odoo/odoo#100068

Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2022-09-13 15:31:00 +02:00
Romain Derie f29607143e [FIX] website: fix nightly standalone theme test
The history of this one is kind of tricky, to say the least.

A fix in the theme install process was done in 14.0 with [1].
It came with a `standalone` test in the `design-themes` with [2].
It had to be a `standalone` test since it is playing with module
operation, which is forbidden in the regular testing suite (sadly).

Since this new test was the first `standalone` test in the
`design-themes` repository, it actually wasn't even properly tested for
months before we realized it. It was missing some runbot configuration
in the nightly build to include the `design-themes` repository in the
standalone testing suite.

Once the runbot configuration was correctly fixed, the test wasn't
working anymore in 15.3 and later version because of some change in the
httpocalypse [3] which made the `MockRequest` not behaving as expected.

Indeed, with [3] the request's context had to be updated through
`update_context` which wasn't adapted/working with `MockRequest`.

Then, since [1] (merged in 14.0) was ported in saas-15.3 at [4] (where
[3] also exists) it was the first time a test using `MockRequest` was
ending up calling business code doing a request's context change.
The business code doing `update_context` and called through the test in
`MockRequest` was then not doing anything and not changing the
`context`. The test was then failing despite the behavior/normal code
base working properly.

This commit makes the request's context change working with
`MockRequest`.

Some people think `MockRequest` should disappear, but right now that's
how it is, we are still using it as this is really useful to be able to
test business code in a frontend context without going through a tour.
For what it's worth, multiple time the community asked us to move it
outside the website module, but also multiple other internal team in
odoo. So, while it might be better or not correct in some cases (mainly
python super), the tool is useful.

[1]: https://github.com/odoo/odoo/commit/b8a24efa71daea1f96465b780f4f0e384ce74703
[2]: https://github.com/odoo/design-themes/commit/4de16d85b7f7d69212576eede82e8a15190d357b
[3]: https://github.com/odoo/odoo/commit/f61aa39ff1190f66cebb8efb8432723214932161
[4]: https://github.com/odoo/odoo/commit/14387f36438b731753e2e7169f54865b123cdcfa

closes odoo/odoo#100070

X-original-commit: 885ce02a15dc093ff98822f80b22c4415fa9cceb
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-09-13 13:53:49 +02:00
Sébastien Geelen (sge) 992acd25e2 [FIX] web_editor,website: top menu edition
Ensure all the `#top_menu` links are unremovable.
This prevent the editor to merge two `<a>` elements together
during delete commands.

task-2967314

closes odoo/odoo#99966

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-09-13 10:30:20 +02:00
Benjamin Vray 3036c7dc47 [IMP] website, *: review mobile view layout
*: web_editor, website_blog

This commit improves the mobile preview of websites. A mobile phone
image has been added around the iframe during the mobile preview. This
image was already used for the themes mobile preview, this is why the
css code has been unified to be used in these 2 mobile previews.
Parallel to this commit, we have modified the websites displayed in the
iframe of the preview of the themes so that the scrollbar of these is
visible (before it was hidden behind the image of the phone) but with a
smaller width in mobile mode.

This commit also improves the button to switch to mobile preview by
coloring it green when mobile preview is active.

task-2890050

closes odoo/odoo#98061

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-12 21:07:16 +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
Younn Olivier a8361c8fcd [MOV] website, *: move navbar patch to website custom menus service
*: website_event, website_links

This commit moves the current navbar patch, defined with [1], to a
service. This service will be implemented in the next commit and used by
both the navbar and the burger menu patches.

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

task-2687506

Part-of: odoo/odoo#99605
2022-09-12 17:33:11 +02:00
stefanorigano (SRI) f9a0d656a3 [REF] website_sale: improve overall navigation
task-2907955

closes odoo/odoo#98558

Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
2022-09-12 15:30:45 +02:00
stefanorigano (SRI) 93f1607091 [IMP] website_sale: sticky sidebar
task-2907955

Part-of: odoo/odoo#98558
2022-09-12 15:30:45 +02:00
stefanorigano (SRI) 46e5387974 [REF] website: multirange input
This commit improve the design and simplify the implementation.
Popovers have been removed and the overall integration with boostrap is
increased allowing customization with the default boostrap variables.

Variables for (multi-)range input have been exposed at "theme-level"
allowing to customize these components when creating a new theme.

task-2907955

Part-of: odoo/odoo#98558
2022-09-12 15:30:44 +02:00
stefanorigano (SRI) ef10da0a36 [IMP] website_sale, website: ecommerce sidebar, improve design
This commit improves the overall 'website_sale' sidebar design and solve
minor usability issues.

Design overrides has been removed in order to allow customization
thought SCSS variables and ensure consistency between components.

task-2907955

Part-of: odoo/odoo#98558
2022-09-12 15:30:43 +02:00
Xavier-Do c764c38d7c [IMP] website: pregenerate frontend assets
closes odoo/odoo#99176

Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2022-09-12 13:49:00 +02:00
Xavier-Do 93a9eb0a32 [IMP] *: avoid useless bundle generations
Some bundle are exactly the same as other one, we can avoid generating
them by using the original one.

Part-of: odoo/odoo#99176
2022-09-12 13:48:59 +02:00
Romain Derie 62ad91eb58 [FIX] website: remove confusing comment
The comment was introduced alongside its related line with [1].
The line was removed with [2] but its comment was not, leading to
confusion now.
Instead of removing it in master, might as well remove the confusion in
lower version..

[1]: https://github.com/odoo/odoo/commit/3542a27f9c4c44472184bbedc348ad646d46f20a
[2]: https://github.com/odoo/odoo/commit/0effbe3ca628460b9a0c257ea0bd6060c3eeb253

closes odoo/odoo#99979

X-original-commit: 7258c82a46713f404df5cf1bdfa0e29975011fcf
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-12 12:43:47 +02:00
Nicolas Bayet 10af6e83bf [IMP] web_editor,mass_mailing: adapt fields to use owl
- adapt the html field and mass_mailing_widget to be owl components
- adapt the mass mailing view to be an owl view

task-2898432

closes odoo/odoo#94875

Related: odoo/enterprise#30915
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
2022-09-12 11:38:00 +02:00
Romain Derie a879938b7f [IMP] website: don't warn people when enabling cookies bar
This was introduced alongside the introduction of the cookies bar in
odoo with [1].
It's not something we wanted but for some internal reason, we were not
allowed to introduce the cookies bar on the website without that warning
when enabling the settings (which also comes with Cancel button as
primary button..).
The compromise was accepted as having a cookies bar was something we
really needed.

It has now been accepted to get rid of it.
While some internal people still think we should educate people about
GDPR and cookies law, I doubt that this settings was the right place to
do it.
Indeed, it was more leading to bad UX as most people just clicked on
"activate anyway" without realizing they still had to save the settings
afterward.

[1]: https://github.com/odoo/odoo/commit/3028e9a8649ae5d9b23a1bdb989b903645ede5fe

closes odoo/odoo#99917

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-09 21:47:46 +02:00
Guillaume (gdi) b63f7e333d [FIX] website: put the name of the "edit in backend" button in the state
Since the button must be rendered when its text changes, the variable
that holds its text must be stored in the component state. The button
already had the right text before a bit by chance because the new name
was computed before the component was rendered. Now we make sure that
the component will be rendered when the name is recomputed. The problem
is visible if we slow down the getUserModelName function and go to a
forum.post from a forum.forum.

task-2889929

closes odoo/odoo#99599

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-09 11:12:21 +02:00
Victor Feyens 921073819d [FIX] website: give website manager rights to all administrators
Partial revert of fba6ea5a47

If the designer group is not given automatically to all admins,
they are not able to go through the website onboarding automatically
launched after the website app installation.

Task ID - 2936569

closes odoo/odoo#98542

Related: odoo/enterprise#30626
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-09-09 11:12:09 +02:00
Romain Derie 9c733d8c22 [IMP] website: allow controller as homepage
Before this commit, only a website.page could be used as a custom
homepage ('custom' meaning other than '/').

But it is a real use case and requirement for our users to be able to
select a controller as homepage.
For instance, an ecommerce would want its homepage to be the shop and
not a regular page from where you then have to navigate to the shop.

Right now, this can (almost) be achieved by doing some technical
advanced operations:
- Move the 'Shop' menu first in the menu navbar of the website
- Delete the specific '/' website.page for the website
- Delete the generic '/' website.page (no website_id)

That way, the system will redirect `/` to `/shop`, which is not ideal as
it should remain `/` in the URL.

That's because, until now, the homepage (`/` controller) serve order
was:
- Serve the website.page set as homepage (`website.homepage_id`),
  happens when one did select another page as homepage through the page
  properties dialog
- Serve the website.page having `/` as URL (default)
- Serve the first accessible menu if there no `/` page or other page set
  as homepage, it acts as a last resort attempt to not serve a 404 and
  to try serving relevant content (the first menu of a website is most
  likely always better than a 404)
- Serve 404

This commit allows to introduce an URL as homepage, instead of only a
website.page. It can be done through the website settings in the
backend.

There is 2 main points to keep in mind about serving the homepage:
- make sure we don't serve a 404 as the website homepage. This is the
  website entry point, serving a 404 is terrible. That's why we have
  some fallback mechanism like serving the first menu.
- We need to serve / before fallbacking to the first menu, as a lot of
  site just remove the 'Home' first menu since it is a duplicate of the
  logo, which also redirect to the homepage. In such cases, it doesn't
  mean that the user want his first menu to be the homepage. We
  shouldn't rely on such a behavior, it should just be used as a last
  resort.

With this commit, the homepage serve order is now:
- If homepage URL is set (empty by default), serve the website.page
  matching it
- If homepage URL is set (empty by default), serve the controller
  matching it
- If homepage URL is not set, serve the `/` website.page
- Serve the first accessible menu as last resort. It should be relevant
  content, at least better than a 404
- Serve 404

Most DBs will just have a website.page with '/' as URL and keep the
homepage_url setting empty.

task-2969683

closes odoo/odoo#99100

Related: odoo/upgrade#3876
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-09 00:56:54 +02:00
Jeremy Kersten a60532fcff [FIX] website: accept 'all' google console search key
lstrip remove each letter, and not only once in this order.
So a google console key like googleeef88156 will be never trusted.
'googleeef88156'.lstrip('google') = 'f88156' and not 'eef88156'

Now we ensure that it starts with google or ends with .html and remove
exactly what we know.

To replace with removeprefix/removesuffix once we have py3.9 as minimal
version.

closes odoo/odoo#99776

X-original-commit: 44c08f18de9b2f25d1c716319ad287a409d2384d
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Jérémy Kersten <jke@odoo.com>
2022-09-08 10:42:49 +02:00
Arthur Detroux (ard) 6a4b2ecb4c [IMP] website: streamline template structures
This commit changes the indentation of the redirect_field template to be
more in line with the rest of the template in the website module.

closes odoo/odoo#99150

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-08 08:36:52 +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
Arthur Detroux (ard) ed7794839b [MOV] website: move file to prepare for OWL conversion
This commit moves existing Fields to the OWL `components` folder to
prepare for their conversion to OWL.

Part-of: odoo/odoo#99150
2022-09-08 08:36:51 +02:00
Roy Le 8dd0aa839d [IMP] website: make translation components extensible
It is not common, but we sometimes need to modify translation components
in place. The goal is to have a mechanism to change translation
components and all future/present instances

closes odoo/odoo#99719

X-original-commit: 87f98e6bb82cb2319d7f923b838085befd823f72
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2022-09-08 01:08:01 +02:00
Romain Derie 1145a1fc82 [IMP] website: use get_themes_domain() util instead of custom domain
- use util method already used in regular theme selector screen
- theme_common is already in hidden category, no need to exclude it
- searching on theme category rather than `theme%` name
- move the uninstallable check in the util, no reason to show those in
  the regular theme selector screen either

Fixes #92125

closes odoo/odoo#99099

Related: odoo/design-themes#586
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-07 23:10:53 +02:00
Romain Derie d9c260de4b [IMP] website: add missing theme models fields
Before this commit, there were multiple issues related to the creation
of `theme.website.menu` records in a theme:

- Not possible to add a menu in the existing website's navbar
- When one would try to create a `theme.website.menu` that menu would be
  created for every website when instaling the theme on a particular
  website, which is terribly wrong as it goes against the multi-website
  holy grail rule: when editing a website, do not impact other websites.
- Not possible to create a mega menu

Now, one can create a menu:
- as a navbar top menu
- as a child menu of another theme menu
- as a whole new menu hierarchy (top level container)

This is not possible to create a menu as a child of a website.menu, like
adding 2 submenu to the existing contact us menu.
First, this is technically impossible to do without introducing yet
another hack code in the `website.menu` write. Indeed, there is no way
to identify a generic menu's website copies. Neither through a direct
DB field, neither through a persistent info like we do with the `key`
attribute of views. So there is no reliable way to tell the system to
add a menu below the "Contact Us" menu of the website, as this is just a
menu copied when the website was created. We could obviously later add
a `key` field or something like that to identify an XML menu's copies.
Second, there is a workaround as one has to recreate the website.menu
and delete the original one (through a `<function/>` record).
Third, this should not be the main use case about menu creation in
themes.

----------

Some fields were also missing regarding the `website.page` model.

----------

A stable attempt is done at [1], this is where the current commit
originates from.
As the Odoo 17 release is quickly approaching, it was decided to first
write the proper IMP in master from which we will see what can be
backported and how, if needed.

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

Part-of: odoo/odoo#99099
2022-09-07 23:10:53 +02:00
Benoit Socias fc168b17a8 [FIX] http_routing, website: render error page if 403 fallback fails
Since [1] the 403 pages displayed when a website page is restricted to a
different group of users is the default one instead of the website one.

After this commit 403 fallback errors are rendered by the default error
rendering.

Steps to reproduce:
- Go to a page. (e.g. "Contact Us")
- Select "Page Properties" in the "Pages" menu.
- Go to the "Publish" tab.
- Define visibility as "Some Users".
- Select a user group. (e.g. "Administration / Access Rights")
- Access to the same page in an incognito window.
=> The displayed 403 error page was the generic one instead of the
website one (with the navigation header...)

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

task-2963843

closes odoo/odoo#99671

X-original-commit: fc0a0c2ccea83b3a9a5df0e300eac1fe7eb7a2a2
Signed-off-by: Julien Castiaux <juc@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2022-09-07 17:26:42 +02:00
Arnaud Joset ab191d6066 [IMP] sale,sale_management,website: tax computation,UI and UX
website: get_base_url was not working with unprivileged users

Before this commit, when a unprivileged user tried to generate a report
(in sale for example), he could not access to the field website_id on ir.ui.view

An access error would be raised. This commit allows to read the base_url for all users.

Misc: UI for sale order templates
Before this commit, the sale order template information was not clear enough.

Note: these changes were merged into a single commit to ease the manual FW port of
changes in 15.3 for sale_subscription

taskid: 2942621
2022-09-05 11:28:44 +02:00
qsm-odoo da3f4c2aff [IMP] website, *: fill the "Content" area of the main website menu
*: website_blog, website_event, website_forum, website_hr_recruitment,
   website_sale, website_slides

As indicated by previous commits, new custom list views are created to
fill the "Content" area of the main website menu with key app models:
blog posts, events, forum posts, jobs, products and courses (+ some in
the enterprise version, see related commit).

Those list views will act as the page manager one: a click on an item
redirect to the website iframe, the create button acts as creating a
record via the "+ New" systray button while being on the iframe, the
delete button will in the future allow to know the page that mentions
the related object before deleting it, etc etc.

task-2889981

closes odoo/odoo#98937

Related: odoo/enterprise#30782
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-09-05 05:21:06 +02:00
qsm-odoo 7aaef54fe2 [IMP] website, *: reorganize main website menu
*: website_event, website_sale

The "Site" menu will now be organized in 3 sub-areas, the last two being
named "Content" and "This page". The first area contains a link to the
website iframe and the menu editor. The "Content" area will contain
menus to list all contents of the website (page, products, events, ...).
This commit only moves the "page" one, the others will be created by
other commits of this PR. The "This page" area contains elements
specific to the page (html editor, page properties, ...).

task-2889981

Part-of: odoo/odoo#98937
2022-09-05 05:21:05 +02:00
xO-Tx 940f4ee875 [REF] website: adapt website pages list to Owl
After [1], the frontend website page manager was replaced by a custom
'website.page' list view and, with following commits on this PR, this
view will be used with other website content models records (blog,
event, forum, ...) too.

The goal of this commit is to adapt the pages list code to the new Owl
view system.

Other changes (related to the view's behavior) were added in this
commit:

- "Page list action buttons" are removed, we keep only the action that
triggers the form view of 'page.view_id' in debug mode. Page properties
and SEO dialog can be accessed via the website iframe after clicking on
the page entry in the list. The clone button should be later restored as
part of the main website backend menu, still when viewing the iframe.
Meanwhile, it is accessible in page properties. The 'delete' button is
still accessible via page properties too but the standard "delete"
button when selecting records in the list view will later be improved to
act the same way.

- The "website switcher" on top of the list view (to filter records
which impact one website, generic + specific records) is added as part
of the search view. Limitation: it will only be shown for pages at the
moment.

- A standard "Create" button is added and displays the form view dialog
to create a new content record as with "+ New". Known bug: it only
allows to create on the first website at the moment.

- The click on page/content record should redirect to the corresponding
url/website_url in iframe. This is now achieved via the new possibility
of defining an action on the <tree> tag in the view definition. Known
bugs/inconsistency: depending on the model, this opens in edit mode, in
a new tab, ... behavior to unify in a future update.

- The 'PagePropertiesDialogManager' is removed since the code is in Owl
and we don't need page properties dialog on the list view anymore.

Follows the merge of the "website in backend" task at [1].

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

task-2889981

Part-of: odoo/odoo#98937
2022-09-05 05:21:05 +02:00
qsm-odoo 5a949b6d1c [MOV] website: move page manager related views and action
A "page manager" list view will be created for key models in other
apps. This commit prepares a convention that all other apps will follow:
a dedicated file for the views related to this feature, named
"website_pages_views.xml".

task-2889981

Part-of: odoo/odoo#98937
2022-09-05 05:21:05 +02:00
qsm-odoo a7592986b7 [REF] website: remove useless proxys to reach page manager act_window
A model method was initially introduced at [1] to return an URL action
reaching the frontend page manager. Following [2] as part of the
"website in backend" merge, a second python method was created to
basically do the same and the first one was also adapted to reach the
backend page manager view.

In fact, both those methods can be removed and replaced by XML-defined
actions that can be triggered via the right XML definitions in views.

[1]: https://github.com/odoo/odoo/commit/553e24ccd191f7aaa13b70242703003e71a91b2b
[2]: https://github.com/odoo/odoo/commit/0db19449d00aab20c35218ab8108e731717cb0fe

task-2889981

Part-of: odoo/odoo#98937
2022-09-05 05:21:04 +02:00