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

239 240 241 242 243
  _categories = (  # set on the Person directly
                  'gender', 'nationality', 'marital_status',
                   # acquired from address
                  'region',
                   # acquired from career
244
                  'group', 'subordination', 'role', 'function', 'activity',
245
                  'salary_level', 'grade', 'skill', 'product_line',
246
                 )
247