Person.py 8.98 KB
Newer Older
1
#############################################################################
Jean-Paul Smets's avatar
Jean-Paul Smets committed
2
#
3 4 5
# Copyright (c) 2002-2005 Nexedi SARL and Contributors. All Rights Reserved.
#                         Jean-Paul Smets-Solanes <jp@nexedi.com>
#                         Kevin Deldycke <kevin_AT_nexedi_DOT_com>
Jean-Paul Smets's avatar
Jean-Paul Smets committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
##############################################################################


class Person:
32 33 34
  """
    Person properties and categories
  """
Jean-Paul Smets's avatar
Jean-Paul Smets committed
35

36 37
  _properties = (
    # Personnal properties
Jean-Paul Smets's avatar
Jean-Paul Smets committed
38
    { 'id'         : 'password'
39
    , 'description': 'The password used by ERP5Security'
Jean-Paul Smets's avatar
Jean-Paul Smets committed
40
    , 'type'       : 'string'
41
    , 'write_permission' : 'Set own password'
42
    , 'read_permission'  : 'Manage users'
Jean-Paul Smets's avatar
Jean-Paul Smets committed
43 44
    , 'mode'       : 'w'
    },
45
    { 'id'         : 'first_name'
Vincent Pelletier's avatar
Vincent Pelletier committed
46
    , 'description': 'First name.'
47 48 49 50
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'last_name'
Vincent Pelletier's avatar
Vincent Pelletier committed
51
    , 'description': 'Last name.'
52 53 54 55
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'middle_name'
Vincent Pelletier's avatar
Vincent Pelletier committed
56
    , 'description': 'Middle name.'
57 58 59
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
60 61 62 63 64
    { 'id'         : 'birth_name'
    , 'description': 'Also called maiden name.'
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
65
    { 'id'         : 'prefix'
Vincent Pelletier's avatar
Vincent Pelletier committed
66
    , 'description': 'Name prefix.'
67 68 69 70
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'suffix'
Vincent Pelletier's avatar
Vincent Pelletier committed
71
    , 'description': 'Name suffix.'
72 73 74 75
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'birthday'
Vincent Pelletier's avatar
Vincent Pelletier committed
76
    , 'description': 'Date of birth.'
77 78 79 80
    , 'type'       : 'date'
    , 'mode'       : 'w'
    },
    { 'id'         : 'social_code'
81
    , 'description': 'The social code of this person.'
82 83 84 85
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'partner_count'
Vincent Pelletier's avatar
Vincent Pelletier committed
86
    , 'description': 'Number of familial partners.'
87 88 89 90
    , 'type'       : 'int'
    , 'mode'       : 'w'
    },
    { 'id'         : 'child_count'
Vincent Pelletier's avatar
Vincent Pelletier committed
91
    , 'description': 'Number of childs.'
92 93 94 95 96 97 98 99 100
    , 'type'       : 'int'
    , 'mode'       : 'w'
    },
    # Contact fields
    { 'id'                       : 'address'
    , 'storage_id'               : 'default_address'
    , 'description'              : 'The current address of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Address', )
101 102
    , 'acquired_property_id'     : ( 'text', 'street_address', 'city',
                                     'zip_code', 'region', 'region_title')
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
    , 'acquisition_base_category': ( 'subordination', )
    , 'acquisition_portal_type'  : ( 'Organisation', )
    , 'acquisition_copy_value'   : 0
    , 'acquisition_mask_value'   : 1
    , 'acquisition_sync_value'   : 0
    , 'acquisition_accessor_id'  : 'getDefaultAddressValue'
    , 'acquisition_depends'      : None
    , 'alt_accessor_id'          : ( 'getCareerDefaultAddressValue', )
    , 'mode'                     : 'w'
    },
    { 'id'                       : 'telephone'
    , 'storage_id'               : 'default_telephone'
    , 'description'              : 'The current telephone of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Telephone', )
118
    , 'acquired_property_id'     : ( 'text', 'telephone_number' )
119 120 121 122 123 124 125 126 127
    , 'acquisition_base_category': ( 'subordination', )
    , 'acquisition_portal_type'  : ( 'Organisation', )
    , 'acquisition_copy_value'   : 0
    , 'acquisition_mask_value'   : 1
    , 'acquisition_sync_value'   : 0
    , 'acquisition_accessor_id'  : 'getDefaultTelephoneValue'
    , 'acquisition_depends'      : None
    , 'mode'                     : 'w'
    },
Jean-Paul Smets's avatar
Jean-Paul Smets committed
128 129 130 131 132
    { 'id'                       : 'mobile_telephone'
    , 'storage_id'               : 'mobile_telephone'
    , 'description'              : 'The current mobile telephone of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Telephone', )
133
    , 'acquired_property_id'     : ( 'text', 'telephone_number' )
Jean-Paul Smets's avatar
Jean-Paul Smets committed
134 135 136 137 138 139 140 141 142
    , 'acquisition_base_category': ( 'subordination', )
    , 'acquisition_portal_type'  : ( 'Organisation', )
    , 'acquisition_copy_value'   : 0
    , 'acquisition_mask_value'   : 1
    , 'acquisition_sync_value'   : 0
    , 'acquisition_accessor_id'  : 'getDefaultMobileTelephoneValue'
    , 'acquisition_depends'      : None
    , 'mode'                     : 'w'
    },
