Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

How to hide a view type from a group?

By
Eric
on 11/17/14, 1:38 PM 1,291 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

1
Marvin Taboada
On 11/18/14, 4:14 PM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 11/17/14, 1:38 PM
Seen: 1291 times
Last updated: 8/12/15, 10:42 AM