diff options
| author | jvm-odoo <jvm@odoo.com> | 2020-02-21 13:32:18 +0000 |
|---|---|---|
| committer | jvm-odoo <jvm@odoo.com> | 2020-03-04 09:53:50 +0000 |
| commit | 024010bbe17242537c691fb7f12db8655db8fe87 (patch) | |
| tree | d3df41867e873de5eeb2e606ec1edcb6e89e2986 /addons/website_form/controllers/main.py | |
| parent | 617e53229e6342f30f89c6ed03a2d3248c56ba4f (diff) | |
[FIX] website_form: fix wrong user sending website forms
Issue
- Set outgoing mail server
- Install Online Ticket Submission
- Publish an Helpdesk Team
- Log out
- Create a ticket from the helpdesk form
The user who created the ticket is "Public User"
He has no email address, so the mail is not sent
Cause
insert_record method in website_form/main.py uses .sudo()
In v12 => sudo replaces the user in env by the superuser => ok
In v13 => sudo adds a flag "su" and does not replace the user in env
Solution
Add a with_user(SUPERUSER_ID) to the create method's call in
insert_record
OPW-2196668
closes odoo/odoo#46835
X-original-commit: 761ae16634b14bec7be522666bb2163490566ecc
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Diffstat (limited to 'addons/website_form/controllers/main.py')
| -rw-r--r-- | addons/website_form/controllers/main.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/website_form/controllers/main.py b/addons/website_form/controllers/main.py index 1e3614bf3d5..c6708b2fac6 100644 --- a/addons/website_form/controllers/main.py +++ b/addons/website_form/controllers/main.py @@ -182,7 +182,7 @@ class WebsiteForm(http.Controller): model_name = model.sudo().model if model_name == 'mail.mail': values.update({'reply_to': values.get('email_from')}) - record = request.env[model_name].sudo().with_context(mail_create_nosubscribe=True).create(values) + record = request.env[model_name].with_user(SUPERUSER_ID).with_context(mail_create_nosubscribe=True).create(values) if custom or meta: _custom_label = "%s\n___________\n\n" % _("Other Information:") # Title for custom fields |
