Commit Graph
1622 Commits
Author SHA1 Message Date
Xavier ALT 513df115b1 [FIX] website: consider menu active even if extra qs found in URL
Commit [1] made sure that to be considered active, the current page URL
should have the same query strings as the ones defined in the menu URL
(if any).
But it was not fully accurate as extra query strings on the page URL
would make the menu not active even if the menu URL query strings would
be found in the visited page URL.

With this commit, when trying to determine if a website.menu is active,
we only take into account the subset of menu's query arguments.

For ex, a menu with an url of `/my-page?country=BE` should be
considered active if the request url is:
`/my-page?country=BE&utm_source=marketing-campaign&utm_medium=email`

[1]: https://github.com/odoo/odoo/commit/065ca15

closes odoo/odoo#120188

X-original-commit: bc1f2c092122e171950348c3e32438e8b862f231
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Xavier Alt (xal) <xal@odoo.com>
2023-04-28 21:33:30 +02:00
Rémy Voet (ryv) 302c7baa87 [REM] core,*: remove name_get_uid parameter from _name_search.
`name_get_uid` is unused (at least since v14) and the
documentation about it, is wrong.

closes odoo/odoo#117819

Related: odoo/enterprise#39483
Signed-off-by: Rémy Voet <ryv@odoo.com>
2023-04-28 16:04:27 +02:00
Guillaume (gdi) f845d5365d [FIX] website: ignore the scheme for page indexing
When a user sets up a domain name on Odoo, we consider that he has a
configuration that makes only one site visible. To do this, the standard
solution is to have the following redirections:
- http://example.com => https://example.com
- https://www.example.com => https://example.com
- http://www.example.com => https://example.com

It happens that users enter something other than https://example.com in
the setting to define the domain names of their websites. If this is the
case, [this other commit] would cause an error:
- The page indexing bot went to https://example.com but since this was
not what was set in the settings, a no index was added so that the page
was not referenced.
- As soon as the indexing bot went to http://example.com,
https://www.example.com or http://www.example.com, it was redirected to
https://example.com.

