Skip to content
Snippets Groups Projects
Commit 93907673 authored by Jeremy Kersten's avatar Jeremy Kersten
Browse files

[FIX] website_customer: check that country id exists before access the name,...

[FIX] website_customer: check that country id exists before access the name, else traceback when we come from a non existing id via the url/controller
parent fa07bc85
No related branches found
No related tags found
No related merge requests found
......@@ -42,11 +42,12 @@ class WebsiteCustomer(http.Controller):
if country_id:
domain += [('country_id', '=', country_id)]
if not any(x['country_id'][0] == country_id for x in countries):
country = country_obj.browse(cr, uid, country_id, context)
countries.append({
'country_id_count': 0,
'country_id': (country_id, country.name)
})
country = country_obj.read(cr, uid, country_id, ['name'], context)
if country:
countries.append({
'country_id_count': 0,
'country_id': (country_id, country['name'])
})
countries.sort(key=lambda d: d['country_id'][1])
countries.insert(0, {
......
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