Person.py 8.56 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'
Vincent Pelletier's avatar
Vincent Pelletier committed
39
    , 'description': 'Cleartext password.'
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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
    , 'type'       : 'int'
    , 'mode'       : 'w'
    },
    # Contact fields
    { 'id'                       : 'address'
    , 'storage_id'               : 'default_address'
    , 'description'              : 'The current address of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Address', )
    , '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', )
    , '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
125 126 127 128 129 130 131 132 133 134 135 136 137 138
    { 'id'                       : 'mobile_telephone'
    , 'storage_id'               : 'mobile_telephone'
    , 'description'              : 'The current mobile telephone of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Telephone', )
    , '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'
    },
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
    { 'id'                       : 'fax'
    , 'storage_id'               : 'default_fax'
    , 'description'              : 'The current fax of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Fax', )
    , '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', )
    , '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
167 168 169 170 171 172 173 174 175 176 177 178 179 180
    { 'id'                       : 'alternate_email'
    , 'storage_id'               : 'alternate_email'
    , 'description'              : 'An alternate email of the person'
    , 'type'                     : 'content'
    , 'portal_type'              : ( 'Email', )
    , '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'
    },
181
    { 'id'                  : 'career'
182
    , 'storage_id'          : 'default_career'
183
    , 'description'         : 'The default career hold some properties of a Person.'
184
    , 'type'                : 'content'
185
    , 'portal_type'         : ( 'Career', )
Jérome Perrin's avatar
Jérome Perrin committed
186
    , 'acquired_property_id': ( 'start_date', 'stop_date', 'title', 'description'
187
                              , 'subordination', 'subordination_title', 'subordination_value'
Jérome Perrin's avatar
Jérome Perrin committed
188
                              , 'subordination_uid_list', 'subordination_uid'
189
                              , 'collective_agreement_title', 'salary_coefficient'
190 191 192 193
                              , 'skill_list', 'skill_id_list', 'skill_title_list', 'skill_value_list'
                              , '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
194
                              , 'function', 'function_id', 'function_title', 'function_value'
195
                              )
196
    , 'deprecated'          : 1
197 198 199
    , 'mode'                : 'w'
    },
  )
200

201 202 203 204 205 206
  _categories = (  # set on the Person directly
                  'gender', 'nationality', 'marital_status',
                  'product_line', # (product interest)
                   # acquired from address
                  'region',
                   # acquired from career
207 208
                  'group', 'subordination', 'role', 'function',
                  'salary_level', 'grade', 'skill',
209 210 211
                   # needed for movements having a Person as destination / source
                  'destination_region', 'source_region',
                 )
212