[FIX] [IMP] website_crm_partner_assign: fixed countries / grade management in controller + improved search by country in view + headers
bzr revid: tde@openerp.com-20131008154221-82dwudfxn3xnv7bb
This commit is contained in:
parent
e968a8b18c
commit
b7f6431a5d
|
@ -16,11 +16,11 @@ class WebsiteCrmPartnerAssign(http.Controller):
|
|||
'/partners/', '/partners/page/<int:page>/',
|
||||
'/partners/country/<int:country_id>', '/partners/country/page/<int:country_id>/',
|
||||
], type='http', auth="public", multilang=True)
|
||||
def partners(self, country_id=None, page=0, **post):
|
||||
def partners(self, country_id=0, page=0, **post):
|
||||
country_obj = request.registry['res.country']
|
||||
partner_obj = request.registry['res.partner']
|
||||
post_name = post.get('search', '')
|
||||
grade_id = post.get('grade_id', '')
|
||||
grade_id = post.get('grade', '')
|
||||
country = None
|
||||
|
||||
# format displayed membership lines domain
|
||||
|
@ -29,7 +29,7 @@ class WebsiteCrmPartnerAssign(http.Controller):
|
|||
base_partner_domain += [('website_published', '=', True)]
|
||||
partner_domain = list(base_partner_domain)
|
||||
if grade_id:
|
||||
partner_domain += [('grade_id', '=', grade_id)] # try/catch int
|
||||
partner_domain += [('grade_id', '=', int(grade_id))] # try/catch int
|
||||
if country_id:
|
||||
country = country_obj.browse(request.cr, request.uid, country_id, request.context)
|
||||
partner_domain += [('country_id', '=', country_id)]
|
||||
|
@ -61,7 +61,7 @@ class WebsiteCrmPartnerAssign(http.Controller):
|
|||
context=request.context, count=True)
|
||||
countries.insert(0, {
|
||||
'country_id_count': countries_partners,
|
||||
'country_id': ('0', _("All Countries"))
|
||||
'country_id': (0, _("All Countries"))
|
||||
})
|
||||
|
||||
# group by grade
|
||||
|
@ -78,7 +78,8 @@ class WebsiteCrmPartnerAssign(http.Controller):
|
|||
|
||||
values = {
|
||||
'countries': countries,
|
||||
'country': country,
|
||||
'current_country_id': country_id,
|
||||
'current_country': country,
|
||||
'grades': grades,
|
||||
'grade_id': grade_id,
|
||||
'partners': partners,
|
||||
|
|
|
@ -33,13 +33,13 @@
|
|||
<small>Contact a local partner</small>
|
||||
</h1>
|
||||
<div class="col-md-4" id="partner_left">
|
||||
<h2>Partners by Country</h2>
|
||||
<ul class="nav">
|
||||
<t t-foreach="countries" t-as="country">
|
||||
<t t-if="country['country_id']">
|
||||
<li>
|
||||
<a t-href="/partners/country/#{ country['country_id'][0] }">
|
||||
<t t-esc="country['country_id'][1]"/> <small>(<t t-esc="country['country_id_count']"/>)</small>
|
||||
<h3>Partners by Country</h3>
|
||||
<ul class="nav nav-pills nav-stacked mt16">
|
||||
<t t-foreach="countries" t-as="country_dict">
|
||||
<t t-if="country_dict['country_id']">
|
||||
<li t-att-class="country_dict['country_id'][0] == current_country_id and 'active' or ''">
|
||||
<a t-href="/partners/country/#{ country_dict['country_id'][0] }">
|
||||
<t t-esc="country_dict['country_id'][1]"/> <small>(<t t-esc="country_dict['country_id_count']"/>)</small>
|
||||
</a>
|
||||
</li>
|
||||
</t>
|
||||
|
@ -60,9 +60,9 @@
|
|||
<select class="search-query col-md-2 mt4 form-control" name="grade" t-if="len(grades) > 1" onchange="submit()">
|
||||
<t t-foreach="grades">
|
||||
<t t-if="grade_id">
|
||||
<option t-att-selected="searches.get('grade') == str(grade_id and grade_id[0]) and 'selected'" t-att-value="grade_id[0]">
|
||||
<t t-esc="grade_id[1]"/> (<t t-esc="grade_id_count"/>)
|
||||
</option>
|
||||
<option t-att-selected="searches.get('grade') == str(grade_id and grade_id[0]) and 'selected'" t-att-value="grade_id[0]">
|
||||
<t t-esc="grade_id[1]"/> (<t t-esc="grade_id_count"/>)
|
||||
</option>
|
||||
</t>
|
||||
</t>
|
||||
</select>
|
||||
|
@ -76,7 +76,7 @@
|
|||
<t t-set="internal_gid" t-value="partner_id.grade_id.id"/>
|
||||
<h3 class="text-center">
|
||||
<span t-field="partner_id.grade_id"/> Partners
|
||||
<t t-if="country"> in <t t-esc="country.name"/></t>
|
||||
<t t-if="current_country"> in <t t-esc="current_country.name"/></t>
|
||||
</h3>
|
||||
</t>
|
||||
<div class="media thumbnail" data-publish="">
|
||||
|
@ -97,8 +97,8 @@
|
|||
</template>
|
||||
|
||||
<template id="ref_country" inherit_id="website_crm_partner_assign.index" inherit_option_id="website_crm_partner_assign.index" name="Left World Map">
|
||||
<xpath expr="//div[@id='partner_left']//h2" position="before">
|
||||
<h2>World Map</h2>
|
||||
<xpath expr="//div[@id='partner_left']//ul" position="after">
|
||||
<h3>World Map</h3>
|
||||
<ul class="nav">
|
||||
<iframe t-attf-src="/google_map/?width=320&height=240&partner_ids=#{ google_map_partner_ids }&partner_url=/partners/"
|
||||
style="width:320px; height:260px; border:0; padding:0; margin:0;"></iframe>
|
||||
|
|
Loading…
Reference in New Issue