22# Part of Odoo. See Odoo LICENSE file for full copyright and licensing details.
33# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44
5- import werkzeug
5+ from werkzeug . urls import url_encode
66
77from odoo import http
88from odoo .http import request
99from odoo .tools .translate import _
1010
11- from odoo .addons .http_routing .models .ir_http import slug , unslug
12-
1311
1412class WebsiteIntegrator (http .Controller ):
1513 _references_per_page = 40
@@ -75,7 +73,7 @@ def integrators(self, country=None, page=0, **post):
7573
7674 if country :
7775 base_integrator_domain += [("country_id" , "=" , country .id )]
78- url = "/integrators/country/" + slug (country )
76+ url = "/integrators/country/" + request . env [ "ir.http" ]. _slug (country )
7977 else :
8078 url = "/integrators"
8179
@@ -98,9 +96,9 @@ def integrators(self, country=None, page=0, **post):
9896 # search integrators matching current search parameters
9997 integrator_ids = partner_obj .sudo ().search (
10098 base_integrator_domain ,
101- order = "grade_id ASC, implemented_count DESC,"
99+ order = "grade_id ASC, implemented_partner_count DESC,"
102100 "contributor_count DESC, member_count DESC,"
103- "display_name ASC" ,
101+ "name ASC" ,
104102 offset = pager ["offset" ],
105103 limit = self ._references_per_page ,
106104 )
@@ -118,7 +116,7 @@ def integrators(self, country=None, page=0, **post):
118116 "google_map_integrator_ids" : google_map_integrator_ids ,
119117 "pager" : pager ,
120118 "searches" : post ,
121- "search_path" : "%s" % werkzeug . url_encode (post ),
119+ "search_path" : "? %s" % url_encode (post ),
122120 "google_maps_api_key" : google_maps_api_key ,
123121 }
124122
@@ -181,7 +179,7 @@ def integrators_detail(self, integrator_id, **post):
181179 """
182180 Display integrator's detail.
183181 """
184- _ , integrator_id = unslug (integrator_id )
182+ _ , integrator_id = request . env [ "ir.http" ]. _unslug (integrator_id )
185183 current_country = None
186184 country_id = post .get ("country_id" )
187185
@@ -192,7 +190,7 @@ def integrators_detail(self, integrator_id, **post):
192190 if integrator_id :
193191 integrator = request .env ["res.partner" ].sudo ().browse (integrator_id )
194192
195- is_website_publisher = request .env [ "res.users" ] .has_group (
193+ is_website_publisher = request .env . user .has_group (
196194 "website.group_website_publisher"
197195 )
198196
@@ -243,7 +241,7 @@ def integrator_contributors(
243241 self , integrator_id = None , country_name = None , country_id = 0 , page = 1 , ** post
244242 ):
245243 integrator = integrator_id
246- integrator_name , integrator_id = unslug (integrator_id )
244+ integrator_name , integrator_id = request . env [ "ir.http" ]. _unslug (integrator_id )
247245 country = request .env ["res.country" ]
248246 partner = request .env ["res.partner" ]
249247
@@ -318,7 +316,7 @@ def integrator_contributors(
318316
319317 contributors = partner .sudo ().search (
320318 country_domain ,
321- order = "display_name ASC" ,
319+ order = "name ASC" ,
322320 offset = pager ["offset" ],
323321 limit = self ._references_per_page ,
324322 )
@@ -333,7 +331,7 @@ def integrator_contributors(
333331 "current_country_id" : current_country and current_country ["id" ] or 0 ,
334332 "pager" : pager ,
335333 "post" : post ,
336- "search" : "?%s" % werkzeug . url_encode (post ),
334+ "search" : "?%s" % url_encode (post ),
337335 }
338336
339337 return request .render ("website_oca_integrator.contributor_index" , values )
0 commit comments