[FIX] website_crm_partner_assign: filtering if no country
1. Install the demo data 2. Activate GeoIP and set your IP in Belgium [1] 3. As a non-connected user, go to '/partners' => No result found: expected since we want to filter the partners available in the user's country 4. Click on 'All Countries' => All partners are displayed 5. Click on 'Platinum' or search for 'azure' => No result found The last step is not expected, it should filter partners from the 'All Countries' list. It occurs because the 'All Countries' filter is not kept when chosing a Level or searching. We use `keep_query` for the level filtering and set the `country_all` `input` field for searching. [1] IP can be set manually in https://github.com/odoo/odoo/blob/bbb45e3412a5653d78aacc92903e95d1353ed60a/addons/http_routing/geoipresolver.py#L42 opw-2277343 closes odoo/odoo#53761 X-original-commit: ece98773a18cf0f83a3d2e44397e7e08a3a538a9 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -301,6 +301,7 @@ class WebsiteCrmPartnerAssign(WebsitePartnerPage):
|
||||
|
||||
values = {
|
||||
'countries': countries,
|
||||
'country_all': country_all,
|
||||
'current_country': country,
|
||||
'grades': grades,
|
||||
'current_grade': grade,
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<li class="nav-header nav-item"><h3>Filter by Level</h3></li>
|
||||
<t t-foreach="grades" t-as="grade">
|
||||
<li class="nav-item">
|
||||
<a t-attf-href="/partners#{ grade['grade_id'][0] and '/grade/%s' % grade['grade_id'][0] or '' }#{ current_country and '/country/%s' % slug(current_country) or '' }#{ '?' + (search_path or '') }"
|
||||
<a t-attf-href="/partners#{ grade['grade_id'][0] and '/grade/%s' % grade['grade_id'][0] or '' }#{ current_country and '/country/%s' % slug(current_country) or '' }#{ '?' + (search_path or '') + '&' + keep_query('country_all') }"
|
||||
t-attf-class="nav-link#{grade['active'] and ' active' or ''}">
|
||||
<span class="badge badge-pill float-right" t-esc="grade['grade_id_count'] or ''"/>
|
||||
<t t-esc="grade['grade_id'][1]"/>
|
||||
@@ -63,6 +63,7 @@
|
||||
<t t-call="website.pager"/>
|
||||
<form action="" method="get" class="form-inline ml-auto">
|
||||
<div class="form-group">
|
||||
<input t-if="country_all" type="hidden" name="country_all" value="True" />
|
||||
<input type="text" name="search" class="search-query form-control" placeholder="Search" t-att-value="searches.get('search', '')"/>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user