-
- Downloads
[IMP] test_website: add a test for 308 redirect with multi url route
This commit introduces a test in Odoo 15 about a broken behavior in Odoo 16 which was not covered by a test. A fix will be shipped alongside this commit forward-port in Odoo 16. The behavior involved here is about: - Having a multi-url defined route - One of those URL not having a model converter - One of those URL having a model converter - Creating a 308 redirect for the URL without model converter Something like this route (real example from the code): ```py @http.route([ '''/shop''', '''/shop/page/<int:page>''', '''/shop/category/<model("product.public.category"):category>''', '''/shop/category/<model("product.public.category"):category>/page/<int:page>''' ], type='http', auth="public", website=True, sitemap=sitemap_shop) ``` And this redirect (real usual example from clients): ```py self.env['website.rewrite'].create({ 'name': 'Test Multi URL 308', 'redirect_type': '308', 'url_from': '/shop', 'url_to': '/magasin', }) ``` In Odoo 15, everything will work as expected: 1. Accessing /shop will redirect to /magasin 2. Accessing /shop/category/categ-1 will not redirect and user will be on /shop/category/categ-1 still But in Odoo 16: In the case described above, acessing the URL with model converter from the route will fail and redirect to a non slugified URL in the form of `/some-url?param=test.model%287%2C%29` which is basically the stringified encoded version of the record `test.model(7,)`. Note: - It doesn't matter if the route is contained in the other, the error will still occur even if `'''/shop'''` was `'''/abc'''`. - Even if all URL from the route have their own 308 redirect, the error will still occur. - It won't have any issue if there is a 308 on the route with model converter: both the one without model converter and other url with model converter will work and won't be impacted. This might be because of a concept of "merging URL" from httpocalypse, see https://github.com/odoo/odoo/commit/347a3ccf763cc6958d5dc1df3168c9c65245736c opw-3450054 opw-3466498 opw-3477380 opw-3475694 X-original-commit: 9230f7db60b10ca2a3e83d6beefb6cf72d09a804 Part-of: odoo/odoo#133371
Loading
Please register or sign in to comment