As a result, the client ended up with a non-indexed website.
The purpose of [this other commit] was just to prevent double indexation
of websites (the https://example.odoo.com and the https://example.com).

After this commit, the pages will be indexed even if the scheme is not
the same as the one specified in the settings. The same goes for the
www. which is also ignored.

Note that this can have an undesirable effect if the client has a bad
configuration and has several sites exposed (https://example.com and
https://www.example.com for example). If this is the case, he will end
up with a site that is indexed twice.

[this other commit]: https://github.com/odoo/odoo/commit/3739d74afe824554b37b1b52ed32ada33692c01a

task-3110888

closes odoo/odoo#119819

X-original-commit: c75b35b24c868a821089cafd990c15357cf737e7
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-04-27 06:10:16 +02:00
Loan (LSE) a71bfd5306 [FIX] website: delete visitors by batch in cron
Before this commit:
The scheduled action will repeatedly time out if the number of visitors
to remove is too high. In the case of the client, he has ~ 4 millions
inactive visitors to remove. This might happen after a bot spam attack.

After this commit:
The visitors are removed by batch of 1000, reducing the number of old
visitors with time

opw-3256349

closes odoo/odoo#119757

X-original-commit: b69917ec0e508f8354d831525c5c48ee79b5967a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-04-27 00:52:15 +02:00
Chong Wang (cwg) b92415023d [IMP] core: prefetch all translations
a new context `prefetch_langs=True` allows ORM to prefetch all translations of
translated fields while fetching.

For example
The activated languages are 'fr_FR' and 'nl_NL'
In the database the value is '{"en_US": "English", "fr_FR": "French"}'::jsonb
after fetch with `prefetch_langs=True` the raw cache value will become
{'en_US': 'English', 'fr_FR': 'French', 'nl_NL': 'English'}

closes odoo/odoo#116947

Signed-off-by: Raphael Collet <rco@odoo.com>
2023-04-26 18:12:08 +02:00
Jeremy Kersten cb1388ed9e [ADD] website_cf_turnstile: add cloudflare turnstile support
This module allows to add secret key to add the turnstile captcha on
each snippet website_form.

Cloudflare Turnstile
--------------------
A friendly, free CAPTCHA replacement
Turnstile delivers frustration-free, CAPTCHA-free web experiences to
website visitors.
Turnstile stops abuse and confirms visitors are real without the data
privacy concerns or awful UX that CAPTCHAs thrust on users.

closes odoo/odoo#119246

X-original-commit: 4aca39a533e9d41f5f452f36a1ffc001f586b4f4
Signed-off-by: Jérémy Kersten <jke@odoo.com>
2023-04-24 18:25:53 +02:00
Renaud Thiry 87b0189ff1 [IMP] mail: remove default logo
Many templates use the company logo that is set by default on
database creation. As that logo is clearly a placeholder and the user
isn't necesserely prompted to update it. It's possible for a user to
inadvertently start sending emails with "your logo" placeholders
plastered all over.

This removes the default logo of the company and removes it from
templates conditionally.

The logo isn't simply replaced with a transparent PNG as the templates
set a fixed height for the logo, which would look weird.

task-3067315

Part-of: odoo/odoo#106307
2023-04-24 10:20:12 +02:00
Rémy Voet (ryv) 234db70d86 [IMP] *: Use the new API of _read_group for backend use
Part-of: odoo/odoo#110737
2023-04-19 21:58:27 +02:00
Arthur Detroux (ard) 4c928c46ea [FIX] website: remove 'properties' type field from website form
Commit [1], [2] and [3] added `Properties` type fields on (respectively)
project.task, helpdesk.ticket and crm.lead. Unfortunately, those fields
are not currently supported by the Website Form snippet. Selecting the
"Properties" field while editing a form related to one of these model
will lead to a crash as no definition for how the field is supposed to
render is present in the current code base.

(Note that no logic for how options should behave if such field is
selected is present either.)

Therefore, this commit removes this specific type of field from being
present in the "Existing Fields" section of the Website Form Field
editor.

Steps to reproduce:
 - Install website and project
 - Go to Website and start edit mode
 - Drop a form snippet
 - Click on the form snippet and select "Create a task" as an Action
 - Click on an existing field or add one
 - Select "Properties" as the field type
 => Traceback (QWeb render error)

[1]: https://github.com/odoo/odoo/commit/2f244769cbb1512875ae197aa8adc3efd34fd54b
[2]: https://github.com/odoo/odoo/commit/8de9f4c4777481142063f75d4cd3cef47948714b
[3]: https://github.com/odoo/odoo/commit/4722cc4b1fb027b7b9d731c3b206656588071360

opw-3240395

closes odoo/odoo#118597

X-original-commit: 078f879444e5c2655f80ee572156ac663c0e4abb
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-04-14 15:06:07 +02:00
Benoit Socias 0f8bd89331 [FIX] website: skip view's copy-on-write when updating translations
Since [1] when the translations were converted to jsonb, when
translations are saved, the actual `ir.ui.view` is saved (instead of a
translation record like before). Because of this, the copy-on-write
mechanism of `website` kicks in and unneeded website-specific views are
created.

This commit disables the copy-on-write mechanism during the update of
translations in views.

Steps to reproduce:
- Install `website_sale`.
- Install a second language (e.g. French).
- Go to a single product's website page in the second language.
- Translate the "ADD TO CART" button.

=> Many website-specific views were created.

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

task-3225622

closes odoo/odoo#117256

X-original-commit: 1bf7e2322d22aeef30097a1d19848ff351bc83f9
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-03-31 15:52:37 +02:00
Soukéina Bojabza 38ebbc0a04 [FIX] website: fix the dynamic snippets rendered content
Since commit [1], which updates jQuery to version 3.6.3, when dropping a
dynamic snippet (Events, Blog Posts), it appears broken. This happens
because in jQuery 3.5.0, the `htmlPrefilter` function (which is called
when the dynamic snippet content is rendered) has been modified.

The dynamic snippets are broken because auto-closed tags are contained
in the data that are fetched from the server and without the jQuery
regex to fix them, they are never closed properly, which breaks the
rendering. Indeed, the `etree.tostring(...)` function auto-closes the
tags of elements having no content when no method is specified as a
parameter.

This commit prevents auto-closed tags to appear in the data sent by the
server when rendering the dynamic snippets, by enforcing the fact that
they will be used as HTML.

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

task-3199318

closes odoo/odoo#116929

X-original-commit: f6cbec8d0116305041f018870ab63e26c8cbef41
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-03-29 11:47:06 +02:00
Louis Wicket (wil) 0c53d28133 [IMP] *: remove "French spacing"
According to Wiktionary, French spacing is "the archaic practice (though
still current in French) of inserting a space around colons, semicolons,
question marks, and exclamation marks". This is not standard practice in
English and most languages of the world.

The purpose of this commit is to start purging the code from this typo,
as it may reflect poorly on the software for some people.

closes odoo/odoo#116167

Related: odoo/enterprise#38542
Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
2023-03-24 12:50:13 +01:00
Chong Wang (cwg) 0cef635102 [FIX] core: fix copy translations
after odoo #113888
when copy translations from one record to another, translations for
non-installed languages may raise error.

These translations may be
1. created before the langauge is deactivated
2. en_US which is always available for non falsy translated field value

this commit drops translations for uninstalled languages except 'en_US' when
copy and prevents raising error when users want to translate en_US when en_US is
not activated

closes odoo/odoo#115711

X-original-commit: 7bb1825ddbf2340882bef5ed1d9c877f78a2b815
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Wang Chong (cwg) <cwg@odoo.com>
2023-03-20 15:31:27 +01:00
Louis Wicket (wil) 9afe7c74c9 [IMP] *: remove "French spacing" 👺
According to Wiktionary, French spacing is "the archaic practice (though
still current in French) of inserting a space around colons, semicolons,
question marks, and exclamation marks". This is not standard practice in
English and most languages of the world.

The purpose of this commit is to start purging the code from this typo,
as it may reflect poorly on the software for some people.

closes odoo/odoo#114533

Related: odoo/enterprise#37853
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2023-03-14 15:52:10 +01:00
Jeremy Kersten 2f992e6cd1 [IMP] website, test_website, website_sale: allow to find partial url
Until now, if you search for /shop/Desk for a new link, you will not
have any result.
Now we search that it match *shop*desk* so /shop/custom-desk-12 will
match.

closes odoo/odoo#114357

X-original-commit: 84a407e744b7bacab43a0213ab52002a49c5d623
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Jérémy Kersten <jke@odoo.com>
2023-03-07 02:00:03 +01:00
Raphael Collet c161177cb7 [IMP] core: _name_search() now takes explicit order and limit parameters
This API is much more sensible for making subqueries.  Specifically, one
can generate a subquery without the clauses LIMIT and ORDER BY.

Part-of: odoo/odoo#112126
2023-03-05 15:12:54 +01:00
Adesh Jolhe 0de9824edf [FIX] website: prevent user to unlink default_website
Previously when we tried to delete default_website it was deleted.

In this commit we have fixed this issue by preventing user to unlink
default_website.Also we remvoe _unlink_except_last_remaining_website
method.

sentry-3874625419

closes odoo/odoo#113405

X-original-commit: 637af9f747bda0d6b4607d02a0e51d44cf889a89
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-03-02 16:00:50 +01:00
Julien Castiaux eaff61793b [FIX] website: public user should see published pp
As the public user, browse the website where you usually should see some
profile pictures (e.g. inside the forum). All the images are wrongly
replaced by the grey avatar placeholder.

When using `ir.binary._find_record` it was checking the access rights
and raising `AccessError` early even if the record was
`website_published`.

closes odoo/odoo#113526

X-original-commit: 0611fb437b699588317919e72ccfa1c41f1245bc
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
2023-02-28 23:49:22 +01:00
xO-Tx 4c03b3651a [FIX] website: fix header shadow color
To reproduce the issue:

