[IMP] Customer Reference Page, better layout

bzr revid: fp@tinyerp.com-20131113183825-zslkr1uru109tj3k
This commit is contained in:
Fabien Pinckaers 2013-11-13 19:38:25 +01:00
parent 7598bcdb98
commit 18d8f69689
5 changed files with 245 additions and 115 deletions

View File

@ -33,6 +33,9 @@ OpenERP Customer References
'website_partner',
'website_google_map'
],
'demo': [
'website_customer_demo.xml',
],
'data': [
'views/website_customer.xml',
],

View File

@ -20,7 +20,7 @@ class WebsiteCustomer(http.Controller):
partner_obj = request.registry['res.partner']
partner_name = post.get('search', '')
base_domain = [('customer', '=', True), ('is_company', '=', True)]
base_domain = [('website_published','=',True)]
domain = list(base_domain)
if partner_name:
domain += [
@ -61,7 +61,7 @@ class WebsiteCustomer(http.Controller):
values = {
'countries': countries,
'current_country_id': country_id,
'current_country_id': country_id or 0,
'partner_ids': partners,
'google_map_partner_ids': google_map_partner_ids,
'pager': pager,
@ -70,29 +70,10 @@ class WebsiteCustomer(http.Controller):
}
return request.website.render("website_customer.index", values)
@website.route(['/customers/<int:partner_id>/'], type='http', auth="public", multilang=True)
@website.route(['/customers/<model("res.partner"):partner_id>/'], type='http', auth="public", multilang=True)
def customer(self, partner_id=None, **post):
""" Route for displaying a single partner / customer.
:param integer partner_id: partner to display. If not set or not valid
call basic references method.
"""
partner_obj = request.registry['res.partner']
if request.context['is_public_user']:
partner_ids = partner_obj.search(
request.cr, openerp.SUPERUSER_ID, [
('website_published', '=', True),
('id', '=', partner_id)
], context=request.context)
partner_id = partner_ids and partner_ids[0] or None
if not partner_id:
return self.references(post=post)
""" Route for displaying a single partner / customer. """
values = {
'partner_id': partner_obj.browse(
request.cr, openerp.SUPERUSER_ID, partner_id,
dict(request.context, show_address=True)),
'partner_id': partner_id
}
return request.website.render("website_customer.details", values)

View File

@ -5,19 +5,67 @@
<!-- Layout add nav and footer -->
<template id="footer_custom" inherit_id="website.layout" name="Footer Customer References Link">
<xpath expr="//footer//div[@name='info']/ul" position="inside">
<li><a href="/customers/">Customer References</a></li>
<li><a href="/customers/">Our References</a></li>
</xpath>
</template>
<!-- Page -->
<template id="layout" name="Customer References Layout">
<template id="index" name="Our References">
<t t-call="website.layout">
<t t-set="additional_title">Customer References</t>
<div id="wrap">
<div class="oe_structure"/>
<div class="oe_structure">
<section data-snippet-id="title">
<h1 class="text-center">
Our References
</h1><h2 class="text-center text-muted">
Trusted by millions worldwide
</h2>
</section>
</div>
<div class="container">
<div class="row">
<t t-raw="ref_content"/>
<div class="col-md-4" id="ref_left_column">
<ul class="nav nav-pills nav-stacked mt16 mb32">
<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="/customers/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>
</t>
</ul>
</div>
<div class="col-md-8" id="ref_content">
<div class='navbar mb0'>
<t t-call="website.pager">
<t t-set="classname" t-value="'pull-left'"/>
</t>
<form action="/customers/" method="get" class="navbar-search pull-right pagination form-inline">
<div class="form-group">
<input type="text" name="search" class="search-query form-control"
placeholder="Search" t-att-value="post.get('search', '')"/>
</div>
</form>
</div>
<div class="row">
<t t-foreach="partner_ids" t-as="partner" class="media">
<div class="col-md-2">
<a t-href="/customers/#{ partner.id }/">
<img class="img img-thumbnail" t-att-src="partner.img('image_medium')"/>
</a>
</div><div class="col-md-10">
<h4>
<a t-href="/customers/#{ partner.id }/" t-field="partner.name"/>
</h4>
<div t-field="partner.website_short_description"/>
</div>
<div class="clearfix mb8"/>
</t>
</div>
</div>
</div>
</div>
<div class="oe_structure"/>
@ -25,99 +73,74 @@
</t>
</template>
<template id="index" name="Customer References">
<t t-call="website_customer.layout">
<t t-set="ref_content">
<h1 class="col-md-12 text-center">
Customer References<br/>
<small>Trusted by millions worldwide</small>
</h1>
<div class="col-md-4" id="ref_left_column">
<h3>Search 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="/customers/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>
</t>
</ul>
</div>
<div class="col-md-8" id="ref_content">
<div class='navbar'>
<div>
<t t-call="website.pager">
<t t-set="classname" t-value="'pull-left'"/>
</t>
<form action="/customers/" method="get" class="navbar-search pull-right pagination form-inline">
<div class="form-group">
<input type="text" name="search" class="search-query form-control"
placeholder="Search" t-att-value="post.get('search', '')"/>
</div>
</form>
</div>
</div>
<div>
<div t-foreach="partner_ids" t-as="partner" class="media thumbnail" data-publish="">
<t t-call="website.publish_management"><t t-set="object" t-value="partner"/></t>
<a class="pull-left" t-href="/customers/#{ partner.id }/">
<img class="media-object" t-att-src="partner.img('image_small')"/>
</a>
<div class="media-body" style="min-height: 64px;">
<a class="media-heading" t-href="/customers/#{ partner.id }/"><span t-field="partner.parent_id"/> <span t-field="partner.name"/></a>
<div t-field="partner.website_short_description"/>
</div>
</div>
</div>
</div>
</t>
</t>
</template>
<!-- Option: left column: World Map -->
<template id="opt_country" inherit_id="website_customer.index" inherit_option_id="website_customer.index" name="Left World Map">
<template id="opt_country" inherit_id="website_customer.index" inherit_option_id="website_customer.index" name="Show Map">
<xpath expr="//div[@id='ref_left_column']//ul[last()]" position="after">
<h3>World Map</h3>
<iframe t-attf-src="/google_map/?width=320&amp;height=240&amp;partner_ids=#{ google_map_partner_ids }&amp;partner_url=/customers/"
style="width:320px; height:260px; border:0; padding:0; margin:0;"></iframe>
<iframe t-attf-src="/google_map/?partner_ids=#{ google_map_partner_ids }&amp;partner_url=/customers/&amp;output=embed"
style="width:100%; border:0; padding:0; margin:0;"></iframe>
</xpath>
</template>
<template id="details" name="Customer Detail">
<t t-call="website_customer.layout">
<t t-set="ref_content">
<t t-call="website.publish_management"><t t-set="object" t-value="partner_id"/></t>
<h1 class="col-md-12 text-center" t-field="partner_id.name"/>
<div class="col-md-4">
<div class="text-center">
<img t-att-src="partner_id.img('image_medium')"/>
<t t-call="website.layout">
<t t-set="additional_title">Customer Reference: <t t-esc="partner_id.name"/></t>
<div id="wrap">
<div class="container mt16">
<div class="row">
<div class="col-md-5">
<ol class="breadcrumb">
<li><a href="/customers">Our References</a></li>
<li class="active" t-field="partner_id.name"/>
</ol>
</div>
<address>
<table style="margin: auto;" class="well">
<colgroup>
<col width="100"/>
<col/>
</colgroup>
<tbody>
<t t-set="address" t-value="'&lt;br/&gt;'.join(partner_id.name_get()[0][1].split('\n')[1:])"/>
<tr t-if="address or editable"><th>Address</th><td class="span2" t-raw="address"/></tr>
<tr t-if="partner_id.website or editable"><th>Website</th><td class="span2"><span t-field="partner_id.website"/></td></tr>
<tr t-if="partner_id.phone or editable"><th>Tel</th><td class="span2"><span t-field="partner_id.phone"/></td></tr>
<tr t-if="partner_id.mobile or editable"><th>Tel</th><td class="span2"><span t-field="partner_id.mobile"/></td></tr>
<tr t-if="partner_id.fax or editable"><th>Fax</th><td class="span2"><span t-field="partner_id.fax"/></td></tr>
<tr t-if="partner_id.email or editable"><th>Email</th><td class="span2"><span t-field="partner_id.email"/></td></tr>
</tbody>
</table>
<div class="col-md-7">
<t t-call="website.publish_management"><t t-set="object" t-value="partner_id"/></t>
</div>
</div>
<div class="oe_structure"/>
<div class="row">
<div class="col-md-12">
<h1 class="text-center" t-field="partner_id.name"/>
</div>
<div class="col-md-9">
<div t-field="partner_id.website_description"/>
</div>
<div class="col-md-3" id="ref_right_column">
</div>
</div>
</div>
<div class="oe_structure"/>
</div>
</t>
</template>
<template id="customer_contact" inherit_id="website_customer.details" inherit_option_id="website_customer.details" name="Customer Reference">
<xpath expr="//div[@id='ref_right_column']" position="inside">
<div class="panel panel-default">
<div class="panel-heading">
<h4>Customer Reference</h4>
</div>
<div class="panel-body">
<div class="text-center">
<img t-att-src="partner_id.img('image')" class="img img-shadow"/>
</div>
<address class="mt16 mb8">
<strong t-field="partner_id.name"/>
<p t-field="partner_id.commercial_partner_id"/>
<div t-if="partner_id.phone">
<span class="icon-phone"/> <span t-field="partner_id.phone"/>
</div>
<div t-if="partner_id.email">
<span class="icon-envelope"/>
<a t-att-href="'mailto:'+partner_id.email">
<span t-field="partner_id.email"/>
</a>
</div>
</address>
</div>
<div class="col-md-8 mt32">
<div t-field="partner_id.website_description"/>
</div>
</t>
</t>
</div>
</xpath>
</template>
</data>

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="base.res_partner_2" model="res.partner">
<field name="website_published" eval="True"/>
<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>
Agrolait designs, develops, integrates and supports HR and Supply
Chain processes in order to make our customers more productive,
responsive and profitable.
</p><p>
Our experts invent, imagine and develop solutions which meet
your business requirements. They build a new technical
environment for your company, but they always take the already
installed IT software into account. That is why Idealis
Consulting delivers excellence in HR and SC Management.
</p><p>
Agrolait integrates ERP for Global Companies and supports PME
with Open Sources software to manage their businesses. Our
consultants are experts in the following areas:
</p>
<ul>
<li>Sales and Distribution</li>
<li>Materials Management</li>
<li>Inventory and Warehouse management</li>
<li>Customer Relationship Management</li>
<li>Personnel Administration</li>
<li>Talent Management</li>
<li>Reporting</li>
</ul>
</field>
</record>
<record id="base.res_partner_3" model="res.partner">
<field name="website_published" eval="True"/>
<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>
A non-profit international educational and scientific
organisation, hosting three departments (aeronautics and
aerospace, environmental and applied fluid dynamics, and
turbomachinery and propulsion).
</p><p>
It provides post-graduate education in fluid dynamics
(research master in fluid dynamics, former "Diploma
Course", doctoral program, stagiaire program and lecture
series) and encourages "training in research through
research".
</p><p>
It undertakes and promotes research in the field of fluid
dynamics. It possesses about fifty different wind tunnels,
turbomachinery and other specialized test facilities, some
of which are unique or the largest in the world. Extensive
research on experimental, computational and theoretical
aspects of gas and liquid flows is carried out under the
direction of the faculty and research engineers, sponsored
mainly by governmental and international agencies as well
as industries.
</p>
</field>
</record>
<record id="base.res_partner_4" model="res.partner">
<field name="website_published" eval="True"/>
<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>
Agrolait designs, develops, integrates and supports HR and Supply
Chain processes in order to make our customers more productive,
responsive and profitable.
</p><p>
Our experts invent, imagine and develop solutions which meet
your business requirements. They build a new technical
environment for your company, but they always take the already
installed IT software into account. That is why Idealis
Consulting delivers excellence in HR and SC Management.
</p><p>
Agrolait integrates ERP for Global Companies and supports PME
with Open Sources software to manage their businesses. Our
consultants are experts in the following areas:
</p>
<ul>
<li>Sales and Distribution</li>
<li>Materials Management</li>
<li>Inventory and Warehouse management</li>
<li>Customer Relationship Management</li>
<li>Personnel Administration</li>
<li>Talent Management</li>
<li>Reporting</li>
</ul>
</field>
</record>
<record id="base.res_partner_5" model="res.partner">
<field name="website_published" eval="True"/>
<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>
A non-profit international educational and scientific
organisation, hosting three departments (aeronautics and
aerospace, environmental and applied fluid dynamics, and
turbomachinery and propulsion).
</p><p>
It provides post-graduate education in fluid dynamics
(research master in fluid dynamics, former "Diploma
Course", doctoral program, stagiaire program and lecture
series) and encourages "training in research through
research".
</p><p>
It undertakes and promotes research in the field of fluid
dynamics. It possesses about fifty different wind tunnels,
turbomachinery and other specialized test facilities, some
of which are unique or the largest in the world. Extensive
research on experimental, computational and theoretical
aspects of gas and liquid flows is carried out under the
direction of the faculty and research engineers, sponsored
mainly by governmental and international agencies as well
as industries.
</p>
</field>
</record>
</data>
</openerp>

View File

@ -9,7 +9,7 @@ OpenERP Website Google Map
""",
'author': 'OpenERP SA',
'depends': ['base_geolocalize', 'website_partner'],
'depends': ['base_geolocalize', 'website_partner', 'crm_partner_assign'],
'data': [
'views/google_map.xml',
],