<feed xmlns='http://www.w3.org/2005/Atom'>
<title>Odoo/addons/website/models, branch 14.0</title>
<subtitle>The current checkout of upstream Odoo</subtitle>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/'/>
<entry>
<title>[FIX] website : prevent bad query</title>
<updated>2021-05-11T13:37:22+00:00</updated>
<author>
<name>Florent de Labarre</name>
<email>florent.mirieu@gmail.com</email>
</author>
<published>2021-05-11T13:37:22+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=d0db984990679a63714ca62e6b605d94af7d5c28'/>
<id>d0db984990679a63714ca62e6b605d94af7d5c28</id>
<content type='text'>
In database with front end, there are lot of bad query like this:
bad query: UPDATE "website_visitor" SET "timezone"='Europe/Paris',"write_uid"=116,"write_date"=(now() at time zone 'UTC') WHERE id IN (15414)

closes odoo/odoo#70507

Error: Could not serialize access due to concurrent update
Signed-off-by: Thibault Delavallee (tde) &lt;tde@openerp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In database with front end, there are lot of bad query like this:
bad query: UPDATE "website_visitor" SET "timezone"='Europe/Paris',"write_uid"=116,"write_date"=(now() at time zone 'UTC') WHERE id IN (15414)

closes odoo/odoo#70507

Error: Could not serialize access due to concurrent update
Signed-off-by: Thibault Delavallee (tde) &lt;tde@openerp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] http_routing, website: prevent crash when using `fw` in url</title>
<updated>2021-05-03T16:16:12+00:00</updated>
<author>
<name>Romain Derie</name>
<email>rde@odoo.com</email>
</author>
<published>2021-04-16T15:21:33+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=0490828de135406675b8c6949cf31cdccd697b02'/>
<id>0490828de135406675b8c6949cf31cdccd697b02</id>
<content type='text'>
Before this commit, the routing map generated and used would be the one from
the website the request is performed, instead of the one from the `fw` website
ID which will be the one we redirect the user to.

This issue was introduced with the routing map by website, be8fc2296b38 and is
restricted to a single case: a publisher using the website switcher, and it
won't happen on next page naviguation/refresh as the `fw` website id will be
the same as the current website's ID. Thus there won't be any routing map
mismatch.

Step to reproduce:
  - Create a page on website 2, set it as homepage
  - Naviguate to website 1 on '/' url
  - Naviguate to website 2 on '/' url
This will raise a werkzeug error about `EndPoint not iterable`.

----- Technical analysis ------

This is the current flow:
1. `_dispatch()` is setting `website_routing` to `get_current_website()` -&gt; 2
2. `_dispatch()` is calling `_match()`
3. `_match()` is calling `routing_map()` with key = `website_routing`, which
   was set to 2 in step 1.
4. `routing_map()` is calling `_generate_routing_rules()` which generate the
   rules based on `website_routing`, which was set to 2 in step 1.
5. `_dispatch()` authenticate the user by calling `_authenticate()`
6. `_dispatch()` is calling `_add_dispatch_parameter()`, where URL param `fw`
   is forced in session, so `get_current_website()` now return the correct
   `website_id` -&gt; 1

The issue: in order to handle the `fw` URL parameter (step 6.), we need to
check the rights to ensure we can allow the website switch.
To check rights, user need to be authenticated (step 5.), which is done after
generating the routing map (2. &amp; 3. &amp; 4.).
The routing map is generated based on the current website (step 1.)

Step 6 depends of steps 5 which depends of steps 2/3/4 which depend of step 1,
but step 1 should depend of step 6, which is an impossible cycle.

closes odoo/odoo#70278

X-original-commit: 878e28f93a65756fa2002ef2af5b02a3e2c59b1b
Signed-off-by: Jérémy Kersten (jke) &lt;jke@openerp.com&gt;
Signed-off-by: Romain Derie &lt;rdeodoo@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this commit, the routing map generated and used would be the one from
the website the request is performed, instead of the one from the `fw` website
ID which will be the one we redirect the user to.

This issue was introduced with the routing map by website, be8fc2296b38 and is
restricted to a single case: a publisher using the website switcher, and it
won't happen on next page naviguation/refresh as the `fw` website id will be
the same as the current website's ID. Thus there won't be any routing map
mismatch.

Step to reproduce:
  - Create a page on website 2, set it as homepage
  - Naviguate to website 1 on '/' url
  - Naviguate to website 2 on '/' url
