[FIX] website: list real url endpoint, not 301 url

Sitemap uses `generate()` results, which were using `_rec_name` as slugified
URL.
Routing map has endurl using slugified `display_name` which is checked against
during `dispatch()`, that will redirect 301 to that url.

For instance:
  - `/shop/product/acoustic-bloc-screens-23` is listed in sitemap while this
    URL is not the correct endpoint. Reaching this URL will 301 redirect you to
    `/shop/product/furn-6666-acoustic-bloc-screens-23`.
  - `http://localhost:8069/event/design-fair-los-angeles-1` in sitemap which
    redirect to `/event/design-fair-los-angeles-2020-02-14-2020-02-18-1`.

Sitemap should contains endurl, not 301 URL.

task-2119086

closes odoo/odoo#45642

X-original-commit: f4c60bd55920d4e24de817634032649b3c3caff0
Signed-off-by: Romain Derie <rdeodoo@users.noreply.github.com>
This commit is contained in:
Romain Derie
2020-02-18 14:08:02 +00:00
parent cc7f89bee7
commit 7dd70438e1
+2 -3
View File
@@ -383,6 +383,5 @@ class ModelConverter(ModelConverter):
domain = safe_eval(self.domain, (args or {}).copy())
if dom:
domain += dom
for record in Model.search_read(domain=domain, fields=['write_date', Model._rec_name]):
if record.get(Model._rec_name, False):
yield {'loc': (record['id'], record[Model._rec_name])}
for record in Model.search_read(domain, ['display_name']):
yield {'loc': (record['id'], record['display_name'])}