Skip to Content
Menu
This question has been flagged
1 Reply
8749 Views

Hello,

   I would like to know how to hide a view type like Kanban from a particular group.  Is there a way to do this?  I tried a couple ways that I thought would work, but for some reason it is still showing the Kanban view for the unwanted group.

Here is one method that I tried:

<record model="ir.ui.view" id="project.view_project_kanban">
        <field name="groups_id" eval="[(6,0,[ref('group1'),ref('group2'),ref('group3')])]" />
</record>

I thought by adding groups the the view's group_ids field would only allow users in those groups to see the Kanban view, but it still is showing the view to the unwanted group.

 

Another method that I tried was to inherit the Kanban view and add a groups attribute to the <kanban> tag like this:

<record id="project_kanban_view_inherit" model="ir.ui.view">
            <field name="name">Project Kanban Inherited</field>
            <field name="model">project.project</field>
            <field name="inherit_id" ref="project.view_project_kanban" />
            <field name="arch" type="xml">

                <xpath expr="/kanban" position="attributes">
                    <attribute name="groups">project.group1,project.group2,project.group3</attribute>
                </xpath>

            </field>
        </record>

I thought this would work like the first example that I tried, but it still is showing the Kanban view for the unwanted group.  

Does anyone know how I can hide a view from an unwanted group? Thank you

Avatar
Discard
Best Answer

Hello Eric, sorry if this reply does not answer your original question, I just want to clarify what I have figured out about the field 'groups_id' in the 'ir.ui.view' object.

After reviewing ORM and 'ir.ui.view' sources and their history, I've arrived to the conclusion that its current usage is limited to filter inheriting views (despite the fact that the documentation claims a more general usage):

  1. The field was introduced at Aug 29, 2012
  2. Some hours later, the routine that retrieves the inheriting views and their ids was modified to filter by groups
  3. After the introduction of this field, some inheriting views have been modified to be filtered by groups

After a quick search, I've verified that Odoo official modules only use 'groups_id' in inheriting views, here's another example. If modifying existing views based in groups membership partially suits your needs, you may give a try.

The 'ir.actions.act_window' object also has a 'groups_id' field, but I don't know what is its purpose, you may give a try as well.

If anyone else knows something else about the field 'groups_id' in the 'ir.ui.view' and the 'ir.actions.act_window' objects, please let us know.

Regards,

Marvin

Avatar
Discard