Skip to Content
Menu
This question has been flagged
2 Replies
3252 Views

Dear All

         I have one field in xml. I want to make it in such a way that it can be edited by manager only if value of another field is true and user is manager. How to make both checking in doo11.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  

Avatar
Discard
Best Answer

You have to declare a functional field which is of boolean type. the function for this functional field will be compute a true or false value based on all the conditions of yours (eg : is manager, other field condition etc) . you will put this functional field in view and make it invisible. you can use methods in res,users table to determine if current user belongs to manager group user.has_group(group_ext_id)

you will then define attrs={'readonly': condition} for your field that you need to toggle edit capability. condition will be based on the above declared functional field.

Avatar
Discard
Author

okay thanks which decorator can be used to call the function

The decorator name @api.depends

Author Best Answer

okay

Avatar
Discard