[FIX] account_anglo_saxon: price difference, discount and taxes
[odoo/odoo.git] / addons / portal_hr_employees / hr_employee.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution
5 #    Copyright (C) 2004-2011 OpenERP S.A (<http://www.openerp.com>).
6 #
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.
11 #
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.
16 #
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/>.
19 #
20 ##############################################################################
21
22 from openerp.osv import fields, osv
23
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'
28     _columns = {
29         'employee_ids' : fields.many2many('hr.employee', string='Employees', readonly=True),
30     }
31
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)
36         return r
37
38     _defaults = {
39         'employee_ids' : _get_employee,
40     }
41
42 class hr_employee(osv.osv):
43     _description = 'Portal employee'
44     _inherit = 'hr.employee'
45
46     """
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
50     """
51     _columns = {
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'),
55     }
56     _defaults = {
57         'visibility': 'private',
58     }