[FIX] website_customer: /customers/country/

bzr revid: chm@openerp.com-20131205173936-0n203fzk4b49winn
This commit is contained in:
Christophe Matthieu 2013-12-05 18:39:36 +01:00
parent b2bd96340f
commit ab55b552f9
1 changed files with 7 additions and 5 deletions

View File

@ -15,10 +15,10 @@ class WebsiteCustomer(http.Controller):
@website.route([
'/customers/',
'/customers/page/<int:page>/',
'/customers/country/<int:country_id>',
'/customers/country/<int:country_id>/page/<int:page>/'
'/customers/country/<model("res.country"):country>',
'/customers/country/<model("res.country"):country>/page/<int:page>/'
], type='http', auth="public", multilang=True)
def customers(self, country_id=None, page=0, **post):
def customers(self, country=None, page=0, **post):
cr, uid, context = request.cr, request.uid, request.context
partner_obj = request.registry['res.partner']
partner_name = post.get('search', '')
@ -31,8 +31,10 @@ class WebsiteCustomer(http.Controller):
('name', 'ilike', "%%%s%%" % post.get("search")),
('website_description', 'ilike', "%%%s%%" % post.get("search"))
]
if country_id:
domain += [('country_id', '=', country_id)]
country_id = None
if country:
domain += [('country_id', '=', country.id)]
country_id = country.id
# group by country, based on all customers (base domain)
countries = partner_obj.read_group(