[FIX] website_membership: free state and not free member
A member can be a free member, but still have paid membership. So we only should display member in a free membership_state and should not get dupes. closes #6805 opw-640440
This commit is contained in:
parent
bf8877e485
commit
1bd50551c5
|
@ -51,12 +51,15 @@ class WebsiteMembership(http.Controller):
|
||||||
# group by country, based on all customers (base domain)
|
# group by country, based on all customers (base domain)
|
||||||
if membership_id != 'free':
|
if membership_id != 'free':
|
||||||
membership_line_ids = membership_line_obj.search(cr, SUPERUSER_ID, base_line_domain, context=context)
|
membership_line_ids = membership_line_obj.search(cr, SUPERUSER_ID, base_line_domain, context=context)
|
||||||
country_domain = ('member_lines', 'in', membership_line_ids)
|
country_domain = [('member_lines', 'in', membership_line_ids)]
|
||||||
else:
|
else:
|
||||||
membership_line_ids = []
|
membership_line_ids = []
|
||||||
country_domain = ('free_member', '=', True)
|
country_domain = [('membership_state', '=', 'free')]
|
||||||
|
if post_name:
|
||||||
|
country_domain += ['|', ('name', 'ilike', post_name),
|
||||||
|
('website_description', 'ilike', post_name)]
|
||||||
countries = partner_obj.read_group(
|
countries = partner_obj.read_group(
|
||||||
cr, SUPERUSER_ID, [country_domain, ("website_published", "=", True)], ["id", "country_id"],
|
cr, SUPERUSER_ID, country_domain + [("website_published", "=", True)], ["id", "country_id"],
|
||||||
groupby="country_id", orderby="country_id", context=request.context)
|
groupby="country_id", orderby="country_id", context=request.context)
|
||||||
countries_total = sum(country_dict['country_id_count'] for country_dict in countries)
|
countries_total = sum(country_dict['country_id_count'] for country_dict in countries)
|
||||||
|
|
||||||
|
@ -103,7 +106,7 @@ class WebsiteMembership(http.Controller):
|
||||||
membership_lines_ids = membership_line_obj.search(cr, uid, line_domain, context=context)
|
membership_lines_ids = membership_line_obj.search(cr, uid, line_domain, context=context)
|
||||||
google_map_partner_ids = membership_line_obj.get_published_companies(cr, uid, membership_line_ids, limit=2000, context=context)
|
google_map_partner_ids = membership_line_obj.get_published_companies(cr, uid, membership_line_ids, limit=2000, context=context)
|
||||||
|
|
||||||
search_domain = [('free_member', '=', True), ('website_published', '=', True)]
|
search_domain = [('membership_state', '=', 'free'), ('website_published', '=', True)]
|
||||||
if post_name:
|
if post_name:
|
||||||
search_domain += ['|', ('name', 'ilike', post_name), ('website_description', 'ilike', post_name)]
|
search_domain += ['|', ('name', 'ilike', post_name), ('website_description', 'ilike', post_name)]
|
||||||
if country_id:
|
if country_id:
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
<li class="nav-header"><h3>Location</h3></li>
|
<li class="nav-header"><h3>Location</h3></li>
|
||||||
<t t-foreach="countries" t-as="country">
|
<t t-foreach="countries" t-as="country">
|
||||||
<li t-if="country['country_id']" t-att-class="country['country_id'] and country['country_id'][0] == current_country_id and 'active' or ''">
|
<li t-if="country['country_id']" t-att-class="country['country_id'] and country['country_id'][0] == current_country_id and 'active' or ''">
|
||||||
<a t-attf-href="/members#{ membership and '/association/%s' % membership.id or '' }#{ country['country_id'][0] and '/country/%s' % slug(country['country_id']) or '' }#{ search }"><t t-esc="country['country_id'][1]"/>
|
<a t-attf-href="/members#{ membership_id and '/association/%s' % membership_id or '' }#{ country['country_id'][0] and '/country/%s' % slug(country['country_id']) or '' }#{ search }"><t t-esc="country['country_id'][1]"/>
|
||||||
<span class="badge pull-right"><t t-esc="country['country_id_count'] or '0'"/></span>
|
<span class="badge pull-right"><t t-esc="country['country_id_count'] or '0'"/></span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
Loading…
Reference in New Issue