summaryrefslogtreecommitdiff
path: root/addons/website_crm
diff options
context:
space:
mode:
authorAdrien Widart <awt@odoo.com>2021-04-27 14:18:03 +0000
committerAdrien Widart <awt@odoo.com>2021-04-28 14:32:27 +0000
commit702d2b317df00626fcfbc70c80b7885cbc034f1d (patch)
tree3558015ad87cf4e58c7c677c8e0ca4894aed1fc6 /addons/website_crm
parentb0dc16e44d027bf27ec501d922459bf0f1db8550 (diff)
[FIX] website_crm: add language to website form
When the user submits a form, a lead will be created but the language won't be the one selected by the user. To reproduce the error: (Enable debug mode) 1. Settings > Translations > Languages 2. Activate another language L_other 3. On website, add a form: - Action: Create an Opportunity 4. Add an existing field: "Language" 5. Submit the form - Language must be L_other 6. Consult the new lead Error: The language is not the selected one. OPW-2486276 closes odoo/odoo#70031 X-original-commit: 8d6a971a8dba860fe7c2a453c3a15f62916f656a Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
Diffstat (limited to 'addons/website_crm')
-rw-r--r--addons/website_crm/controllers/main.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/addons/website_crm/controllers/main.py b/addons/website_crm/controllers/main.py
index 0226d3531d9..56279553137 100644
--- a/addons/website_crm/controllers/main.py
+++ b/addons/website_crm/controllers/main.py
@@ -53,8 +53,7 @@ class WebsiteForm(WebsiteForm):
if 'company_id' not in values:
values['company_id'] = request.website.company_id.id
lang = request.context.get('lang', False)
- lang_id = request.env["res.lang"].sudo().search([('code', '=', lang)], limit=1).id
- values['lang_id'] = lang_id
+ values['lang_id'] = values.get('lang_id') or request.env['res.lang']._lang_get_id(lang)
result = super(WebsiteForm, self).insert_record(request, model, values, custom, meta=meta)