This will raise a werkzeug error about `EndPoint not iterable`.

----- Technical analysis ------

This is the current flow:
1. `_dispatch()` is setting `website_routing` to `get_current_website()` -&gt; 2
2. `_dispatch()` is calling `_match()`
3. `_match()` is calling `routing_map()` with key = `website_routing`, which
   was set to 2 in step 1.
4. `routing_map()` is calling `_generate_routing_rules()` which generate the
   rules based on `website_routing`, which was set to 2 in step 1.
5. `_dispatch()` authenticate the user by calling `_authenticate()`
6. `_dispatch()` is calling `_add_dispatch_parameter()`, where URL param `fw`
   is forced in session, so `get_current_website()` now return the correct
   `website_id` -&gt; 1

The issue: in order to handle the `fw` URL parameter (step 6.), we need to
check the rights to ensure we can allow the website switch.
To check rights, user need to be authenticated (step 5.), which is done after
generating the routing map (2. &amp; 3. &amp; 4.).
The routing map is generated based on the current website (step 1.)

Step 6 depends of steps 5 which depends of steps 2/3/4 which depend of step 1,
but step 1 should depend of step 6, which is an impossible cycle.

closes odoo/odoo#70278

X-original-commit: 878e28f93a65756fa2002ef2af5b02a3e2c59b1b
Signed-off-by: Jérémy Kersten (jke) &lt;jke@openerp.com&gt;
Signed-off-by: Romain Derie &lt;rdeodoo@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] website{,_livechat}: 'Website Visitor' translated</title>
<updated>2021-04-30T06:16:54+00:00</updated>
<author>
<name>Nicolas Lempereur</name>
<email>nle@odoo.com</email>
</author>
<published>2021-04-12T17:10:12+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=7d28f32d9be1590764883f4621df04e04c4e1f12'/>
<id>7d28f32d9be1590764883f4621df04e04c4e1f12</id>
<content type='text'>
Make translation works for "Website Visitor" that was appearing when a
logged-out user open a livechat session.

note: list comprehension has to be removed since translation only search
language in direct calling method closure.

opw-2504461

closes odoo/odoo#70135

X-original-commit: 7e0cf9679ee86e1b3e8094606fd815ffe46eb3c1
Signed-off-by: Nicolas Lempereur (nle) &lt;nle@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make translation works for "Website Visitor" that was appearing when a
logged-out user open a livechat session.

note: list comprehension has to be removed since translation only search
language in direct calling method closure.

opw-2504461

closes odoo/odoo#70135

X-original-commit: 7e0cf9679ee86e1b3e8094606fd815ffe46eb3c1
Signed-off-by: Nicolas Lempereur (nle) &lt;nle@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] website: use correct url code to get canonical url</title>
<updated>2021-04-27T09:49:34+00:00</updated>
<author>
<name>Romain Derie</name>
<email>rde@odoo.com</email>
</author>
<published>2021-04-19T16:18:30+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=733411fe03b924832d6b10cadf93c8fc09cc5802'/>
<id>733411fe03b924832d6b10cadf93c8fc09cc5802</id>
<content type='text'>
Before this commit, we would compare a lang `code` (used in context) and a lang
`url_code`. For languages where those 2 are differents, the `if` condition
would always be falsy, making the canonical URL impossible to be reached.

Technically, this condition is used to get the translated name of records to
later construct the canonical URL.

Since the canonical URL will be incorrect and unreachable, the whole system to
tell search engine/crawler about translation won't work since no
`alternate/hreflang`[1] will be set in the DOM.

[1] see https://developers.google.com/search/docs/advanced/crawling/localized-versions

--------

Technical explanation:
- italian language `code` = `it_IT`, `url_code` = `it`
- belgian french language `code` = `fr_BE`, `url_code` = `fr_BE`
Install those languages on website as secondary languages.
Translate blog `Travel` to `Voyager` in french and `Viaggi` in italian.
Visiting `/fr_BE/blog/travel-1/post/post-1` will redirect to
`/fr_BE/blog/voyager-1/post/post-1` as it should, and the canonical URL will be
set to that same URL.
Visiting `/it/blog/travel-1/post/post-1` will redirect to
`/it/blog/voyager-1/post/post-1` as it should, but the canonical URL will be
set to `/it/blog/travel-1/post/post-1`.

opw-2486918

closes odoo/odoo#69867

