Skip to content
Snippets Groups Projects
Commit eba0eafa authored by jerome hanke (jhk)'s avatar jerome hanke (jhk)
Browse files

[FIX] website_crm: state_id=false not shown in lead description


Steps to reproduce:
- install website, crm
- go to crm > settings > activate leads
- add a contact form to your website and submit
- go to the created lead

Previous behavior:
state_id is shown as false when geoip data is empty

Current behavior:
state_id is not shown if geoip is if the state found in geoip
does not not exist on the Odoo instance

opw-2218498

closes odoo/odoo#49379

Signed-off-by: default avatarmightyjol <jhk-odoo@users.noreply.github.com>
parent 41c05cbf
Branches
Tags
No related merge requests found
......@@ -14,9 +14,9 @@ class WebsiteForm(WebsiteForm):
geoip_country_code = request.session.get('geoip', {}).get('country_code')
geoip_state_code = request.session.get('geoip', {}).get('region')
if geoip_country_code and geoip_state_code:
State = request.env['res.country.state']
request.params['state_id'] = State.search([('code', '=', geoip_state_code), ('country_id.code', '=', geoip_country_code)]).id
state = request.env['res.country.state'].search([('code', '=', geoip_state_code), ('country_id.code', '=', geoip_country_code)])
if state:
request.params['state_id'] = state.id
return super(WebsiteForm, self).website_form(model_name, **kwargs)
def insert_record(self, request, model, values, custom, meta=None):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment