Skip to content
Snippets Groups Projects
Commit 8d6a971a authored by Adrien Widart's avatar Adrien Widart
Browse files

[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#69941

Signed-off-by: default avatarAdrien Widart <adwid@users.noreply.github.com>
parent 45c330c1
No related branches found
No related tags found
No related merge requests found
......@@ -54,8 +54,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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment