Skip to content
Snippets Groups Projects
Commit 9fd7501b 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#70050

X-original-commit: 8d6a971a
Signed-off-by: default avatarAdrien Widart <adwid@users.noreply.github.com>
parent b24793b9
Branches
Tags
No related merge requests found
......@@ -83,8 +83,7 @@ class WebsiteForm(main.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.
Please register or to comment