[IMP] add the possibility to set a visibility (public, portal or private) for employees

bzr revid: abo@openerp.com-20120703160458-zzdk2kymapokm4j5
This commit is contained in:
Antonin Bourguignon 2012-07-03 18:04:58 +02:00
parent 8dd4364587
commit ae688e130f
5 changed files with 69 additions and 6 deletions

View File

@ -59,7 +59,7 @@
<field name="work_email" widget="email"/>
<field name="work_location"/>
</group>
<group string="Job Information">
<group name="job_information" string="Job Information">
<field name="job_id" domain="[('state','!=','old')]" context="{'form_view_ref': 'hr.view_hr_job_employee_form'}"/>
<field name="coach_id"/>
</group>
@ -207,7 +207,7 @@
<field name="view_mode">form</field>
<field name="view_id" ref="view_employee_form"/>
<field name="act_window_id" ref="open_view_employee_list_my"/>
</record>
</record>
<menuitem action="open_view_employee_list_my" id="menu_open_view_employee_list_my" sequence="3" parent="menu_hr_main"/>
@ -410,8 +410,8 @@
<search string="Jobs">
<field name="name" string="Job"/>
<separator orientation="vertical"/>
<filter icon="terp-camera_test"
domain="[('state','=','open')]"
<filter icon="terp-camera_test"
domain="[('state','=','open')]"
string="In Position"
help="In Position"/>
<filter icon="terp-personal+" domain="[('state','=','recruit')]" string="In Recruitment"
@ -427,7 +427,7 @@
</search>
</field>
</record>
<record id="view_hr_job_employee_form" model="ir.ui.view">
<field name="name">hr.job.employee.form</field>
<field name="model">hr.job</field>
@ -444,7 +444,7 @@
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_hr_job">
<field name="name">Job Positions</field>
<field name="res_model">hr.job</field>

View File

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

View File

@ -32,6 +32,7 @@ portal are installed.
'author': 'OpenERP SA',
'depends': ['crm','portal'],
'data': [
'hr_employee_view.xml',
'security/ir.model.access.csv',
'wizard/contact_view.xml',
],

View File

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 OpenERP S.A (<http://www.openerp.com>).
#
# 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/>.
#
##############################################################################
from osv import osv, fields
class hr_employee(osv.osv):
_description = "Portal CRM Employee"
_inherit = 'hr.employee'
"""
``visibility``: defines if the employee appears on the portal's contact page
- 'public' means the employee will appear for everyone (anonymous)
- 'portal' means the employee will appear for portal users only
- 'private' means the employee won't appear
"""
_columns = {
'visibility': fields.selection([('public', 'Public'),('portal', 'Portal'),('private', 'Private')],
string='Visibility', help='Employee\'s visibility in the portal\'s contact page'),
}
_defaults = {
'visibility': 'private',
}

View File

@ -0,0 +1,19 @@
<?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>