143 144 145 146 147
    { 'id'                       : 'fax'
    , 'storage_id'               : 'default_fax'
    , 'description'              : 'The current fax of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Fax', )
148
    , 'acquired_property_id'     : ( 'text', 'telephone_number' )
149 150 151 152 153 154 155 156 157 158 159 160 161 162
    , 'acquisition_base_category': ( 'subordination', )
    , 'acquisition_portal_type'  : ( 'Organisation', )
    , 'acquisition_copy_value'   : 0
    , 'acquisition_mask_value'   : 1
    , 'acquisition_sync_value'   : 0
    , 'acquisition_accessor_id'  : 'getDefaultFaxValue'
    , 'acquisition_depends'      : None
    , 'mode'                     : 'w'
    },
    { 'id'                       : 'email'
    , 'storage_id'               : 'default_email'
    , 'description'              : 'The current email of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Email', )
163
    , 'acquired_property_id'     : ( 'text', )
164 165 166 167 168 169 170 171 172
    , 'acquisition_base_category': ( 'subordination', )
    , 'acquisition_portal_type'  : ( 'Organisation', )
    , 'acquisition_copy_value'   : 0
    , 'acquisition_mask_value'   : 1
    , 'acquisition_sync_value'   : 0
    , 'acquisition_accessor_id'  : 'getDefaultEmailValue'
    , 'acquisition_depends'      : None
    , 'mode'                     : 'w'
    },
Jean-Paul Smets's avatar
Jean-Paul Smets committed
173 174 175 176 177
    { 'id'                       : 'alternate_email'
    , 'storage_id'               : 'alternate_email'
    , 'description'              : 'An alternate email of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Email', )
178
    , 'acquired_property_id'     : ( 'text', )
Jean-Paul Smets's avatar
Jean-Paul Smets committed
179 180 181 182 183 184 185 186 187
    , 'acquisition_base_category': ( 'subordination', )
    , 'acquisition_portal_type'  : ( 'Organisation', )
    , 'acquisition_copy_value'   : 0
    , 'acquisition_mask_value'   : 1
    , 'acquisition_sync_value'   : 0
    , 'acquisition_accessor_id'  : 'getDefaultAlternateEmailValue'
    , 'acquisition_depends'      : None
    , 'mode'                     : 'w'
    },
188
    { 'id'                  : 'career'
189
    , 'storage_id'          : 'default_career'
190
    , 'description'         : 'The default career hold some properties of a Person.'
191
    , 'type'                : 'content'
192
    , 'portal_type'         : ( 'Career', )
Jérome Perrin's avatar
Jérome Perrin committed
193
    , 'acquired_property_id': ( 'start_date', 'stop_date', 'title', 'description'
194
                              , 'subordination', 'subordination_title', 'subordination_value'
Jérome Perrin's avatar
Jérome Perrin committed
195
                              , 'subordination_uid_list', 'subordination_uid'
196
                              , 'collective_agreement_title', 'salary_coefficient'
197
                              , 'skill', 'skill_list', 'skill_id_list', 'skill_title_list', 'skill_value_list'
198 199 200
                              , 'salary_level', 'salary_level_id', 'salary_level_title', 'salary_level_value'
                              , 'grade', 'grade_id', 'grade_title', 'grade_value'
                              , 'role', 'role_id', 'role_title', 'role_value'
Jérome Perrin's avatar
Jérome Perrin committed
201
                              , 'function', 'function_id', 'function_title', 'function_value'
202 203 204 205
                              )
    , 'mode'                : 'w'
    },
  )
206

207 208 209 210 211 212
  _categories = (  # set on the Person directly
                  'gender', 'nationality', 'marital_status',
                  'product_line', # (product interest)
                   # acquired from address
                  'region',
                   # acquired from career
213 214
                  'group', 'subordination', 'role', 'function',
                  'salary_level', 'grade', 'skill',
215 216 217
                   # needed for movements having a Person as destination / source
                  'destination_region', 'source_region',
                 )
218