Skip to content

Commit ece9877

Browse files
committed
[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#53729 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
1 parent 199a5f6 commit ece9877

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

addons/website_crm_partner_assign/controllers/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ def partners(self, country=None, grade=None, page=0, **post):
301301

302302
values = {
303303
'countries': countries,
304+
'country_all': country_all,
304305
'current_country': country,
305306
'grades': grades,
306307
'current_grade': grade,

addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<li class="nav-header nav-item"><h3>Filter by Level</h3></li>
3535
<t t-foreach="grades" t-as="grade">
3636
<li class="nav-item">
37-
<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 '') }"
37+
<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 '') + '&amp;' + keep_query('country_all') }"
3838
t-attf-class="nav-link#{grade['active'] and ' active' or ''}">
3939
<span class="badge badge-pill float-right" t-esc="grade['grade_id_count'] or ''"/>
4040
<t t-esc="grade['grade_id'][1]"/>
@@ -63,6 +63,7 @@
6363
<t t-call="website.pager"/>
6464
<form action="" method="get" class="form-inline ml-auto">
6565
<div class="form-group">
66+
<input t-if="country_all" type="hidden" name="country_all" value="True" />
6667
<input type="text" name="search" class="search-query form-control" placeholder="Search" t-att-value="searches.get('search', '')"/>
6768
</div>
6869
</form>

0 commit comments

Comments
 (0)