- Website > Edit mode > Click on header
- Change the shadow color of the header to a suggested gray > it only
  works with normal colors but not grays.
- Change the header to "Header full" (it has no shadow by default)
- Add a shadow > It works
- Change the shadow color to a gray > it is reverted to no shadow.

To explain what happens exactly, let's suppose we want to set the gray
color from the custom property "--900":

When this color selected on colorpicker, the `customizeWebsiteVariable`
method will update assets to set a new user value:

`'menu-box-shadow': var(--900) ...`

But when the SCSS is compiled, the property name (here "--900") is
computed as a number which generates a wrong CSS value: `var(900) ...`

The goal of this commit is to prevent this behaviour by protecting
colorpicker variable names so they cannot be used for any further math.

task-3069518

closes odoo/odoo#113376

X-original-commit: 3e58af4bd9151f491c6a609b23f956191c594632
Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
Signed-off-by: Outagant Mehdi (mou) <mou@odoo.com>
2023-02-27 09:37:24 +01:00
Louis (loco) e82a1cb2ef [IMP] website: polish the configurator and save info in IAP database
The first objective of this commit is to polish the website
configurator:
1) On page 1 of it: - The size of the text is increased.
2) On page 2 of it: - The font size inside dropdown is reduced.
                    - 30 results are displayed inside dropdown instead
of 15.
3) On page 3 of it: - The size of the text is increased.
3) On page 4: - The cards are refactored.
              - The end line is removed.
              - The "Build my website" button is moved to the left.
4) On page 5 : - It is now impossible for the user to click on a theme
preview before it is completely loaded.

5) On all pages, the size of the "Skip and start from scratch" button
has been increased.

On the second page of the website configurator, the user has to choose
an industry type. Sometimes, it happens that the user is searching for
an industry that is not known by the server. Before this commit, a
message of type "No result found" appeared and the user had to choose
an other industry among the existing ones. From this commit, the
"No result found" message is replaced by the name of the industry that
the user is writing. To choose its industry type, the user can click on
the displayed industry name or outside of the input area. This last
option calls the `_blurIndustrySelection` function and the written
industry is kept as the final industry choice. If the user chooses an
industry name that is not known by the server then the remaining of the
website configuration is done with the "abbey" industry. Moreover, this
unknown industry name as well as the language used by the user is sent
and stored to the IAP database. The goal of it is to regularly update
the industry list so that it becomes as most complete as possible.

IAP PR : https://github.com/odoo/iap-apps/pull/549
task-3062171

closes odoo/odoo#110187

Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-02-20 12:39:24 +01:00
Xavier-Do f8adfe72dd [FIX] base, website: remove dead code
Looks like this is not useful since #66169
This cleanup was initially in #97879

closes odoo/odoo#112685

Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
2023-02-15 10:14:45 +01:00
Benoit Socias 5add1d2610 [FIX] website: do not suggest generic pages for existing specific ones
Before this commit, when obtaining link URL suggestions, both the
specific and the matching generic page were suggested.

After this commit, only the most specific ones are kept in the suggested
list.
This commit also adapts the sitemap in the same way.
In stable, a condition on a dedicated context key is used in case those
methods were called with the goal of obtaining both generic and specific
pages.
In 16.0, those methods will always filter duplicates pages as it was
supposed at first.

Steps to reproduce:
- Edit Contact Us page (to create a specific view)
- Edit the Contact Us menu
- Type "/" in the URL
=> "/contactus" appeared twice.

task-2968292

closes odoo/odoo#112746

X-original-commit: c5a50362ef55ced373c53c7af069fd5534043ae2
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2023-02-15 09:11:40 +01:00
Romain Derie 6f975d66b7 [FIX] website: improve perf of url dependencies search
Commit [1] improved the url dependencies search behavior to include more
models to search in but also the multi record capability (needed for
multi delete in list view now that website is in the backend).

But a line of code was badly designed, making the perfs horrible.
That line code shouldn't have been part of the loop as it doesn't
depend of the loop.

This was drastically more impactful on the `/` page.

Benchmark: for the `/` page, searching in 1000 product template website
           description will go from 29.74 seconds to 0.29 seconds.
           See the speedscope result on the PR description.
           For ~10.000 products, it will go from ~7 minutes to 1.35s.

[1]: https://github.com/odoo/odoo/commit/6ac17b93437868cbefbe13448a6fcbb29953f221

task-3169378

closes odoo/odoo#111933

X-original-commit: 9816b2ba6ee85dcba7b2f85e70c617994b7748c4
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2023-02-04 00:39:14 +01:00
Romain Derie fa37c67014 [FIX] website: not rely on sudo cache magic for menu visibility
Before this commit conditions based on `_handle_visibility` and
`_get_cached_visibility` did work only by relying on the cache of the
`menu.page_id` being populated when accessing `is_visible` in sudo.
This does not work if the cache is cleared between the calls.

This commit makes sure all 3 conditions have access the record.

The actual issue has not been reproduced locally yet.
The various workers, crons, websocket work on distinct envs - even
through code they cannot impact the cache of another local env outside
the `check_signaling` system which is only used between requests.
For the problem to occur, some intra-request multithreading is needed
but it could not be located so far.

task-3149270

closes odoo/odoo#111882

X-original-commit: a864192ecd270848fede23d3eb053318d07ae8e8
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-02-03 16:32:51 +01:00
Romain Derie 82763183d2 [FIX] website: redirect to case insensitive URL if not exact match
Before this commit, if a link to a page was not correct because of a
case mismatch, it would simply land on a 404 page.
While it's correct, as URL are case sensitive, it leads to a few bad UX
flow at the admin/editor level:
- Create a link in your page (on a text or a button eg), type an URL
  which does not exists (to create it after) like /Page
- Click on the link/button you just made, you are redirected to /Page
  which display a 404 with the "Create page" option (correct)
- When you click on that button, it will actually create a page with
  /page URL, leading to a mismatch between the URL you created and the
  page URL.
  Your link/button will still lead to a 404 URL as it points to /Page.

