~deneroteam/openerp-hrms/trunk

« back to all changes in this revision

Viewing changes to hr_security_ext/hr.py

  • Committer: Daniel Reis
  • Date: 2012-07-18 07:47:41 UTC
  • Revision ID: dreis.pt@hotmail.com-20120718074741-fqyx1536wuddc2eq
HR extensions to security and roles

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
##############################################################################
 
3
#
 
4
#    Daniel Reis, 2011
 
5
#    
 
6
#    This program is free software: you can redistribute it and/or modify
 
7
#    it under the terms of the GNU Affero General Public License as
 
8
#    published by the Free Software Foundation, either version 3 of the
 
9
#    License, or (at your option) any later version.
 
10
#
 
11
#    This program is distributed in the hope that it will be useful,
 
12
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
#    GNU Affero General Public License for more details.
 
15
#
 
16
#    You should have received a copy of the GNU Affero General Public License
 
17
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
#
 
19
##############################################################################
 
20
 
 
21
from osv import fields, osv
 
22
import reis_base as util 
 
23
 
 
24
 
 
25
class hr_employee(osv.osv):
 
26
    _inherit = 'hr.employee'
 
27
    _columns = {
 
28
        'code': fields.char('Internal code', size=16),
 
29
    }
 
30
    
 
31
    def name_get(self, cr, uid, ids, context=None):
 
32
        return util.ext_name_get(self, cr, uid, ids, '[%(code)s] %(name)s', ['code','name'], context=context)
 
33
    
 
34
    def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=100):
 
35
        return util.ext_name_search(self, cr, user, name, args, operator, context=context, limit=limit, 
 
36
                                keys=['code','name'])
 
37
hr_employee()
 
38
 
 
39
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: