[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) <tde@openerp.com>
This commit is contained in:
Maruan Aguerdouh (magm)
2023-01-31 15:17:58 +01:00
parent f1cb5e6b39
commit 54607d473f
@@ -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({