Since it's just a fallback when an exact URL match is not found, it
should not break anything and should not have bad impact at any level
(seo/speed etc).
Indeed:
- It's done through a 302 redirect
- `_serve_page()` is already a fallback case, so it will only make
  the `website.redirect` and 404 cases a bit slower due to the extra
  search query.

The only possible scenario seems to be if the user (mind the uppercase):
- Created a /Page page
- Created a redirect from /page to /another-page

In this case, /page won't land on /another-page but on /Page.
This flow seems unlikely and is not actually wrong either way.
At least, it certainly is less important than ensuring a case
insensitive fallback.

Finally, note that another solution would have been to either:
- Force page URL to lower case.
  -> This is not stable friendly, people might be relying on this to
     create pages with different casing:
     `/Batman-VII-The-Dark-Knight-Whatevers`, while not recommended,
     doesn't sounds idiot.
     On top of not being stable friendly, we probably want to keep
     offering this possibility
- Redirect all URLs to lowercase endpoints.
  -> This is obviously not stable and not Odoo's jobs. It should be
     something decided by the sysadmin and done at nginx (etc) level.

task-3110294
opw-3104030

closes odoo/odoo#111736

X-original-commit: f05491105f93939490cbeb078cb7653c38685644
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-02-03 06:06:20 +01:00
Benoit Socias 3414bebed0 [FIX] website: keep existing website-specific views translations
Since [1] when the translations becames stored as JSONB, the
translations of website-specific views were lost when adding a new
language.
[2] did fix a similar problem when installing an App, but did not
solve this.

This commit makes sure to only change the requested translations
without impacting the existing ones when a language is added.

Steps to reproduce:
- Add French language to the website
- Add the number snippet on the homepage
- Translate "Useful options" -> "Options utiles"
- Go to setting -> Languages -> Activate any language (not even on a
website)
=> French translation disappeared.

[1]: https://github.com/odoo/odoo/commit/ef00294e7189359c47638c4a71626f1937395edb
[2]: https://github.com/odoo/odoo/commit/91a9c870eede96040ac49d2375fe0e18342342e1

opw-3120079

closes odoo/odoo#111378

X-original-commit: 52fd577de8e270f84e8ca23c9350f2fb3ab5a7d8
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-01-30 22:27:21 +01:00
Romain Derie 065ca151d7 [IMP] website: ignore anchor but not qs when comparing menu URL
- Ignore anchors, those are not sent to the server anyway, no way to
  compare even if we wanted to
- Ensure query string (qs) are the same to be considered equals

On top of that, it also fixes the case when the user inserted an
absolute URL instead of a relative one, it will now match.

task-3096367
opw-3091427

closes odoo/odoo#107782

Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-01-30 19:45:54 +01:00
Romain Derie 8d4e99c6a6 [FIX] website: fix multiple error in submenu template
- `clean_url` method was wrongly flag as `api.model`
- the `unslug_url` was not called for the URL comparison in the dropdown
  case, meaning that `/shop/prod-1` would not match `/shop/product-1` as
  it should (and as it does for regular non dropdown menu)
- the `active` class was actually never working for the dropdown case,
  as the class was added on the wrong element (`li` instead of `a`)

The code was hard to read (mainly because huge python conditions in XML)
and kinda redundant, going through an util method should be clearer and
help reading the template XML.

task-3096367
opw-3091427

Part-of: odoo/odoo#107782
2023-01-30 19:45:53 +01:00
Romain Derie fff73e1fb0 [FIX] website: correctly handle website_visitor with merge partners
Since the refactoring of website.visitor with [1] (upsert), the
`access_token` is supposed to be holding the same value as the
`partner_id` when the visitor is linked to a partner:
- Anonymous visitor: no `partner_id`, `access_token` is a hash value
- Partner visitor: `partner_id` set, `access_token` should be sync with
                   `partner_id`.

`partner_id` is just a stored computed field holding the `access_token`
value if it is an integer value.
There should never be a case where there is a `partner_id` set and the
`access_token` is not equal to the `partner_id`.

For instance, having a visitor with `partner_id` = 4 and `access_token`
 = `e4r3ejkj4` is supposed to be impossible.
It would lead to crash, because the visitor is only searched based on
his `access_token`, meaning that when searching for the visitor of
partner 4, none would be found and a new one would try to be created,
raising the `uniq_access_token_id` SQL constraint.

While the `partner_id`/`access_token` sync might seems weird, it is done
to allow the `upsert` use in SQL to improve perfs of this low level
behavior.
It's actually not as weak as it seems as there is only a single entry
point to update the `partner_id` and `access_token`: the authenticate
override of website.
Those fields are not supposed to be changed elsewhere.

Note that modifying the `access_token` would not be an issue as the
`partner_id` is just a stored compute based on the `access_token`.
But it's only true when modifying through the ORM as if you do that in
raw SQL, it won't go through the `api.depends` which is supposed to
recompute the stored computed `partner_id` field.

But something was forgotten during the initial dev: the partner merge
behavior: it does (on top of other thing) auto discover the m2o field
relations that points to a `res.partner` and modify those values in raw
SQL to the new value.
This is obviously wrong regarding the `website.visitor`'s `partner_id`
field, the `access_token` should also be updated, or when possible
visitors should be merged too.

Note that for DB upgrated from previous version to Odoo 16, this is
ensured through the following upgrade script [2]:
```sql
UPDATE website_visitor
    SET access_token = partner_id::text
WHERE partner_id IS NOT NULL
```

[1]: https://github.com/odoo/odoo/commit/d348bed1ad9d3d16b295f013f015706be6c07820
[2]: https://github.com/odoo/upgrade/commit/0cedcbf70494dfeddeb5a97c13bf875cb6a86886

task-3148111

closes odoo/odoo#111002

X-original-commit: a87b4142dd4a2c05e3e1885b2c54f5e0d3c7ac47
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-01-25 17:50:25 +01:00
qsm-odoo b4fdc6c01d [FIX] website: allow to reinstall website after deleted user-websites
Before this commit, this flow was broken:

- Install website
- Create a new website of your own (not using the one created
  automatically from XML data)
- Choose another color palette for that website
- Uninstall the website app
- Reinstall the website app
- Try to choose another color palette for any website
=> It does not work

Indeed, after the uninstallation, the DB is left in an invalid state:
the SCSS customizations attachments of the website that was created by
the user are not removed, they just have their website_id field emptied.
Some code made at [1] was already there to remove those attachments. The
problem is that it only worked for websites which were created by XML
data (at website installation), not by the user. Indeed, the `unlink`
method is not called during uninstallation to remove records that were
created by the user, thus the `unlink` override was not called either.
See [2] for some details.

This fixes the issues by moving this attachment cleaning code in a
dedicated method, called in `unlink` but also in the `uninstall_hook` of
the website app.
This also takes the opportunity to refactor the code involved, in
particular to not even consider customized attachments which do not have
a website_id.

[1]: https://github.com/odoo/odoo/commit/2f361bec36dff09181b96d140d62c477cdf013a1
[2]: https://github.com/odoo/odoo/pull/97852#pullrequestreview-1067851656

opw-3127531

closes odoo/odoo#110338

X-original-commit: 988eafa03b57be3b3a7f110650c61ce8fda88e31
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-01-20 20:58:34 +01:00
Thibault Delavallée 1a1acabd7b [REF] mail: cleanup mono/multi record composer behavior
RATIONALE

Improve usage of composer in comment or email mode: support batch-posting in
comment, support more configuration from templates, improve global model.

SPECIFICATIONS

Support a real res_ids field on mail.compose.message model. Instead of relying
on active_ids from context, store it once for all at composer level and use
it in code. Active_ids usage is still done at default_get level, using it to
populate the field.

Improve usage of domain, renamed to res_domain to match other document related
fields naming. Add support of a res_domain_user_id field allowing to set the
user from which the domain should be evaluated.

Composer now runs on a list of IDs. Mass mail mode and comment mode are now
distinct from running on a singleton or on more records. Rendered or raw
mode is not triggered by

  * mass mailing mode: always display raw mode, whatever the number of records;
  * comment mode: display rendered mode when having a single record (like the
    previous comment mode). Display raw mode when having either no records
    either at least two records.

Task-3035101 (Mail: Support batch-posting from composer)

Part-of: odoo/odoo#99482
2023-01-17 20:58:39 +01:00
Romain Derie 17b0796546 [FIX] website: prevent SQL deadlock with website.visitor
Since it's first implementation at [1], a new cursor is created to then
build a new environment after the website's `authenticate` overide with
the new `uid` of the logged in user.

Since the new visitor SQL upsert refactoring done at [2], it seems to be
introducing a SQL deadlock sometimes.
It has been detected on odoo.com while monitoring the logs. Despite
being quite rare, it still happens too often due to our heavy trafic.

Step to reproduce (among others):
- Install website_livechat
- Login as admin on 127.0.0.1
- On 127.0.0.2, load the website
- Open the livechat
- Type something in the discussion
- Directly try to login as admin
- It will load for a certain time then crash on a 502 timeout due to the
  SQL deadlock
- You may need to repeat the process to actually face the bug

[1]: https://github.com/odoo/odoo/commit/6bec0e4d29e6b33b74962b2893a7a405667ef58c
[2]: https://github.com/odoo/odoo/commit/d348bed1ad9d3d16b295f013f015706be6c07820

closes odoo/odoo#109830

X-original-commit: b241cf7de9329af1410b9dd45b161aa41926effb
Signed-off-by: Olivier Dony (odo) <odo@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2023-01-13 17:33:12 +01:00
David Ramia bcf253063f [FIX] website: optimize the asset disabling function
Before this commit, the behavior disabling the unused snippet assets
performed two checks:

1. It was looking for occurrences for its use in the snippet template
2. It was looking for occurrences for its use in the HTML fields
3. Checked on the occurrences of step 1 and 2 and return result.

In many cases there are already coincidences in the first step, making
the second step unnecessary since this second one is the slowest.
Matches are now checked between steps 1 and 2 to skip the second if
matches are already found.

closes odoo/odoo#109488

X-original-commit: 56100532dbcbdeb5487662d0cbf35ba6d62b15b5
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-01-10 13:39:51 +01:00
Romain Derie 0d8222c7c8 [FIX] website: prevent crash for non admin publisher when click on form
When editing a website form, a `search_read` request is fired on
`ir.model` model to get the list of possible form actions (create
ticket, create opportunity, etc.).
But since commit [1] in Odoo 15, non-admin users don't have read access
anymore on this model, leading to a traceback when clicking on a form in
edit mode.

Steps to reproduce (as designer):
- Install only website and login as admin
- Make "portal" user an internal user and give him "Editor and Designer"
  rights
- Login as "portal" user
- Enter edit mode on any page and drag & drop the form snippet, or
  simply go to /contactus page which already has one
- Click on the form -> Traceback

Steps to reproduce (as publisher/restricted editor):
- Install website_hr_recruitment
- Make "portal" user an internal user and give him the following rights:
  - Website: Restricted Editor
  - Recruitment: Administrator
- Login as "portal" user
- Go to a job page like /jobs/detail/experienced-developer-4
- Enter edit mode and drag & drop the form snippet
- It will crash

[1]: https://github.com/odoo/odoo/commit/5dc4cff60a557e14b08440c227423291c407899b

opw-3098097
opw-3101884

closes odoo/odoo#109339

X-original-commit: 054c216e93b818794316bfd4b8ce56d6853a61d3
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2023-01-08 15:01:12 +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
Julien Castiaux 3d1f486bcc [IMP] *: update modules to use the new geoip API
request.geoip is no more a dictionnary cached in the session. It is now
a full blown object with lazy and smart geolocalisation capabilities.

Among other things, the previous dictionnary API is now deprecated. The
changes are:

