[IMP] hr: Add private information fields on the employees

Add some private information on the employees like:
- Certificate: Bachelor, Master, Other
- Place/Date of birth
- KM Home/Work
- Emergency Number/Contact
- ...

Also move some already existing private information from hr_contract to hr.
This commit is contained in:
Yannick Tivisse
2018-05-04 09:59:24 +02:00
parent 20c967ed19
commit a696f84f1f
4 changed files with 43 additions and 8 deletions
+23
View File
@@ -132,6 +132,11 @@ class Employee(models.Model):
('widower', 'Widower'),
('divorced', 'Divorced')
], string='Marital Status', groups="hr.group_hr_user", default='single')
spouse_complete_name = fields.Char(string="Spouse Complete Name", groups="hr.group_hr_user")
spouse_birthdate = fields.Date(string="Spouse Birthdate", groups="hr.group_hr_user")
children = fields.Integer(string='Number of Children', groups="hr.group_hr_user")
place_of_birth = fields.Char('Place of Birth', groups="hr.group_hr_user")
country_of_birth = fields.Many2one('res.country', string="Country of Birth", 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")
@@ -145,6 +150,19 @@ class Employee(models.Model):
permit_no = fields.Char('Work Permit No', groups="hr.group_hr_user")
visa_no = fields.Char('Visa No', groups="hr.group_hr_user")
visa_expire = fields.Date('Visa Expire Date', groups="hr.group_hr_user")
additional_note = fields.Text(string='Additional Note')
certificate = fields.Selection([
('bachelor', 'Bachelor'),
('master', 'Master'),
('other', 'Other'),
], 'Certificate Level', default='master')
study_field = fields.Char("Field of Study", placeholder='Computer Science')
study_school = fields.Char("School")
emergency_contact = fields.Char("Emergency Contact")
emergency_phone = fields.Char("Emergency Phone")
km_home_work = fields.Integer(string="Km home-work", groups="hr.group_hr_user")
google_drive_link = fields.Char(string="Employee Documents", groups="hr.group_hr_user")
job_title = fields.Char("Job Title")
# image: all image fields are base64 encoded and PIL-supported
image = fields.Binary(
@@ -187,6 +205,11 @@ class Employee(models.Model):
if not employee._check_recursion():
raise ValidationError(_('Error! You cannot create recursive hierarchy of Employee(s).'))
@api.onchange('job_id')
def _onchange_job_id(self):
if self.job_id:
self.job_title = self.job_id.name
@api.onchange('address_id')
def _onchange_address(self):
self.work_phone = self.address_id.phone
+20
View File
@@ -68,6 +68,7 @@
<group string="Position">
<field name="department_id"/>
<field name="job_id"/>
<field name="job_title"/>
<field name="parent_id"/>
<field name="coach_id"/>
<field name="resource_calendar_id" required="1"/>
@@ -94,19 +95,38 @@
This private address is used in the expense report reimbursement document.
It should be different from the work address.
</div>
<field name="emergency_contact"/>
<field name="emergency_phone"/>
<field name="km_home_work" groups="hr.group_hr_user"/>
</group>
<group string="Status">
<field name="gender"/>
<field name="marital"/>
<field name="spouse_complete_name" attrs="{'invisible': [('marital', 'not in', ['married', 'cohabitant'])]}" groups="hr.group_hr_user"/>
<field name="spouse_birthdate" attrs="{'invisible': [('marital', 'not in', ['married', 'cohabitant'])]}" groups="hr.group_hr_user"/>
<field name="children"/>
</group>
<group string="Birth">
<field name="birthday"/>
<field name="place_of_birth" groups="hr.group_hr_user"/>
<field name="country_of_birth" groups="hr.group_hr_user"/>
</group>
<group string="Work Permit" name="work_permit">
<field name="visa_no"/>
<field name="permit_no"/>
<field name="visa_expire"/>
</group>
<group string="Education">
<field name="certificate"/>
<field name="study_field"/>
<field name="study_school"/>
</group>
</group>
<group>
<field name="google_drive_link" widget="url"/>
</group>
<group>
<field name="additional_note"/>
</group>
</page>
<page name="hr_settings" string="HR Settings" groups="hr.group_hr_user">
-2
View File
@@ -14,8 +14,6 @@ class Employee(models.Model):
manager = fields.Boolean(string='Is a Manager')
medic_exam = fields.Date(string='Medical Examination Date', groups="hr.group_hr_user")
place_of_birth = fields.Char('Place of Birth', groups="hr.group_hr_user")
children = fields.Integer(string='Number of Children', groups="hr.group_hr_user")
vehicle = fields.Char(string='Company Vehicle', groups="hr.group_hr_user")
vehicle_distance = fields.Integer(
string='Home-Work Dist.', help="In kilometers", groups="hr.group_hr_user")
@@ -38,12 +38,6 @@
<field name="vehicle_distance"/>
</group>
</xpath>
<xpath expr="//field[@name='marital']" position="after">
<field name="children"/>
</xpath>
<xpath expr="//field[@name='birthday']" position="after">
<field name="place_of_birth"/>
</xpath>
<xpath expr="//field[@name='bank_account_id']" position="replace">
<field name="bank_account_id" context="{'display_partner':True}"/>
</xpath>