Skip to Content
Menu
This question has been flagged

Hi all,


 I have a custom module in Odoo 17, and I want to set the work_email field as read-only for employees. This field is already present in the HR module (res_users.py). The employee user profile has many fields, and I want to customize it. I have created a new group in the Sales category named "Sales Executive." In the HR group, there are already two groups: Admin and Officer. These groups have full access to the profile. If normal employees go to the profile, they should only have read-only access unless they are assigned to any group in the HR category. I want to achieve full access using the Officer group from HR. Additionally, for users with the Sales Executive group, I want the work_email field to be read-only. How can I achieve this? 


**my codes:**


 module : custom_sales_module

*model:custom_res_model**

class CustomUserProfile(models.Model): 

​_inherit = 'res.users'

**security/ir_model_group :** '


 

​ 
​  
​ Sales Role

​ 10 

​ 

​ 

​Sales Executive 

​  

​ 

'


 views: **custom_res_users_views:** `


 

​ 

​ 

​custom.user.profile.security.view 

​res.users

​  

​  

​ 

​1 

​ 

​ 

​ 

​  



 ** Issue:**

 Using this code, the work_email field is set to read-only globally, not just for the Sales Executive group. 


**Question:** 


How can I correctly set the work_email field to be read-only only for the Sales Executive group?

Avatar
Discard
Related Posts Replies Views Activity
1
Jun 25
1197
3
Mar 25
2740
0
Mar 25
1280
4
Jan 25
2267
1
Nov 24
2366