diff options
| author | RomainLibert <rli@odoo.com> | 2019-04-08 11:41:13 +0200 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2019-05-31 10:21:20 +0200 |
| commit | c9ca3761464413327d2beb697553a3ccd7eef4d1 (patch) | |
| tree | 74b3bf1db6dcb5eb4c75ce0378a08d08075920ef /addons/hr/security | |
| parent | b2b26f1ff7e4dcf7d0c0ccc36b249045372329c7 (diff) | |
[IMP] hr: Introduce the public employee profile
Purpose
=======
1/ Robustness & security: right now it is not easy to understand and do something
clean in term of security (hr people vs employees, private info vs public). A
HR officer doesn't know if he can write something on the chatter. Currently, a
note will be visible for all the employees who have access to the employee form
view for example.
2/ In term of business, it makes sense to let a hr manages payroll stuff (contract,
employees private information, ... and other employee see public information
(résumé and work information)
Specification
=============
Introduce 2 new models:
- hr.employee.base (AbstractModel): This represents the basic skeleton
model on which the shared fields and methods between the public and
the private employees models.
- hr.employee.public (_auto=False): This is a sql view based on the
employee values, readable for an internal user (i.e. an employee).
The model hr.employee is not readable anymore for an employee.
There are now 3 ways to access the employee data:
1/ From the hr.employee views. HR officer access rights are required
2/ From the public profile. The public data for an employee are accessible
but can't be modified.
3/ From the 'My Profile' menu. A classic employee can access its own
data from there, and can modify them.
Diffstat (limited to 'addons/hr/security')
| -rw-r--r-- | addons/hr/security/hr_security.xml | 7 | ||||
| -rw-r--r-- | addons/hr/security/ir.model.access.csv | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/addons/hr/security/hr_security.xml b/addons/hr/security/hr_security.xml index c735d05b1ce..bbafaf7fb38 100644 --- a/addons/hr/security/hr_security.xml +++ b/addons/hr/security/hr_security.xml @@ -40,6 +40,13 @@ <field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> </record> + <record id="hr_employee_public_comp_rule" model="ir.rule"> + <field name="name">Employee multi company rule</field> + <field name="model_id" ref="model_hr_employee_public"/> + <field name="global" eval="True"/> + <field name="domain_force">['|',('company_id','=',False),('company_id', 'in', company_ids)]</field> + </record> + <record id="hr_job_comp_rule" model="ir.rule"> <field name="name">Job multi company rule</field> <field name="model_id" ref="model_hr_job"/> diff --git a/addons/hr/security/ir.model.access.csv b/addons/hr/security/ir.model.access.csv index 345374b31fe..e28b4065ee3 100644 --- a/addons/hr/security/ir.model.access.csv +++ b/addons/hr/security/ir.model.access.csv @@ -2,7 +2,8 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink access_hr_employee_category_user,hr.employee.category.user,model_hr_employee_category,group_hr_user,1,1,1,1
access_hr_employee_category_emp,hr.employee.category.emp,model_hr_employee_category,base.group_user,1,0,0,0
access_hr_employee_user,hr.employee user,model_hr_employee,group_hr_user,1,1,1,1
-access_hr_employee_system_user,hr.employee system user,model_hr_employee,base.group_user,1,0,0,0
+access_hr_employee_system_user,hr.employee system user,model_hr_employee,base.group_user,0,0,0,0
+access_hr_employee_public_user,hr.employee_public,model_hr_employee_public,base.group_user,1,0,0,0
access_hr_employee_resource_user,resource.resource.user,resource.model_resource_resource,group_hr_user,1,1,1,1
access_hr_department_user,hr.department.user,model_hr_department,group_hr_user,1,1,1,1
access_hr_department_employee,hr.department.employee,model_hr_department,base.group_user,1,0,0,0
|
