From 3855829a0daf4321ab54cce3a71a92eb68c216b3 Mon Sep 17 00:00:00 2001 From: "Simon Goffaux (sigo)" <sigo@odoo.com> Date: Thu, 11 May 2023 14:58:31 +0000 Subject: [PATCH] [FIX] website: cast website_id to int in pagenew Cast website_id so that if it contains more than 1 digit, we do not browse() a tuple with each digit. For example, if we pass pagenew() the website_id '123', this is the current behavior: - browse('1', '2', '3') After this fix: - browse(123) To reproduce the erroneous behavior: - Create at least 10 websites so that the id of this website is at least in the double digits. - Create a new page within this website with a double digit id. - It will throw an expected singleton error. Issue was introduced in this commit: https://github.com/odoo/odoo/commit/d6014c60acc4231a5e56d492d2a39deaf789cbe8 opw-3290571 closes odoo/odoo#121486 Signed-off-by: Romain Derie (rde) <rde@odoo.com> --- addons/website/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/controllers/main.py b/addons/website/controllers/main.py index 4e6074b6b5a4..ad65d062de91 100644 --- a/addons/website/controllers/main.py +++ b/addons/website/controllers/main.py @@ -609,7 +609,7 @@ class Website(Home): template = template and dict(template=template) or {} website_id = kwargs.get('website_id') if website_id: - website = request.env['website'].browse(website_id) + website = request.env['website'].browse(int(website_id)) website._force() page = request.env['website'].new_page(path, add_menu=add_menu, **template) url = page['url'] -- GitLab