[MOV] hr: reorganize fields of hr.employee model
No technical or functional change. Only reorganizing fields to better understand the model. Future commits will change a few fields in this model and this commit prepares it by classifying a bit them.
This commit is contained in:
+46
-33
@@ -105,16 +105,15 @@ class Employee(models.Model):
|
||||
image_path = get_module_resource('hr', 'static/src/img', 'default_image.png')
|
||||
return tools.image_resize_image_big(open(image_path, 'rb').read().encode('base64'))
|
||||
|
||||
# resource
|
||||
# resource and user
|
||||
name = fields.Char(related='resource_id.name', store=True, oldname='name_related')
|
||||
user_id = fields.Many2one('res.users', 'User', related='resource_id.user_id')
|
||||
active = fields.Boolean('Active', related='resource_id.active', default=True, store=True)
|
||||
|
||||
country_id = fields.Many2one('res.country', string='Nationality (Country)')
|
||||
birthday = fields.Date('Date of Birth', groups="hr.group_hr_user")
|
||||
ssnid = fields.Char('SSN No', help='Social Security Number', groups="hr.group_hr_user")
|
||||
sinid = fields.Char('SIN No', help='Social Insurance Number', groups="hr.group_hr_user")
|
||||
identification_id = fields.Char(string='Identification No', groups="hr.group_hr_user")
|
||||
# private partner
|
||||
address_home_id = fields.Many2one(
|
||||
'res.partner', 'Home Address')
|
||||
country_id = fields.Many2one(
|
||||
'res.country', 'Nationality (Country)')
|
||||
gender = fields.Selection([
|
||||
('male', 'Male'),
|
||||
('female', 'Female'),
|
||||
@@ -126,37 +125,51 @@ class Employee(models.Model):
|
||||
('widower', 'Widower'),
|
||||
('divorced', 'Divorced')
|
||||
], string='Marital Status', groups="hr.group_hr_user")
|
||||
department_id = fields.Many2one('hr.department', string='Department')
|
||||
address_id = fields.Many2one('res.partner', string='Work Address')
|
||||
address_home_id = fields.Many2one('res.partner', string='Home Address')
|
||||
bank_account_id = fields.Many2one('res.partner.bank', string='Bank Account Number',
|
||||
domain="[('partner_id', '=', address_home_id)]", help='Employee bank salary account',
|
||||
groups="hr.group_hr_user")
|
||||
birthday = fields.Date('Date of Birth', groups="hr.group_hr_user")
|
||||
ssnid = fields.Char('SSN No', help='Social Security Number', groups="hr.group_hr_user")
|
||||
sinid = fields.Char('SIN No', help='Social Insurance Number', groups="hr.group_hr_user")
|
||||
identification_id = fields.Char(string='Identification No', groups="hr.group_hr_user")
|
||||
passport_id = fields.Char('Passport No', groups="hr.group_hr_user")
|
||||
bank_account_id = fields.Many2one(
|
||||
'res.partner.bank', 'Bank Account Number',
|
||||
domain="[('partner_id', '=', address_home_id)]",
|
||||
groups="hr.group_hr_user",
|
||||
help='Employee bank salary account')
|
||||
# image: all image fields are base64 encoded and PIL-supported
|
||||
image = fields.Binary(
|
||||
"Photo", default=_default_image, attachment=True,
|
||||
help="This field holds the image used as photo for the employee, limited to 1024x1024px.")
|
||||
image_medium = fields.Binary(
|
||||
"Medium-sized photo", attachment=True,
|
||||
help="Medium-sized photo of the employee. It is automatically "
|
||||
"resized as a 128x128px image, with aspect ratio preserved. "
|
||||
"Use this field in form views or some kanban views.")
|
||||
image_small = fields.Binary(
|
||||
"Small-sized photo", attachment=True,
|
||||
help="Small-sized photo of the employee. It is automatically "
|
||||
"resized as a 64x64px image, with aspect ratio preserved. "
|
||||
"Use this field anywhere a small image is required.")
|
||||
# work
|
||||
address_id = fields.Many2one(
|
||||
'res.partner', 'Work Address')
|
||||
work_phone = fields.Char('Work Phone')
|
||||
mobile_phone = fields.Char('Work Mobile')
|
||||
work_email = fields.Char('Work Email')
|
||||
work_location = fields.Char('Work Location')
|
||||
notes = fields.Text('Notes')
|
||||
parent_id = fields.Many2one('hr.employee', string='Manager')
|
||||
category_ids = fields.Many2many('hr.employee.category', 'employee_category_rel', 'emp_id', 'category_id', string='Tags')
|
||||
child_ids = fields.One2many('hr.employee', 'parent_id', string='Subordinates')
|
||||
coach_id = fields.Many2one('hr.employee', string='Coach')
|
||||
job_id = fields.Many2one('hr.job', string='Job Title')
|
||||
passport_id = fields.Char('Passport No', groups="hr.group_hr_user")
|
||||
color = fields.Integer('Color Index', default=0)
|
||||
city = fields.Char(related='address_id.city')
|
||||
|
||||
# image: all image fields are base64 encoded and PIL-supported
|
||||
image = fields.Binary("Photo", default=_default_image, attachment=True,
|
||||
help="This field holds the image used as photo for the employee, limited to 1024x1024px.")
|
||||
image_medium = fields.Binary("Medium-sized photo", attachment=True,
|
||||
help="Medium-sized photo of the employee. It is automatically "
|
||||
"resized as a 128x128px image, with aspect ratio preserved. "
|
||||
"Use this field in form views or some kanban views.")
|
||||
image_small = fields.Binary("Small-sized photo", attachment=True,
|
||||
help="Small-sized photo of the employee. It is automatically "
|
||||
"resized as a 64x64px image, with aspect ratio preserved. "
|
||||
"Use this field anywhere a small image is required.")
|
||||
# employee in company
|
||||
job_id = fields.Many2one('hr.job', 'Job Title')
|
||||
department_id = fields.Many2one('hr.department', 'Department')
|
||||
parent_id = fields.Many2one('hr.employee', 'Manager')
|
||||
child_ids = fields.One2many('hr.employee', 'parent_id', string='Subordinates')
|
||||
coach_id = fields.Many2one('hr.employee', 'Coach')
|
||||
category_ids = fields.Many2many(
|
||||
'hr.employee.category', 'employee_category_rel',
|
||||
'emp_id', 'category_id',
|
||||
string='Tags')
|
||||
# misc
|
||||
notes = fields.Text('Notes')
|
||||
color = fields.Integer('Color Index', default=0)
|
||||
|
||||
@api.constrains('parent_id')
|
||||
def _check_parent_id(self):
|
||||
|
||||
Reference in New Issue
Block a user