summaryrefslogtreecommitdiff
path: root/addons/website_customer/controllers/main.py
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2014-07-31 14:43:42 +0200
committerJeremy Kersten <jke@odoo.com>2014-07-31 14:43:42 +0200
commit939076737673f67bad81c5ca886404e87dbaf3d4 (patch)
treec0d3b589a3c2aca1d44c8897ed0436ca2f3fd898 /addons/website_customer/controllers/main.py
parentfa07bc85329d825107f332053cecd2a51771823c (diff)
[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
Diffstat (limited to 'addons/website_customer/controllers/main.py')
-rw-r--r--addons/website_customer/controllers/main.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/addons/website_customer/controllers/main.py b/addons/website_customer/controllers/main.py
index 810faf8bdf6..1c316bf0847 100644
--- a/addons/website_customer/controllers/main.py
+++ b/addons/website_customer/controllers/main.py
@@ -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, {