1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Management Solution
5 # Copyright (C) 2004-2011 OpenERP S.A (<http://www.openerp.com>).
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as
9 # published by the Free Software Foundation, either version 3 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ##############################################################################
22 from openerp.osv import fields, osv
24 class crm_contact_us(osv.TransientModel):
25 """ Add employees list to the portal's contact page """
26 _inherit = 'portal_crm.crm_contact_us'
27 _description = 'Contact form for the portal'
29 'employee_ids' : fields.many2many('hr.employee', string='Employees', readonly=True),
32 """ Little trick to display employees in our wizard view """
33 def _get_employee(self, cr, uid, context=None):
34 """ Employees flagged as 'private' won't appear on the contact page """
35 r = self.pool.get('hr.employee').search(cr, uid, [('visibility', '!=', 'private')], context=context)
39 'employee_ids' : _get_employee,
42 class hr_employee(osv.osv):
43 _description = 'Portal employee'
44 _inherit = 'hr.employee'
47 ``visibility``: defines if the employee appears on the portal's contact page
48 - 'public' means the employee will appear for everyone (anonymous)
49 - 'private' means the employee won't appear
52 'visibility': fields.selection([('public', 'Public'),('private', 'Private')],
53 string='Visibility', help='Employee\'s visibility in the portal\'s contact page'),
54 'public_info': fields.text('Public Info'),
57 'visibility': 'private',