[FIX] website_customer: fix sitemap when customer had no country
Before this commit, the sitemap will crash if you have some res.partner
without country that are publish and with an assigned_partner_id.
Now, we only search for customer with country that are set and avoid to have
a traceback:
File "/home/odoo/src/odoo/11.0/addons/website_customer/controllers/main.py", line 31, in sitemap_industry
loc = '/customers/country/%s' % slug(country['country_id'])
File "/home/odoo/src/odoo/11.0/addons/http_routing/models/ir_http.py", line 91, in slug
identifier, name = value
TypeError: 'bool' object is not iterable
This commit is contained in:
@@ -24,7 +24,7 @@ class WebsiteCustomer(http.Controller):
|
||||
if not qs or qs.lower() in loc:
|
||||
yield {'loc': loc}
|
||||
|
||||
dom = [('website_published', '=', True), ('assigned_partner_id', '!=', False)]
|
||||
dom = [('website_published', '=', True), ('assigned_partner_id', '!=', False), ('country_id', '!=', False)]
|
||||
dom += sitemap_qs2dom(qs, '/customers/country')
|
||||
countries = env['res.partner'].sudo().read_group(dom, ['id', 'country_id'], groupby='country_id')
|
||||
for country in countries:
|
||||
|
||||
Reference in New Issue
Block a user