X-original-commit: 413357e0f4538ad441184d1d8b4c9a49fc18a5d9
Signed-off-by: Romain Derie &lt;rdeodoo@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this commit, we would compare a lang `code` (used in context) and a lang
`url_code`. For languages where those 2 are differents, the `if` condition
would always be falsy, making the canonical URL impossible to be reached.

Technically, this condition is used to get the translated name of records to
later construct the canonical URL.

Since the canonical URL will be incorrect and unreachable, the whole system to
tell search engine/crawler about translation won't work since no
`alternate/hreflang`[1] will be set in the DOM.

[1] see https://developers.google.com/search/docs/advanced/crawling/localized-versions

--------

Technical explanation:
- italian language `code` = `it_IT`, `url_code` = `it`
- belgian french language `code` = `fr_BE`, `url_code` = `fr_BE`
Install those languages on website as secondary languages.
Translate blog `Travel` to `Voyager` in french and `Viaggi` in italian.
Visiting `/fr_BE/blog/travel-1/post/post-1` will redirect to
`/fr_BE/blog/voyager-1/post/post-1` as it should, and the canonical URL will be
set to that same URL.
Visiting `/it/blog/travel-1/post/post-1` will redirect to
`/it/blog/voyager-1/post/post-1` as it should, but the canonical URL will be
set to `/it/blog/travel-1/post/post-1`.

opw-2486918

closes odoo/odoo#69867

X-original-commit: 413357e0f4538ad441184d1d8b4c9a49fc18a5d9
Signed-off-by: Romain Derie &lt;rdeodoo@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] website_livechat: hide visited website.page for non website_designer</title>
<updated>2021-03-29T08:43:44+00:00</updated>
<author>
<name>David Beguin</name>
<email>dbe@odoo.com</email>
</author>
<published>2020-09-01T10:10:33+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=69cc2911b52fd17b37fb71544574f63cf09dd17e'/>
<id>69cc2911b52fd17b37fb71544574f63cf09dd17e</id>
<content type='text'>
When opening the visitor view, if user is not website designer, there was an
access error as only website editor can read website.page model.

This commit applies the website_designer group to page_ids field to avoid crash.
There are no viable solution to show the visited page in stable without changing
the model definition. Hide the info is then the better solution.

Task ID-2301261
PR odoo/odoo#60549</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When opening the visitor view, if user is not website designer, there was an
access error as only website editor can read website.page model.

This commit applies the website_designer group to page_ids field to avoid crash.
There are no viable solution to show the visited page in stable without changing
the model definition. Hide the info is then the better solution.

Task ID-2301261
PR odoo/odoo#60549</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] website: avoid duplication of cookie policy page</title>
<updated>2021-03-05T07:46:39+00:00</updated>
<author>
<name>Benoit Socias</name>
<email>bso@odoo.com</email>
</author>
<published>2021-03-04T12:43:56+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=2f920e0023d29545d2957e5d6ca1619068af893b'/>
<id>2f920e0023d29545d2957e5d6ca1619068af893b</id>
<content type='text'>
Before this commit a cookie policy page was created every time the
website settings were saved with the "Cookies Bar" option enabled.

After this commit the policy page is created only if it does not already
exist for the website.

task-2454424
https://github.com/odoo/odoo/pull/67217

closes odoo/odoo#67217

Signed-off-by: Jérémy Kersten (jke) &lt;jke@openerp.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this commit a cookie policy page was created every time the
website settings were saved with the "Cookies Bar" option enabled.

After this commit the policy page is created only if it does not already
exist for the website.

task-2454424
https://github.com/odoo/odoo/pull/67217

closes odoo/odoo#67217

Signed-off-by: Jérémy Kersten (jke) &lt;jke@openerp.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] base, web_editor, website: add missing encoding on etree.tostring</title>
<updated>2021-02-25T15:17:58+00:00</updated>
<author>
<name>Jeremy Kersten</name>
<email>jke@odoo.com</email>
</author>
<published>2021-01-12T14:40:06+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=38983d123d171ac3cc1efacd99d9776f0ed08734'/>
<id>38983d123d171ac3cc1efacd99d9776f0ed08734</id>
<content type='text'>
Since lxml 4.5.0 that use now use libxml2 2.9.10, without it, it can crash.

Here sample of content that is broken:
https://drive.google.com/file/d/1gB2-jl4fabHscLjH9OZc4WZgtSEbCVj7/view?usp=sharing

