*: web_tour, website_blog Since [1] when the search box autocomplete was introduced, the URL parameters are implicitly included into the RPC that fetches the autocompletion results. Those parameters were not correctly unescaped before being sent to the RPC call. Because of this, a timestamp such as "2023-01-01 23:00:00" was sent as "2023-01-01+23%3A00%3A00" to the server. If that string reached the SQL layer, the "+" was interpreted as defining a timezone. This commit unescapes the URL parameters before using them in the RPC. Note that javascript's `decodeURIComponent` does not handle the '+' encoding of spaces inside URL parameters. For testing purpose, the following updates were needed to make it possible to select the `<option>` within the Archive month `<select>`: - because the `option`s are in a tree, the tool was adapted to take all `option`s into consideration instead of only the direct children of the `select`. - because the `option` text is dynamically created from the date of the test execution, the tool was adapted to allow targeting an `option` based on its index by specifying the tour step's `run` as `'text index N'`, `N` being the index of the `option`. Steps to reproduce: - Enable the sidebar of the `/blog` page. - Select a month in the sidebar. - Type something in the search box. => Did show an error popup while obtaining the autocompletion records. [1]: https://github.com/odoo/odoo/commit/7559626c54e34b41e1549e28276a650accec6986 task-3213916 closes odoo/odoo#114913 X-original-commit: 115fc399461c37b57127684cf5c28f05443fbb54 Signed-off-by: Romain Derie (rde) <rde@odoo.com> Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
import odoo.tests
|
|
|
|
|
|
@odoo.tests.tagged('post_install', '-at_install')
|
|
class TestUi(odoo.tests.HttpCase):
|
|
def test_admin(self):
|
|
# Ensure at least two blogs exist for the step asking to select a blog
|
|
self.env['blog.blog'].create({'name': 'Travel'})
|
|
|
|
# Ensure at least one image exists for the step that chooses one
|
|
self.env['ir.attachment'].create({
|
|
'public': True,
|
|
'type': 'url',
|
|
'url': '/web/image/123/transparent.png',
|
|
'name': 'transparent.png',
|
|
'mimetype': 'image/png',
|
|
})
|
|
|
|
self.start_tour(self.env['website'].get_client_action_url('/'), 'blog', login='admin')
|
|
|
|
def test_blog_post_tags(self):
|
|
self.start_tour(self.env['website'].get_client_action_url('/blog'), 'blog_tags', login='admin')
|
|
|
|
def test_autocomplete_with_date(self):
|
|
self.env.ref('website_blog.opt_blog_sidebar_show').active = True
|
|
self.env.ref('website_blog.opt_sidebar_blog_index_follow_us').active = False
|
|
self.start_tour("/blog", 'blog_autocomplete_with_date')
|