Files
odoo_source/addons/website_form/controllers
jvm-odoo 70a79da8a0 [FIX] website_form: fix wrong user sending email
Issue

	When you send a form which create a customer
	from the website, you get a 400 error.

	I used the customer database to reproduce
	the issue. I guess this is due to specific
	settings who set a value for `meta` here

	https://github.com/odoo/odoo/blob/5381e9d900b344e7d48a6b347c5fc551d433b15e/addons/website_form/controllers/main.py#L187

Cause

	The cause is the same than the one for fc8a0474b4
	Here, we use sudo:
	https://github.com/odoo/odoo/blob/5381e9d900b344e7d48a6b347c5fc551d433b15e/addons/website_form/controllers/main.py#L211

	sudo adds a flag "su" and does not replace the user in env
	So we have "public user" who doesn't have email instead
	of OdooBot who has an email, there is a raise who explain
	the issue but it's not forwarded to the error in the website

Solution

	Use with_user(SUPERUSER_ID) instead of sudo, in order to have
	the right user (as it is done few lines above.

OPW-2220816

closes odoo/odoo#48481

X-original-commit: 1dba2ec8166b934d0698220e7062280d347f8af1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-03-27 09:50:27 +00:00
..