note: this commit is to merge 3 changes of #64526

opw-2428617
opw-2428664

closes odoo/odoo#66866

Signed-off-by: Nicolas Lempereur (nle) &lt;nle@odoo.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since lxml 4.5.0 that use now use libxml2 2.9.10, without it, it can crash.

Here sample of content that is broken:
https://drive.google.com/file/d/1gB2-jl4fabHscLjH9OZc4WZgtSEbCVj7/view?usp=sharing

note: this commit is to merge 3 changes of #64526

opw-2428617
opw-2428664

closes odoo/odoo#66866

Signed-off-by: Nicolas Lempereur (nle) &lt;nle@odoo.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] base, website: replicate inherit_id update on cow view</title>
<updated>2021-02-11T10:24:48+00:00</updated>
<author>
<name>Romain Derie</name>
<email>rde@odoo.com</email>
</author>
<published>2021-01-12T18:40:46+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=3f96cff0aa5097a386c289cf9fd2aeb3048376ab'/>
<id>3f96cff0aa5097a386c289cf9fd2aeb3048376ab</id>
<content type='text'>
Before this commit, only whitelisted fields would be updated on cow views
during a module update.
A field would be whitelisted if he had the same value than the original view,
see it as a heuristic to not write on modified fields.

But `inherit_id` is not that simple, even if the cow view has a different value
than its original view, it doesn't mean it was modified by the user, it is just
because of the cow mechanism that assigned a copied view as inherit_id, which
is just a copy ofthe original one.

We can thus consider `inherit_id` as unchanged and whitelist it if the `key` is
the same.

In practice, it means that cow'd views did not receive the `inherit_id` updates
as in commit https://github.com/odoo/odoo/commit/c8577568a1e39f6692889b3e21652fa3b8df06b2#diff-823e5db841dca1798ff1300e243059a4e1c93343598d2be5a1d1dcd1d2d0c273R537
where `portal.my_account_link` had its `inherit_id` changed from
`portal.frontend_layout` to `portal.user_dropdow`, see https://github.com/odoo/upgrade/pull/2059:

Considering a module update changing `inherit_id` of D from A to B, the
following use cases are expected. Without this fix, D' never move:

CASE 1
  A    A'   B                      A    A'   B
  |    |                 =&gt;                 / \
  D    D'                                  D   D'

CASE 2
  A    A'   B    B'               A    A'   B   B'
  |    |                 =&gt;                 |   |
  D    D'                                   D   D'

CASE 3
    A    B                        A    B
   / \                   =&gt;           / \
  D   D'                             D   D'

CASE 4
    A    B    B'                  A    B   B'
   / \                   =&gt;            |   |
  D   D'                               D   D'

Opw: 2422773
Opw: 2422727
Opw: 2422770
Opw: 2423406
Opw: 2423859

X-original-commit: 2951ed681aa5e31563e501de691716806ddb46bd</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this commit, only whitelisted fields would be updated on cow views
during a module update.
A field would be whitelisted if he had the same value than the original view,
see it as a heuristic to not write on modified fields.

But `inherit_id` is not that simple, even if the cow view has a different value
than its original view, it doesn't mean it was modified by the user, it is just
because of the cow mechanism that assigned a copied view as inherit_id, which
is just a copy ofthe original one.

We can thus consider `inherit_id` as unchanged and whitelist it if the `key` is
the same.

In practice, it means that cow'd views did not receive the `inherit_id` updates
as in commit https://github.com/odoo/odoo/commit/c8577568a1e39f6692889b3e21652fa3b8df06b2#diff-823e5db841dca1798ff1300e243059a4e1c93343598d2be5a1d1dcd1d2d0c273R537
where `portal.my_account_link` had its `inherit_id` changed from
`portal.frontend_layout` to `portal.user_dropdow`, see https://github.com/odoo/upgrade/pull/2059:

Considering a module update changing `inherit_id` of D from A to B, the
following use cases are expected. Without this fix, D' never move:

CASE 1
  A    A'   B                      A    A'   B
  |    |                 =&gt;                 / \
  D    D'                                  D   D'

CASE 2
  A    A'   B    B'               A    A'   B   B'
  |    |                 =&gt;                 |   |
  D    D'                                   D   D'

CASE 3
    A    B                        A    B
   / \                   =&gt;           / \
  D   D'                             D   D'

