summaryrefslogtreecommitdiff
path: root/addons/website_customer
diff options
context:
space:
mode:
authorJeremy Kersten <jke@odoo.com>2016-12-19 14:53:34 +0100
committerJeremy Kersten <jke@odoo.com>2016-12-20 09:49:48 +0100
commita35cce20084f67ac9598832cdc3d06cfdb5db755 (patch)
tree1964de19622a977c7de490b7a389cf95006c28ff /addons/website_customer
parent737cca3ec7f4e6bffa04fd2086816d57ba652a2f (diff)
[FIX] website_customer: fix new api migration
Avoid traceback 'list indices must be integers, not str' when country_id not in sidebar. env.browse(id).read(['name']) return a list, so country['name'] should be country[0]['name']
Diffstat (limited to 'addons/website_customer')
-rw-r--r--addons/website_customer/controllers/main.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/addons/website_customer/controllers/main.py b/addons/website_customer/controllers/main.py
index cba2b1cfbc6..03202d63a5f 100644
--- a/addons/website_customer/controllers/main.py
+++ b/addons/website_customer/controllers/main.py
@@ -50,15 +50,14 @@ 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 if x['country_id']):
- country = Country.browse(country_id).read(['name'])
- if country:
+ curr_country = Country.browse(country_id)
+ if country_id not in map(lambda x: x['country_id'][0], countries):
+ if curr_country.exists():
countries.append({
'country_id_count': 0,
- 'country_id': (country_id, country['name'])
+ 'country_id': (curr_country.id, curr_country.name)
})
countries.sort(key=lambda d: d['country_id'] and d['country_id'][1])
- curr_country = Country.browse(country_id)
countries.insert(0, {
'country_id_count': country_count,