[IMP] "website_customer" compatible with Multi-Website
This commit is contained in:
parent
9206847d70
commit
277a2e8f96
@ -47,7 +47,7 @@ class WebsiteCustomer(http.Controller):
|
||||
Partner = request.env['res.partner']
|
||||
search_value = post.get('search')
|
||||
|
||||
domain = [('website_published', '=', True), ('assigned_partner_id', '!=', False)]
|
||||
domain = [('website_published', '=', True), ('website_ids', 'in', request.website.id), ('assigned_partner_id', '!=', False)]
|
||||
if search_value:
|
||||
domain += [
|
||||
'|', '|',
|
||||
@ -118,7 +118,7 @@ class WebsiteCustomer(http.Controller):
|
||||
google_map_partner_ids = ','.join(str(it) for it in partners.ids)
|
||||
google_maps_api_key = request.env['ir.config_parameter'].sudo().get_param('google_maps_api_key')
|
||||
|
||||
tags = Tag.search([('website_published', '=', True), ('partner_ids', 'in', partners.ids)], order='classname, name ASC')
|
||||
tags = Tag.search([('website_published', '=', True), ('website_ids', 'in', request.website.id), ('partner_ids', 'in', partners.ids)], order='classname, name ASC')
|
||||
tag = tag_id and Tag.browse(tag_id) or False
|
||||
|
||||
values = {
|
||||
@ -145,7 +145,7 @@ class WebsiteCustomer(http.Controller):
|
||||
_, partner_id = unslug(partner_id)
|
||||
if partner_id:
|
||||
partner = request.env['res.partner'].sudo().browse(partner_id)
|
||||
if partner.exists() and partner.website_published:
|
||||
if partner.exists() and partner.website_published and request.website in partner.website_ids:
|
||||
values = {}
|
||||
values['main_object'] = values['partner'] = partner
|
||||
return request.render("website_customer.details", values)
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
<record id="base.res_partner_2" model="res.partner">
|
||||
<field name="website_published" eval="True"/>
|
||||
<field name="website_ids" eval="[(4,ref('website.default_website'))]"/>
|
||||
<field name="website_short_description">Agrolait designs, develops, integrates and supports HR and Supply Chain processes in order to make our customers more productive, responsive and profitable.</field>
|
||||
<field name="website_description" type="xml">
|
||||
<p>
|
||||
@ -34,6 +35,7 @@
|
||||
</record>
|
||||
<record id="base.res_partner_3" model="res.partner">
|
||||
<field name="website_published" eval="True"/>
|
||||
<field name="website_ids" eval="[(4,ref('website.default_website'))]"/>
|
||||
<field name="website_short_description">A non-profit international educational and scientific organisation, hosting three departments (aeronautics and aerospace, environmental and applied fluid dynamics, and turbomachinery and propulsion).</field>
|
||||
<field name="website_description" type="xml">
|
||||
<p>
|
||||
@ -62,6 +64,7 @@
|
||||
</record>
|
||||
<record id="base.res_partner_4" model="res.partner">
|
||||
<field name="website_published" eval="True"/>
|
||||
<field name="website_ids" eval="[(4,ref('website.default_website'))]"/>
|
||||
<field name="website_short_description">Agrolait designs, develops, integrates and supports HR and Supply Chain processes in order to make our customers more productive, responsive and profitable.</field>
|
||||
<field name="website_description" type="xml">
|
||||
<p>
|
||||
@ -92,6 +95,7 @@
|
||||
</record>
|
||||
<record id="base.res_partner_3" model="res.partner">
|
||||
<field name="website_published" eval="True"/>
|
||||
<field name="website_ids" eval="[(4,ref('website.default_website'))]"/>
|
||||
<field name="website_short_description">A non-profit international educational and scientific organisation, hosting three departments (aeronautics and aerospace, environmental and applied fluid dynamics, and turbomachinery and propulsion).</field>
|
||||
<field name="website_description" type="xml">
|
||||
<p>
|
||||
|
@ -27,3 +27,8 @@ class Tags(models.Model):
|
||||
classname = fields.Selection(get_selection_class, 'Class', default='default', help="Bootstrap class to customize the color", required=True)
|
||||
active = fields.Boolean('Active', default=True)
|
||||
website_published = fields.Boolean(default=True)
|
||||
website_ids = fields.Many2many('website', 'website_partner_tag_pub_rel',
|
||||
'website_id', 'partner_tag_id',
|
||||
string='Websites', copy=False,
|
||||
help='List of websites in which '
|
||||
'Partner Tag is published.')
|
||||
|
@ -22,6 +22,7 @@
|
||||
<field name="name"/>
|
||||
<field name="classname"/>
|
||||
<field name="website_published"/>
|
||||
<field name="website_ids" widget="many2many_tags"/>
|
||||
<field name="active"/>
|
||||
</group>
|
||||
</form>
|
||||
@ -36,6 +37,7 @@
|
||||
<field name="name"/>
|
||||
<field name="classname"/>
|
||||
<field name="website_published"/>
|
||||
<field name="website_ids" widget="many2many_tags"/>
|
||||
<field name="active"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
@ -189,7 +189,7 @@
|
||||
</template>
|
||||
|
||||
<template id="implemented_by_block" name="Partner Implemented By Block">
|
||||
<t t-if="partner.assigned_partner_id and partner.assigned_partner_id.website_published">
|
||||
<t t-if="partner.assigned_partner_id and partner.assigned_partner_id.website_published and website in partner.assigned_partner_id.website_ids">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4>Implemented By</h4>
|
||||
@ -198,7 +198,7 @@
|
||||
<h4>
|
||||
<a t-attf-href="/partners/#{slug(partner.assigned_partner_id)}">
|
||||
<span t-field="partner.assigned_partner_id"/>
|
||||
<span class="small"> (<t t-esc="len([p for p in partner.assigned_partner_id.implemented_partner_ids if p.website_published])"/> reference(s))</span>
|
||||
<span class="small"> (<t t-esc="len([p for p in partner.assigned_partner_id.implemented_partner_ids if p.website_published and website in p.website_ids])"/> reference(s))</span>
|
||||
</a>
|
||||
</h4>
|
||||
<div><a t-attf-href="/partners/#{slug(partner.assigned_partner_id)}"
|
||||
@ -218,10 +218,10 @@
|
||||
</template>
|
||||
|
||||
<template id="references_block" name="Partner References Block">
|
||||
<t t-if="any([p.website_published for p in partner.implemented_partner_ids])">
|
||||
<t t-if="any([p.website_published and website in p.website_ids for p in partner.implemented_partner_ids])">
|
||||
<h3 id="references">References</h3>
|
||||
<div t-foreach="partner.implemented_partner_ids" t-as="reference" class="media">
|
||||
<t t-if="reference.website_published">
|
||||
<t t-if="reference.website_published and website in reference.website_ids">
|
||||
<a class="pull-left" t-attf-href="/customers/#{slug(reference)}">
|
||||
<span t-field="reference.image_small" t-options='{"widget": "image", "class": "center-block"}'/>
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user