[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#50055 X-original-commit: eba0eafac78adb498f8062f3490cea0847ed7927 Signed-off-by: mightyjol <jhk-odoo@users.noreply.github.com>
This commit is contained in:
@@ -43,9 +43,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):
|
||||
|
||||
Reference in New Issue
Block a user