* `request.geoip['country_name']` -> `request.geoip.country_name`
* `request.geoip['country_code']` -> `request.geoip.country_code`
* `request.geoip['city']` -> `request.geoip.city.name`
* `request.geoip['latitude']` -> `request.geoip.location.latitude`
* `request.geoip['longitude']` -> `request.geoip.location.longitude`
* `request.geoip['region']` -> `(request.geoip.subdivisions[0].iso_code if request.geoip.subdivisions else None)`
* `request.geoip['time_zone']` -> `request.geoip.location.time_zone`

It is safe to access all the attributes. Doing `request.geoip.city.name`
when the geolocalization failed (missing db, invalid address, ...)
evaluates to None. It does not raise an AttributeError.

Task: 2848206
Part-of: odoo/odoo#91337
2023-01-03 13:16:02 +01:00
Jeremy Kersten d335cb59dd [FIX] website: avoid duplicate in _enumerate_pages
Before this commit, we have redundant loc in sitemap.
When we iter the rules from the routing map, the comparison between
two same endpoints are not equal since httpocalypse.

After this commit we compare the function of the endpoint to know if we
have already processed it or not.

X-original-commit: c408de398c6b4e59cd9a233df251147d8750b9f2
Part-of: odoo/odoo#108670
2023-01-02 09:54:12 +01:00
Arthur Detroux (ard) 285333a521 [FIX] website: properly add anchors into website menu
Prior to this commit, adding an anchor using auto-complete would not
properly prefix the url with the URL of the current page.

