Hi,
all is in the title, how to make a field ediable only for a current user with a specifique job_id (user attached with a employe entry)
thx in advance
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi,
all is in the title, how to make a field ediable only for a current user with a specifique job_id (user attached with a employe entry)
thx in advance
I solved this problem by adding a python function. So please create another boolean field like get_user = fields.Boolean(string='User', compute=_check_responsible, invisible=True) . Then give the functional description inside _check_responsible. For example you can check the current user is involved a group like this: flag_hr_manager = self.env['res.users'].has_group('base.group_hr_manager'). If flag_hr_manager fields gives TRUE, then the current user is involved that group. You can also check any other custom checking inside this function. Don't forget to assign the True/False at the end of this function.
Now, you can check user is eligible to edit the desired field using attrs.
for example: <field name="your_field" attrs="{'readonly':[('get_user','!=',True)]}"/> in your xml file
or, editing in fields_view_get is another option
Hope this will help you. Thankyou
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Dec 17
|
3156 | ||
|
1
Mar 15
|
2786 | ||
|
0
May 24
|
310 | ||
|
0
Mar 22
|
1137 | ||
|
1
Apr 19
|
3353 |