[IMP] split depedencies between portal_crm and the new glue module portal_hr_employees

this new glue module depending on hr and portal_crm is now responsible for inserting the employees list in the portal_crm contact page

bzr revid: abo@openerp.com-20120704181917-1o1ofcm66cek1dm3
This commit is contained in:
Antonin Bourguignon 2012-07-04 20:19:17 +02:00
parent 9222ca3c79
commit c55858dd6b
15 changed files with 164 additions and 83 deletions

View File

@ -32,9 +32,9 @@ installed.
'author': 'OpenERP SA',
'depends': ['crm_claim','portal'],
'data': [
'security/portal_security.xml',
'portal_claim_view.xml',
"security/ir.model.access.csv",
'security/ir.model.access.csv',
'security/portal_security.xml',
],
'installable': True,
'auto_install':True,

View File

@ -20,4 +20,3 @@
##############################################################################
import wizard
import hr_employee

View File

@ -26,18 +26,16 @@
'category': 'Tools',
'complexity': "easy",
'description': """
This module adds crm menu and features (contact form) to your portal if crm and
portal are installed.
This module adds a contact page (with a contact form creating a lead when
submitted) to your portal if crm and portal are installed.
""",
'author': 'OpenERP SA',
'depends': ['crm','portal'],
'data': [
'hr_employee_view.xml',
'security/ir.model.access.csv',
'wizard/contact_view.xml',
],
'installable': True,
'auto_install':True,
'installable': True
, 'auto_install':True,
'category':'Hidden',
'css': [
'static/src/css/portal_crm.css',

View File

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- add visibility field in employee form -->
<record id="view_employee_form" model="ir.ui.view">
<field name="name">res.portal.employee.form</field>
<field name="model">hr.employee</field>
<field name="type">form</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='job_information']" position="after">
<group string="Employee's visibility">
<field name="visibility"/>
</group>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -1,7 +1,3 @@
/*
* General layout
*/
/* Root container */
.openerp .oe_portal_crm_contact {
width: 800px;
@ -44,15 +40,3 @@
.openerp .oe_portal_crm_contact .oe_portal_crm_office ul:last-child li:last-child {
margin-bottom: 0;
}
/* Employees list section */
.openerp .oe_portal_crm_contact .oe_portal_crm_team {
padding: 8px 0 0 0;
}
.openerp .oe_portal_crm_contact .oe_portal_crm_team .oe_employee_details {
width: 170px;
}
.openerp .oe_portal_crm_contact .oe_portal_crm_team .oe_employee_image {
width: 65px;
height: 65px;
}

View File

@ -7,20 +7,14 @@ class crm_contact_us(osv.TransientModel):
_inherit = 'crm.lead'
_columns = {
'company_ids' : fields.many2many('res.company', string='Companies', readonly=True),
'employee_ids' : fields.many2many('hr.employee', string='Employees', readonly=True),
}
def _get_employee(self, cr, uid, context=None):
""" Employees flagged as 'private' won't appear on the contact page """
r = self.pool.get('hr.employee').search(cr, uid, [('visibility', '!=', 'private')], context=context)
return r
""" Little trick to display companies in our wizard view """
def _get_companies(self, cr, uid, context=None):
r = self.pool.get('res.company').search(cr, uid, [], context=context)
return r
_defaults = {
'employee_ids' : _get_employee,
'company_ids' : _get_companies
}

View File

@ -54,9 +54,6 @@
<field name="email"/>
</a>
</li>
<li t-if="record.website">
<a t-att-href="record.website"><field name="website"/></a>
</li>
</ul>
</t>
</templates>
@ -68,30 +65,7 @@
<tr>
<td colspan="2">
<div class="oe_portal_crm_team">
<h1>Meet the team</h1>
<field name="employee_ids" widget="many2many_kanban">
<kanban>
<field name="last_login"/>
<templates>
<t t-name="kanban-box">
<div class="oe_employee_vignette">
<div class="oe_employee_image">
<a type="edit"><img t-att-src="kanban_image('hr.employee', 'photo', record.id.value)" class="oe_employee_picture"/></a>
</div>
<div class="oe_employee_details">
<h4><a type="edit"><field name="name"/> (<field name="login"/>)</a></h4>
<ul>
<li t-if="record.job_id.raw_value"><field name="job_id"/></li>
<li t-if="record.work_phone.raw_value">Tel: <field name="work_phone"/></li>
<li t-if="record.mobile_phone.raw_value">Mobile: <field name="mobile_phone"/></li>
<li t-if="record.work_email.raw_value"><a t-attf-href="mailto:#{record.work_email.value}"><field name="work_email"/></a></li>
</ul>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</div>
</td>
</tr>

View File

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import hr_employee

View File

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'Portal HR employees',
'version': '0.1',
'category': 'Tools',
'complexity': "easy",
'description': """
This module adds a list of employees to your portal's contact page if hr and
portal_crm (which creates the contact page) are installed.
""",
'author': 'OpenERP SA',
'depends': ['hr','portal_crm'],
'data': [
'hr_employee_view.xml',
'security/portal_crm_security.xml',
'security/ir.model.access.csv',
],
'installable': True,
'auto_install':True,
'category':'Hidden',
'css': [
'static/src/css/portal_hr_employees.css',
],
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -21,10 +21,26 @@
from osv import osv, fields
class crm_contact_us(osv.TransientModel):
""" Add employees list to the portal's contact page """
_description = 'Contact form for the portal'
_inherit = 'portal_crm.crm_contact_us'
_columns = {
'employee_ids' : fields.many2many('hr.employee', string='Employees', readonly=True),
}
""" Little trick to display employees in our wizard view """
def _get_employee(self, cr, uid, context=None):
""" Employees flagged as 'private' won't appear on the contact page """
r = self.pool.get('hr.employee').search(cr, uid, [('visibility', '!=', 'private')], context=context)
return r
_defaults = {
'employee_ids' : _get_employee,
}
class hr_employee(osv.osv):
_description = "Portal CRM Employee"
_description = "Portal CRM employee"
_inherit = 'hr.employee'
"""

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- add visibility field to the employee form view -->
<record id="view_employee_form" model="ir.ui.view">
<field name="name">portal_hr_employees.employee.form</field>
<field name="model">hr.employee</field>
<field name="type">form</field>
<field name="inherit_id" ref="hr.view_employee_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='job_information']" position="after">
<group string="Employee's visibility">
<field name="visibility"/>
</group>
</xpath>
</field>
</record>
<!-- a kanban view of the employees to the portal's contact page -->
<record id="wizard_contact_form_view_employees_list" model="ir.ui.view">
<field name="name">portal_hr_employees.employees_list</field>
<field name="model">portal_crm.crm_contact_us</field>
<field name="type">form</field>
<field name="inherit_id" ref="portal_crm.wizard_contact_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@class='oe_portal_crm_team']" position="inside">
<h1>Meet the team</h1>
<field name="employee_ids" widget="many2many_kanban">
<kanban>
<templates>
<t t-name="kanban-box">
<div class="oe_employee_vignette">
<div class="oe_employee_image">
<a type="edit"><img t-att-src="kanban_image('hr.employee', 'photo', record.id.value)" class="oe_employee_picture"/></a>
</div>
<div class="oe_employee_details">
<h4><a type="edit"><field name="name"/> (<field name="login"/>)</a></h4>
<ul>
<li t-if="record.job_id.raw_value"><field name="job_id"/></li>
<li t-if="record.work_phone.raw_value">Tel: <field name="work_phone"/></li>
<li t-if="record.mobile_phone.raw_value">Mobile: <field name="mobile_phone"/></li>
<li t-if="record.work_email.raw_value"><a t-attf-href="mailto:#{record.work_email.value}"><field name="work_email"/></a></li>
</ul>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</xpath>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,11 @@
/* Employees list section */
.openerp .oe_portal_crm_contact .oe_portal_crm_team {
padding: 8px 0 0 0;
}
.openerp .oe_portal_crm_contact .oe_portal_crm_team .oe_employee_details {
width: 170px;
}
.openerp .oe_portal_crm_contact .oe_portal_crm_team .oe_employee_image {
width: 65px;
height: 65px;
}

View File

@ -21,13 +21,12 @@
{
'name': 'Portal Jobs',
'name': 'Portal HR recruitment',
'version': '0.1',
'category': 'Tools',
'complexity': "easy",
'description': """
This module adds applications menu and features to your portal if hr and portal
are installed.
This module adds a jobs page to your portal if hr and portal are installed.
""",
'author': 'OpenERP SA',
'depends': ['hr','portal'],