Steps to reproduce:
- Create a page (e.g. /test), add blocks and create an anchor (e.g.
- Save the page
- Click on "Edit Menu" in "Pages"
- Add a new menu entry
- Type '#' in the URL field and select the anchor
- Save

=> The menu entry is wrongly set as it does not contain the original
page's URL inside the `href` attribute. This means that clicking on the
menu from any other place will not properly redirect to the anchor on
the /test page

On top of that, editing a menu entry that was previously linked to a
page would change the URL of the page with an anchor, making it
impossible to access the page anymore until you change the URL back in
the page manager.

Steps to reproduce:
- Create a new page (e.g. test)
- Add a new menu entry that has this page as its URL
- Save the new menu entry (close the dialogs)
- Re-open the Menu dialog and edit the newly created menu entry
- In the URL field, replace it with the page + an anchor
 (e.g. /test#anchor)
- Save
=> The page's URL is now /test#anchor and is no longer accessible

The is due to the `save` method of the `website.menu` model not
containing code to properly manage adding an anchor to the menu.

This commit fixes that.

opw-3067750

closes odoo/odoo#108502

X-original-commit: 192bf08da191e6fad27dd2913be0801817256a3a
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-12-23 12:11:01 +01:00
xO-Tx abe2ec83ad [FIX] website: fix homepage translation overwriting
To reproduce the issue:

- Go to website > Add language > Add blocks to your homepage and
translate it.
- Make translations on the "Contact us" page (or a new custom page).
- Install a new app > The translation of the homepage is lost (only on
homepage).

Explanation:

After [1], The `_load_module_terms()` method was updated on website
module to copy translations from base to specific views when module
translation is loaded. And since [2], the translated field's column is
either NULL or a JSON dict mapping language codes to text (the field's
value in the corresponding language).

To explain what happens exactly when new app is installed, let's suppose
we want to load module translation for the config {'en_US', 'fr_BE'} in
the following situations:

S1 (e.g. "Contact us" page):
-=-=-=-=-=-=--=-=-=-=-=-=-=-

```
generic_arch_db = {
'en_US': '<div>Generic (EN)</div>',
'fr_BE': '<div>Generic (FR)</div>'
}

- specific_arch_db = {
'en_US': '<div>Specific (EN)</div>',
'fr_BE': '<div>Specific (FR)</div>'
}
```

`_load_module_terms()` will copy translations for 'fr_BE' from generic
to specific `arch_db` (using generic translation dictionary).

result:

```
new_specific_arch_db = {
'en_US': '<div>Specific (EN)</div>',
'fr_BE': '<div>Updated Specific (FR)</div>'
}
```

S2 (new custom page):
-=-=-=-=-=-=--=-=-=-=

```
generic_arch_db = NULL

specific_arch_db = {
'en_US': '<div>Specific (EN)</div>',
'fr_BE': '<div>Specific (FR)</div>'
}
```

result:

Nothing to do here (only specific version), the specific translation
will not be updated.

S3 (e.g. website homepage):
-=-=-=-=-=-=--=-=-=-=-=-=-=

The generic view has no translated `arch_db` (only the 'en_US' version):

```
generic_arch_db = {'en_US': '<div>Generic (EN)</div>'}

specific_arch_db = {
'en_US': '<div>Specific (EN)</div>',
'fr_BE': '<div>Specific (FR)</div>'
}
```

`_load_module_terms()` will copy generic translations only for languages
available on "generic_arch_db" and the 'fr_BE' version will be lost.

result:

`new_specific_arch_db = {'en_US': '<div>Specific (EN)</div>'}`

The goal of this commit is to prevent this behaviour by keeping the
specific translated `arch_db` even when the generic value has no content
for the translation language.

Remark: This behaviour occurred while loading module translations,
as a consequence, the specific translations are also lost when the
website module is updated.

[1]: https://github.com/odoo/odoo/commit/94db81d8d28c4cbc7b51ae1688c9362042ee3619
[2]: https://github.com/odoo/odoo/commit/ef00294e7189359c47638c4a71626f1937395edb

opw-3083480

closes odoo/odoo#108477

X-original-commit: 91a9c870eede96040ac49d2375fe0e18342342e1
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-12-21 17:41:57 +01:00
Romain Derie 8850e98233 [FIX] website: prevent upsert crash if GEOIP country not found in odoo
It was reported the following error:
```
psycopg2.errors.DatatypeMismatch: column "country_id" is of type integer
                                  but expression is of type boolean
LINE 9:                 false, 1, NULL, 4, 4,
```

The root cause is unknown, it's not yet sure how this is happening
exactly.
This commit is then fixing naively the consequence.

Somehow, GEOIP is returning a country code which does not exists in Odoo
for this error to appear. It's normally not possible.

There is multiple possible cases that would lead to this error:
- The user modified the `code` field of a country in his DB (unlikely)
- The user deleted a country in his DB (unlikely)
- The GEOIP database is returning a country which does not exists in
  Odoo. This is the most probably case, even if the latest up to date
  `GeoLite 2 City` seems to have the exact same country code list as in
  Odoo 16.0 (250 exact same ones).

Moving the country_id search directly in the query will prevent the
issue and is better anyway to avoid an useless query everytime when
GEOIP is enabled.
Perf wise, it doesn't seems to alter at all the query speed.

closes odoo/odoo#108232

X-original-commit: 42fe2540620b7529d9a848c4570290cbf64a4f48
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-12-18 22:27:46 +01:00
Romain Derie 7edde2b5a5 [FIX] website: prevent loop if auth=user route used as homepage url
One can very well select a "auth=user route" as homepage for his
website, like /my.

There would then be an issue with such an URL being set as homepage:
- As the user landed in the homepage controller which is auth=public,
  the system will add the public user as env user (see
  `_auth_method_public()`).
```
@http.route('/', type='http', auth="public", website=True, sitemap=True)
def index(self, **kw):
```
- Then, that controller will reroute to the homepage url (/my). The
  request.httprequest.path will now be /my
- Then, that controller will recall the dispatcher stack:
  `request._serve_ir_http()`
- From there, this call won't fail as it should because the user is
  considered as logged in as it went already through the
  `_auth_method_public()`, adding the public user as env.user.
  `_auth_method_user()` won't raise its error.
- The /my page will be rendered despite not being logged in.

Once the user land on that page, the system will actually detect him as
logged out on a page supposed to be accessed when logged in.
It will then:
1. Show a toaster to inform the user
2. Auto reload the page
As the current URL is still `/` (due to the reroute and not a redirect),
the same flow will happen again, and again, looping forever.

--------

Note that accessing /my directly won't be an issue, as it won't go
through the homepage controller (which is auth=public), so there won't
be a user_id set on the env (the public user), meaning that the dispatch
layer will reject the access and raise an access error (through
`_auth_method_user()`.
Also note that the same behavior will occur when going through the first
menu fallback mechanism:
- if the user didn't setup any homepage_url
- and deleted his / website.page
- and his first website menu is /my
In that case, it will go through the first menu redirect fallback, which
will be working fine (as it's a redirect and not a reroute).
With both those 2 flows (going through redirect), the user will
correctly land on the login page (which will redirect to /my once logged
in).

------

Finally, the other solution would be to prevent such a configuration
(/my as homepage_url) but it was not easily doable (if doable at all),
see https://github.com/odoo/odoo/pull/99100#discussion_r963055251

------

A test is also added and over the more complexe case (which should cover
everything):
- With /my as homepage_url
- With the / website.page deleted
- With /my as first menu URL
-> Accessing / as public user should:
   1. Reroute to /my (because of the homepage_url set to it) which
      should fail now thanks to this commit
   2. Since the reroute / re-serve failed, it should reach the
      "first menu fallback" mechanism, which is also /my
   3. That fallback should be a redirect, not a reroute, so the user
      should actually land on the login page
   4. Once logged in on that page, it should properly redirect to /my

opw-3077339

X-original-commit: 4f5899f769266edc27a0b2d812df092b95f43c71
Part-of: odoo/odoo#107759
2022-12-12 17:17:09 +01:00
Romain Derie 206f7e79d0 [FIX] website: prevent error to be raised instead of warning logging
There is no method attribute, it was replaced by original_endpoint since
httpocalypse at [1].
So entering this `if` condition will actually crash as the logger won't
be able to find what it needs.

[1]: https://github.com/odoo/odoo/commit/c3714eafbd07f7c7b98ff98bc604d76db4fe1c7b#diff-5f1b777eb0bc30f3f494ffe3e1522524cd0822f6c94c8644070a6db7c40b9c34L905

closes odoo/odoo#107629

X-original-commit: fd84ad8b262ddbee50b93481aa5c5ff11a4eb6f7
Signed-off-by: Julien Castiaux <juc@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-12-09 18:37:48 +01:00
Arthur Detroux (ard) ddfb9c2186 [FIX] website: prevent tb when using a background video as cover
Prior to this commit, when using a background video on the cover of the
website_slides homepage (/slides), after saving, a traceback would
occur and the video would not be displayed.

Steps to reproduce:
- Install website_slide
- Go to /slides
- Enter edit mode
- Change the cover of the page by a video
- Save
- Traceback

The reason for that is that the cover snippet used on the homepage of
elearning is the root of an XPath instead of its own oe_structure. (This
was changed in 16.0)
[1] made it so that the style and class attributes are saved but did not
save any data attributes needed for the background-video widget to work.

This commit adds those data attributes.

[1]: https://github.com/odoo/odoo/commit/5b252215dc375526af87c31a32256dd1a9582f02

opw-3063043

closes odoo/odoo#107577

X-original-commit: 86dc4d4349d033c95c0e04e8c173f63e5e2044ed
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-12-09 11:48:56 +01:00
Vincent Schippefilt 25c6c15a06 [IMP] base,*: remove __last_update from all models
The main goal of this commit is to reduce the size of the registry by
removing the (almost) useless __last_update field.

Statistics # of fields with all modules installed:
before 30184 fields, 1299x last_update (4.30%)

Before this commit, the computed field __last_update was added on every model.
The idea behind this field was to have a computed field that had either
the write_date or the create_date if the write_date was empty. However,
the write_date is always written, even on creation, making it useless
to have the computed field __last_update

After this update, we completely remove from BaseModel:
* __last_update
* CONCURRENCY_CHECK_FIELD that was always defined as "__last_update"
* _compute_concurrency_field that was the compute function for __last_update

closes odoo/odoo#105739

Task-id: 3062140 (part of 3062137 improve registry load time)
Related: odoo/upgrade#4038
Related: odoo/enterprise#33939
Signed-off-by: Raphael Collet <rco@odoo.com>
2022-12-07 18:29:01 +01:00
qsm-odoo c7c0a6679e [FIX] website_blog, *: allow more than 6 blog posts in dynamic snippet
*: website

Commit [1] introduced the possibility to configure "website filters"
used in the website to display some records dynamically via the "dynamic
snippet" and its variants. One of their field is `limit` which is a max
number of records the filter allows to show (so that the client side
cannot ask for thousands of records). Users can configure the limit used
by a snippet via the editor: they are allowed to choose up to 16, still
safe-guarded by the internal limit configured on the website filter on
the python side.

The problem here was that [2] introduced website filters for the blog
posts but set up a max limit of 6. Thus breaking the editor option if
the user choose a limit between 7 and 16. This commit fixes the issue,
for newly configured snippets (as a stable fix) or for users who would
-u their blog application. EDIT: as the master version of this fix, all
blocks will now use their set limit. We consider that is an acceptable
change after migration that the user can change by himself if he wants
to.

Steps to reproduce:
- Install blog application
- Add a "Blog Posts" snippet
- Set "Fetched Elements" to 10 (there are 7 records in demo data)
=> Only 6 are still shown

[1]: https://github.com/odoo/odoo/commit/0e7640b5f22d2bea04bbe22d3189cff7e03af545
[2]: https://github.com/odoo/odoo/commit/3c0d98bcd8adf9325ee3497eb8d25ec7f904d6a5

opw-2885948

closes odoo/odoo#107179

X-original-commit: 3a3dc8729aa2beec49602fe4c141043f60effdf1
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-12-05 14:04:00 +01:00
Romain Derie a6bf6cf44d [FIX] website, test_website: prevent fuzzy search to crash with inherits
This commit ensures that when searching on a `inherits` field of
a model (like `name` of `website.page`), it works properly when
`pg_trgm` is activated.
Indeed, `name` is a field of `website.page` record but only at the ORM
level, not in SQL, due to how `inherits` works.

So, when the `pg_trgm` extension is enabled, it will switch from ORM
queries to raw SQL query (to use the native SQL similarity feature and
not our custom python/orm one, as obviously the SQL one is better, more
powerfull/accurate and faster).
But this will actually make the code fail when searching on fields from
a model which has `inherits` and that you search on that `inherits`
model fields.

Note that in 15.2, the `pg_trgm` extension is auto installed when
possible thanks to [1] and [2].

[1]: https://github.com/odoo/odoo/commit/eedf37d6e286b995c47b946be1a6b66817094eff
[2]: https://github.com/odoo/odoo/commit/75e6b645acdc95aece506ce0249fd0760838281c

opw-3063592

closes odoo/odoo#107178

X-original-commit: 3d978caad9de2010603581687ee39a5240b74074
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2022-12-04 23:41:55 +01:00
Romain Derie 999da9c285 [FIX] website: prevent crash if unexpected cookies bar cookie value
With commit [1] we refactored the cookies bar to let the user decide if
he wants to accept the cookies (and/or only part of it).
Before that commit, the `website_cookies_bar` cookie could only hold
`true` as value, which now is holding an object like
`{"required": true, "optional": false}`.

This creates an issue if a user is coming from a previous version with
`true` as cookie value because since the refactoring it will crash both
in JS and PY because `in` instruction with a boolean value will fail in
both languages.

The decision taken here is simply to remove the cookie if we face such a
case so the user can decide again what he wants (since there is more
choices now).
It also means that we won't be holding an outdated value in the cookie
any longer.

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

opw-3074303

closes odoo/odoo#106621

X-original-commit: 22392755ed4c504e6ba2a5a9c9eb6643f2c95994
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2022-11-25 19:52:05 +01:00
fdardenne 439db9eaeb [REF] website: view_hierarchy: refactor to client action
Before this commit, `view_hierarchy` extended the QWeb view to see
the hierarchy of views.

With the evolution of the javascript framework, this use case has
now more sense in a client action rather than an extension of a
QWeb view.

This commit refactors `view_hierarchy` into a client action.

Part-of: odoo/odoo#103477
2022-11-15 18:25:12 +01:00
Benoit Socias fadd1c8a87 [REV] *: revert "[REF] website, *: make _search_get_details extensible"
*: test_website, website, website_blog, website_event, website_forum,
   website_sale, website_slides

Reverts this refactoring because it breaks multi-tenancy: if several
databases run on the same server and different modules are installed
in each database, the global variable becomes wrongly populated.

Steps to reproduce:

On runbot:

- Go to the `-base` URL or simply select the `base` DB
- Drag & Drop the search snippet (and let it set to "Search in
Everything")
- Try to use the snippet -> Crash on unknown model

On Odoo.com saas DB:

- Drag & Drop the search snippet (and let it set to "Search in
Everything")
- Try to use the snippet -> Crash on unknown model (unless you installed
each and every module related to the search snippet)

Locally:

- odoo-bin -d first -i website --stop-after-init
- odoo-bin -d second -i website_blog --stop-after-init
- odoo-bin -d first,second
- Try to use a search bar on "first" database (using "Search in
Everything") => it tries to access the blog models.

Revert of PR: #98423

opw-3045092

closes odoo/odoo#105077

X-original-commit: 5806f71af1b6f44aac063f7e504be736300f699d
Related: odoo/enterprise#33669
Signed-off-by: Romain Derie (rde) <rde@odoo.com>
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
2022-11-07 11:26:58 +01:00
Julien Castiaux 7d9f117505 [FIX] website: generate routing map without request
This fix allows generating the sitemap (via `website.search_pages`) via
RPC. The changes are necessary as since #99667 the `request` object is
no more available to RPC-executed functions.

See also: the `test_search` test case of `website.tests.test_page`.

closes odoo/odoo#104567

X-original-commit: 8f4e214417cfb1aed7e595b8d6ab71f33a347b29
Signed-off-by: Julien Castiaux <juc@odoo.com>
2022-10-29 04:51:02 +02:00