On Tue, Apr 4, 2017 at 7:05 PM, Sergi Almacellas Abellana <[email protected]>
wrote:

> El 04/04/17 a les 15:58, Khurram Shahzad ha escrit:
>
>> Dear All,
>>
>> We want to hide a page in the notebook of a form for a specific user
>> role. We want to keep it visible for all other roles. How can it be
>> done? Similarly, a group in the form is also required to be set
>> invisible for a specific user role. How can it be achieved?
>>
>
> In the user context you have the groups which the user belongs to. Then
> using the states attribute of the page/group (set using view_attributes),
> you can hide the page/group if the user groups does not contain the Id of
> your group.
>
> Something like:
>
> @classmethod
> def view_attributes(cls):
>    return [('xpath/to/your/page', 'states', {
>        'invisible': ~In(Id(<module>, <id_group>), Eval('groups', []))})]
>
> Where <module> is the module which created the group and <id_group> is the
> xml_id of the group you want to test.
>
> Another option is to set the name attribute of the group/page to a related
> field and then restrict the access to this field. This is usefull if the
> page only contains one field.
>
> Hope it helps


Thank you so much for such a prompt response. Let me try it to be more
thankful 😀.

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/CAM3N3CwMMHOfZhEwZmsv0rhAW32%3D-td3rrQvOr7iCvytBAe%2Bxw%40mail.gmail.com.

Reply via email to