From 54607d473fca4fa040d15b174a619f06e020986e Mon Sep 17 00:00:00 2001 From: "Maruan Aguerdouh (magm)" Date: Mon, 30 Jan 2023 14:54:11 +0000 Subject: [PATCH] [FIX] website_mass_mailing: fix traceback when submitting a newsletter website_form Steps to reproduce: - Install website_mass_mailing - Go to Website homepage and edit to add a newsletter block. - Drag the block to add it to the page and inside it change the Template to Form Susbscription. - Save the page and try to fill the form logged out. Issue: We get an error about permission as we don't have any access. Solution: Added proper `sudo` to the search so we avoid the error. opw-3145571 closes odoo/odoo#111468 X-original-commit: 3631643e0d6294d3fa6c8e1b3bb087c08bbabb4a Signed-off-by: Thibault Delavallee (tde) --- addons/website_mass_mailing/controllers/website_form.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_mass_mailing/controllers/website_form.py b/addons/website_mass_mailing/controllers/website_form.py index f8fe538e680..6169a37d63d 100644 --- a/addons/website_mass_mailing/controllers/website_form.py +++ b/addons/website_mass_mailing/controllers/website_form.py @@ -13,7 +13,7 @@ class WebsiteNewsletterForm(WebsiteForm): def _handle_website_form(self, model_name, **kwargs): if model_name == 'mailing.contact': list_ids = [int(x) for x in kwargs['list_ids'].split(',')] - private_list_ids = request.env['mailing.list'].search([ + private_list_ids = request.env['mailing.list'].sudo().search([ ('id', 'in', list_ids), ('is_public', '=', False)]) if private_list_ids: return json.dumps({