Person.py 9.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 38
  _properties = (
    # Personnal properties
    { 'id'         : 'first_name'
Vincent Pelletier's avatar
Vincent Pelletier committed
39
    , 'description': 'First name.'
40 41 42 43
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'last_name'
Vincent Pelletier's avatar
Vincent Pelletier committed
44
    , 'description': 'Last name.'
45 46 47 48
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'middle_name'
Vincent Pelletier's avatar
Vincent Pelletier committed
49
    , 'description': 'Middle name.'
50 51 52
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
53 54 55 56 57
    { 'id'         : 'birth_name'
    , 'description': 'Also called maiden name.'
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
58
    { 'id'         : 'prefix'
Vincent Pelletier's avatar
Vincent Pelletier committed
59
    , 'description': 'Name prefix.'
60 61 62 63
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'suffix'
Vincent Pelletier's avatar
Vincent Pelletier committed
64
    , 'description': 'Name suffix.'
65 66 67 68
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'birthday'
Vincent Pelletier's avatar
Vincent Pelletier committed
69
    , 'description': 'Date of birth.'
70
    , 'storage_id' : 'start_date'
71 72 73
    , 'type'       : 'date'
    , 'mode'       : 'w'
    },
74 75 76 77 78 79 80 81 82 83 84 85 86 87
    { 'id'                       : 'birthplace_address'
    , 'description'              : 'The current address where the person is'\
                                   ' born'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Address', )
    , 'acquired_property_id'     : ( 'text', 'street_address', 'city',
                                     'zip_code', 'region', 'region_title')
    , 'acquisition_copy_value'   : 0
    , 'acquisition_mask_value'   : 1
    , 'acquisition_sync_value'   : 0
    , 'acquisition_accessor_id'  : 'getDefaultBirthplaceAddressValue'
    , 'acquisition_depends'      : None
    , 'mode'                     : 'w'
    },
88
    { 'id'         : 'social_code'
89
    , 'description': 'The social code of this person.'
90 91 92 93
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'partner_count'
Vincent Pelletier's avatar
Vincent Pelletier committed
94
    , 'description': 'Number of familial partners.'
95 96 97 98
    , 'type'       : 'int'
    , 'mode'       : 'w'
    },
    { 'id'         : 'child_count'
Vincent Pelletier's avatar
Vincent Pelletier committed
99
    , 'description': 'Number of childs.'
100 101 102 103 104 105 106 107 108
    , 'type'       : 'int'
    , 'mode'       : 'w'
    },
    # Contact fields
    { 'id'                       : 'address'
    , 'storage_id'               : 'default_address'
    , 'description'              : 'The current address of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Address', )
109
    , 'acquired_property_id'     : ( 'text', 'street_address', 'city',
110 111
                                     'zip_code', 'region', 'region_title',
                                     'prefecture')
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
    , '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', )
127
    , 'acquired_property_id'     : ( 'text', 'telephone_number' )
128 129 130 131 132 133 134 135 136
    , '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
137 138 139 140 141
    { 'id'                       : 'mobile_telephone'
    , 'storage_id'               : 'mobile_telephone'
    , 'description'              : 'The current mobile telephone of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Telephone', )
142
    , 'acquired_property_id'     : ( 'text', 'telephone_number' )
Jean-Paul Smets's avatar
Jean-Paul Smets committed
143 144 145 146 147 148 149 150 151
    , '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'
    },
152 153 154 155 156
    { 'id'                       : 'fax'
    , 'storage_id'               : 'default_fax'
    , 'description'              : 'The current fax of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Fax', )
157
    , 'acquired_property_id'     : ( 'text', 'telephone_number' )
158 159 160 161 162 163 164 165 166 167 168 169 170 171
    , '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', )
172
    , 'acquired_property_id'     : ( 'text', )
173 174 175 176 177 178 179 180 181
    , '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
182 183 184 185 186
    { 'id'                       : 'alternate_email'
    , 'storage_id'               : 'alternate_email'
    , 'description'              : 'An alternate email of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Email', )
187
    , 'acquired_property_id'     : ( 'text', )
Jean-Paul Smets's avatar
Jean-Paul Smets committed
188 189 190 191 192 193 194 195 196
    , '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'
    },
197
    { 'id'                  : 'career'
198
    , 'storage_id'          : 'default_career'
199
    , 'description'         : 'The default career hold some properties of a Person.'
200
    , 'type'                : 'content'
201
    , 'portal_type'         : ( 'Career', )
202 203
    , 'acquired_property_id': ( 'start_date', 'stop_date', 'title',
                                'description', 'reference'
204
                              , 'subordination', 'subordination_title', 'subordination_value'
Jérome Perrin's avatar
Jérome Perrin committed
205
                              , 'subordination_uid_list', 'subordination_uid'
206
                              , 'collective_agreement_title', 'salary_coefficient'
207 208
                              , 'skill', 'skill_list', 'skill_id_list'
                              , 'skill_title_list', 'skill_value_list'
209
                              , 'skill_title', 'skill_value', 'skill_id'
210 211
                              , 'salary_level', 'salary_level_id', 'salary_level_title', 'salary_level_value'
                              , 'grade', 'grade_id', 'grade_title', 'grade_value'
212
                              , 'activity', 'activity_id', 'activity_title', 'activity_value'
213
                              , 'role', 'role_id', 'role_title', 'role_value'
214
                                      , 'role_id_list', 'role_title_list', 'role_value_list'
Jérome Perrin's avatar
Jérome Perrin committed
215
                              , 'function', 'function_id', 'function_title', 'function_value'
216
                                              , 'function_list', 'function_id_list', 'function_title_list', 'function_value_list'
217 218
                              , 'product_line', 'product_line_list', 'product_line_id_list'
                                              , 'product_line_title_list', 'product_line_value_list'
219 220 221 222
                              )
    , 'mode'                : 'w'
    },
  )
223

224 225 226 227 228
  _categories = (  # set on the Person directly
                  'gender', 'nationality', 'marital_status',
                   # acquired from address
                  'region',
                   # acquired from career
229
                  'group', 'subordination', 'role', 'function', 'activity',
230
                  'salary_level', 'grade', 'skill', 'product_line',
231
                 )
232