Person.py 8.28 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 39 40 41 42
    { 'id'         : 'password'
    , 'description': ''
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
    { 'id'         : 'first_name'
    , 'description': ''
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'last_name'
    , 'description': ''
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'middle_name'
    , 'description': ''
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
58 59 60 61 62
    { 'id'         : 'birth_name'
    , 'description': 'Also called maiden name.'
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
    { 'id'         : 'prefix'
    , 'description': ''
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'suffix'
    , 'description': ''
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'birthday'
    , 'description': ''
    , 'type'       : 'date'
    , 'mode'       : 'w'
    },
    { 'id'         : 'social_code'
79
    , 'description': 'The social code of this person.'
80 81 82 83 84 85 86 87 88 89 90 91 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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
    , 'type'       : 'string'
    , 'mode'       : 'w'
    },
    { 'id'         : 'partner_count'
    , 'description': ''
    , 'type'       : 'int'
    , 'mode'       : 'w'
    },
    { 'id'         : 'child_count'
    , 'description': ''
    , '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'
    },
    { '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'
    },
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
    { 'id'                  : 'default_career'
    , 'storage_id'          : 'default_career'
    , 'description'         : 'The default career hold some properties of a Person.'
    , 'type'                : 'content'
    , 'portal_type'         : ( 'Career', )
    , 'acquired_property_id': ( 'start_date', 'stop_date', 'title', 'description'
                              , 'subordination', 'subordination_title', 'subordination_value'
                              , 'subordination_uid_list', 'subordination_uid'
                              , 'collective_agreement_title', 'salary_coefficient'
                              , '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'
                              , 'function', 'function_id', 'function_title', 'function_value'
                              )
    , 'deprecated'          : 1
    , 'mode'                : 'w'
    },
    # Career accessors like getCareerTitle ... are deprecated, instead
    # we should use getDefaultCareerTitle
171
    { 'id'                  : 'career'
172
    , 'storage_id'          : 'default_career'
173
    , 'description'         : 'The default career hold some properties of a Person.'
174 175
    , 'type'                : 'content'
    , 'portal_type'         : ( 'Career', )
Jérome Perrin's avatar
Jérome Perrin committed
176
    , 'acquired_property_id': ( 'start_date', 'stop_date', 'title', 'description'
177
                              , 'subordination', 'subordination_title', 'subordination_value'
Jérome Perrin's avatar
Jérome Perrin committed
178
                              , 'subordination_uid_list', 'subordination_uid'
179
                              , 'collective_agreement_title', 'salary_coefficient'
180 181 182 183
                              , '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
184
                              , 'function', 'function_id', 'function_title', 'function_value'
185
                              )
186
    , 'deprecated'          : 1
187 188 189
    , 'mode'                : 'w'
    },
  )
190

191 192 193 194 195 196 197 198 199 200
  _categories = (  # set on the Person directly
                  'gender', 'nationality', 'marital_status',
                  'product_line', # (product interest)
                   # acquired from address
                  'region',
                   # acquired from career
                  'subordination', 'role', 'function', 'salary_level',
                   # needed for movements having a Person as destination / source
                  'destination_region', 'source_region',
                 )
201