CASE 4
    A    B    B'                  A    B   B'
   / \                   =&gt;            |   |
  D   D'                               D   D'

Opw: 2422773
Opw: 2422727
Opw: 2422770
Opw: 2423406
Opw: 2423859

X-original-commit: 2951ed681aa5e31563e501de691716806ddb46bd</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] website: handle RequestUID case in slug</title>
<updated>2021-01-25T13:36:30+00:00</updated>
<author>
<name>Jeremy Kersten</name>
<email>jke@odoo.com</email>
</author>
<published>2021-01-21T13:32:17+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=62ee506a94b9fc4a6198c87cb8a2f186ed8bc6d3'/>
<id>62ee506a94b9fc4a6198c87cb8a2f186ed8bc6d3</id>
<content type='text'>
Before this commit, a 308 on a route with a modelconverter for a model
that have a seo_name field will crash with an exception:
Cannot iterate on RequestUID

Another simplest solution was to use a with_user(SUPERUSER_ID) but in this case
it bypass the security set and display the name of the record even if not yet
published.

How to reproduce:

Create a 308 from /shop/&lt;product&gt; to /mag/&lt;product&gt;
Unpublish product 10
Try to access /shop/product-10

You have an unmanaged '500 internal error"
because slug_matching -&gt; build -&gt; to_url -&gt; slug with a record with Requestuid
as env._uid.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Before this commit, a 308 on a route with a modelconverter for a model
that have a seo_name field will crash with an exception:
Cannot iterate on RequestUID

Another simplest solution was to use a with_user(SUPERUSER_ID) but in this case
it bypass the security set and display the name of the record even if not yet
published.

How to reproduce:

Create a 308 from /shop/&lt;product&gt; to /mag/&lt;product&gt;
Unpublish product 10
Try to access /shop/product-10

You have an unmanaged '500 internal error"
because slug_matching -&gt; build -&gt; to_url -&gt; slug with a record with Requestuid
as env._uid.</pre>
</div>
</content>
</entry>
<entry>
<title>[FIX] website: Warning message on website if dynamic snippet category deleted</title>
<updated>2021-01-22T11:22:12+00:00</updated>
<author>
<name>Nasreddin (bon)</name>
<email>bon@odoo.com</email>
</author>
<published>2021-01-21T10:40:54+00:00</published>
<link rel='alternate' type='text/html' href='http://erp.ceuconsult.com:9000/Odoo/commit/?id=e452d30f739db39a088248a3109c8c49cff9d49f'/>
<id>e452d30f739db39a088248a3109c8c49cff9d49f</id>
<content type='text'>
Issue

	- Install "Ecommerce" app
	- Go to 'Shop' page and edit it
	- Add a "Dynamic Products" block
	- Click on it to edit it :
	-  Select any template
	-  Select `Desks` as product category
	-  Save
	- Go to "Website -&gt; Configuration -&gt; eCommerce Categories"
	- Delete the "Desks" category
	- Go back to Shop page

	Error : "Record does not exist or has been deleted".

Cause

	The search domain is looking for child categories of dataset.productCategoryId
	(who does not exist anymore in the above case).
	`child_of` do a browse() to fetch the records, and therefore generate
	an error if category not found.

Solution

	Log warning message if unexptected domain and return empty records set instead.

This commit also reverts commit 0de069b8ca9fb005ba5b076984f5677de25889ee that generated the issue.

opw-2440917

closes odoo/odoo#64847

Signed-off-by: LTU-Odoo &lt;IT-Ideas@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Issue

	- Install "Ecommerce" app
	- Go to 'Shop' page and edit it
	- Add a "Dynamic Products" block
	- Click on it to edit it :
	-  Select any template
	-  Select `Desks` as product category
	-  Save
	- Go to "Website -&gt; Configuration -&gt; eCommerce Categories"
	- Delete the "Desks" category
	- Go back to Shop page

	Error : "Record does not exist or has been deleted".

Cause

	The search domain is looking for child categories of dataset.productCategoryId
	(who does not exist anymore in the above case).
	`child_of` do a browse() to fetch the records, and therefore generate
	an error if category not found.

Solution

	Log warning message if unexptected domain and return empty records set instead.

This commit also reverts commit 0de069b8ca9fb005ba5b076984f5677de25889ee that generated the issue.

opw-2440917

closes odoo/odoo#64847

Signed-off-by: LTU-Odoo &lt;IT-Ideas@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
