From 7dd70438e1ec5799a91623bbf7f4798453882b67 Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Thu, 13 Feb 2020 12:50:55 +0000 Subject: [PATCH] [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 --- addons/website/models/ir_http.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index 0acbe1bc837..b67bacf8da9 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -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'])}