[FIX] hr, hr_contract: personal information

Personal information should be protected at the model level, not only
the view. Otherwise, user can read these fields when exporting.

Courtesy of @odony

opw-752734
This commit is contained in:
Nicolas Martinelli
2017-07-31 11:48:02 +02:00
parent 1e64a88cd3
commit 88c9ab3cbc
2 changed files with 13 additions and 13 deletions
+8 -8
View File
@@ -110,26 +110,26 @@ class Employee(models.Model):
# we need a related field in order to be able to sort the employee by name
name_related = fields.Char(related='resource_id.name', string="Resource Name", readonly=True, store=True)
country_id = fields.Many2one('res.country', string='Nationality (Country)')
birthday = fields.Date('Date of Birth')
ssnid = fields.Char('SSN No', help='Social Security Number')
sinid = fields.Char('SIN No', help='Social Insurance Number')
identification_id = fields.Char(string='Identification No')
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')
gender = fields.Selection([
('male', 'Male'),
('female', 'Female'),
('other', 'Other')
])
], groups='hr.group_hr_user')
marital = fields.Selection([
('single', 'Single'),
('married', 'Married'),
('widower', 'Widower'),
('divorced', 'Divorced')
], string='Marital Status')
], string='Marital Status', groups='hr.group_hr_user')
department_id = fields.Many2one('hr.department', string='Department')
address_id = fields.Many2one('res.partner', string='Working 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')
domain="[('partner_id', '=', address_home_id)]", help='Employee bank salary account', groups='hr.group_hr_user')
work_phone = fields.Char('Work Phone')
mobile_phone = fields.Char('Work Mobile')
work_email = fields.Char('Work Email')
@@ -142,7 +142,7 @@ class Employee(models.Model):
ondelete='cascade', required=True, auto_join=True)
coach_id = fields.Many2one('hr.employee', string='Coach')
job_id = fields.Many2one('hr.job', string='Job Title')
passport_id = fields.Char('Passport No')
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')
login = fields.Char(related='user_id.login', readonly=True)
+5 -5
View File
@@ -10,11 +10,11 @@ class Employee(models.Model):
_inherit = "hr.employee"
manager = fields.Boolean(string='Is a Manager')
medic_exam = fields.Date(string='Medical Examination Date')
place_of_birth = fields.Char('Place of Birth')
children = fields.Integer(string='Number of Children')
vehicle = fields.Char(string='Company Vehicle')
vehicle_distance = fields.Integer(string='Home-Work Dist.', help="In kilometers")
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')
contract_ids = fields.One2many('hr.contract', 'employee_id', string='Contracts')
contract_id = fields.Many2one('hr.contract', compute='_compute_contract_id', string='Current Contract', help='Latest contract of the employee')
contracts_count = fields.Integer(compute='_compute_contracts_count', string='Contracts')