[FIX] website_customer: keep search even if we change the country, list of country display all countries where there is at least one matching result

bzr revid: dle@openerp.com-20140130163639-5z0pt5npgk0t3u8k
This commit is contained in:
Denis Ledoux 2014-01-30 17:36:39 +01:00
parent 6dca5f8f1c
commit ba09b1d439
2 changed files with 4 additions and 4 deletions

View File

@ -34,9 +34,6 @@ class WebsiteCustomer(http.Controller):
('website_description', 'ilike', post.get("search"))
]
if country_id:
domain += [('country_id', '=', country_id)]
# group by country, based on customers found with the search(domain)
countries = partner_obj.read_group(
cr, openerp.SUPERUSER_ID, domain, ["id", "country_id"],
@ -48,6 +45,9 @@ class WebsiteCustomer(http.Controller):
'country_id': (0, _("All Countries"))
})
if country_id:
domain += [('country_id', '=', country_id)]
# search customers to display
partner_ids = partner_obj.search(cr, openerp.SUPERUSER_ID, domain, context=request.context)
google_map_partner_ids = ",".join([str(p) for p in partner_ids])

View File

@ -81,7 +81,7 @@
<t t-foreach="countries" t-as="country_dict">
<t t-if="country_dict['country_id']">
<li t-att-class="country_dict['country_id'][0] == current_country_id and 'active' or ''">
<a t-attf-href="/customers/#{ country_dict['country_id'][0] and 'country/%s/' % slug(country_dict['country_id']) or '' }">
<a t-attf-href="/customers/#{ country_dict['country_id'][0] and 'country/%s/' % slug(country_dict['country_id']) or '' }#{ search_path }">
<span class="badge pull-right" t-esc="country_dict['country_id_count'] or ''"/>
<t t-esc="country_dict['country_id'][1]"/>
</a>