summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Martinelli <nim@odoo.com>2020-06-26 10:47:29 +0000
committerNicolas Martinelli <nim@odoo.com>2020-06-26 16:01:59 +0000
commit8f2d79a1172a2a740487cf6b6aa35ddaecd036ca (patch)
treea2e2f32774d15acfd5e29aa4f1b9fb7bfd39c97c
parent6c6c3d70906922d1b6e3abbf7745b5691110fcbb (diff)
[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>
-rw-r--r--addons/website_crm_partner_assign/controllers/main.py1
-rw-r--r--addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml3
2 files changed, 3 insertions, 1 deletions
diff --git a/addons/website_crm_partner_assign/controllers/main.py b/addons/website_crm_partner_assign/controllers/main.py
index fe3107f2bd0..7f560b4f394 100644
--- a/addons/website_crm_partner_assign/controllers/main.py
+++ b/addons/website_crm_partner_assign/controllers/main.py
@@ -301,6 +301,7 @@ class WebsiteCrmPartnerAssign(WebsitePartnerPage):
values = {
'countries': countries,
+ 'country_all': country_all,
'current_country': country,
'grades': grades,
'current_grade': grade,
diff --git a/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml b/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml
index 835ce5ecf7a..13ad7f7267a 100644
--- a/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml
+++ b/addons/website_crm_partner_assign/views/website_crm_partner_assign_templates.xml
@@ -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 '') + '&amp;' + 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>