[IMP] website_contract: add location after worldmap
bzr revid: chm@openerp.com-20130829111058-6z8tqf70xyl3zmyy
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
import openerp
|
||||
from openerp.addons.web import http
|
||||
from openerp.tools.translate import _
|
||||
from openerp.addons.web.http import request
|
||||
import urllib
|
||||
|
||||
class website_contract(http.Controller):
|
||||
|
||||
@@ -30,16 +32,27 @@ class website_contract(http.Controller):
|
||||
partner_ids += partner_obj.search(request.cr, request.uid, domain + ['|', ('id', "in", contract_project_ids), ('id', "child_of", contract_project_ids)])
|
||||
partner_ids = list(set(partner_ids))
|
||||
|
||||
# group by country
|
||||
countries = partner_obj.read_group(request.cr, request.uid, domain, ["id", "country_id"], groupby="country_id", orderby="country_id")
|
||||
countries.insert(0, {'country_id_count': partner_obj.search(request.cr, request.uid, domain, count=True), 'country_id': ("all", _("All Countries"))})
|
||||
|
||||
|
||||
if post.get("country", "all") != 'all':
|
||||
partner_ids = partner_obj.search(request.cr, request.uid, [('id', 'in', partner_ids), ('country_id', '=', int(post.get('country')))])
|
||||
|
||||
|
||||
step = 20
|
||||
pager = website.pager(url="/references/", total=len(partner_ids), page=page, step=step, scope=7, url_args=post)
|
||||
partner_ids = partner_obj.search(request.cr, openerp.SUPERUSER_ID, [('id', 'in', partner_ids)], limit=step, offset=pager['offset'])
|
||||
|
||||
|
||||
values = website.get_rendering_context({
|
||||
'countries': countries,
|
||||
'partner_ids': partner_obj.browse(request.cr, openerp.SUPERUSER_ID, partner_ids),
|
||||
'worldmap_partner_ids': worldmap_partner_ids,
|
||||
'pager': pager,
|
||||
'search': post.get("search"),
|
||||
'searches': post,
|
||||
'search_path': "?%s" % urllib.urlencode(post),
|
||||
})
|
||||
return website.render("website_contract.index", values)
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<t t-set="classname">pull-left</t>
|
||||
</t>
|
||||
<form action="/references/" method="get" class="navbar-search pull-right pagination">
|
||||
<input type="text" name="search" class="search-query span2" placeholder="Search" t-att-value="search or '' or ''"/>
|
||||
<input type="text" name="search" class="search-query span2" placeholder="Search" t-att-value="searches.get('search') or '' or ''"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -61,14 +61,15 @@
|
||||
<xpath expr="//div[@id='ref_content']" position="before">
|
||||
<div class="span4">
|
||||
<ul class="nav nav-list">
|
||||
<li class="nav-header">Location</li>
|
||||
<!--t t-foreach="countries">
|
||||
<li t-if="country_id" t-att-class="searches.get('country') == str(country_id and country_id[0]) and 'active' or ''">
|
||||
<a t-attf-href="/event/#{ search_path }&country=#{ country_id[0] }"><t t-esc="country_id[1]"/><small>(<t t-esc="country_id_count"/>)</small></a>
|
||||
</li>
|
||||
</t-->
|
||||
<li class="nav-header">World Map</li>
|
||||
<iframe t-attf-src="/worldmap/?width=320&height=240&partner_ids=#{ worldmap_partner_ids }&partner_url=/references/"
|
||||
style="width:320px; height:260px; border:0; padding:0; margin:0;"></iframe>
|
||||
<li class="nav-header">Location</li>
|
||||
<t t-foreach="countries">
|
||||
<li t-if="country_id" t-att-class="searches.get('country') == str(country_id and country_id[0]) and 'active' or ''">
|
||||
<a t-attf-href="/references/#{ search_path }&country=#{ country_id[0] }"><t t-esc="country_id[1]"/><small>(<t t-esc="country_id_count"/>)</small></a>
|
||||
</li>
|
||||
</t>
|
||||
</ul>
|
||||
</div>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user