Odoo Help


How can I hide menu depending on .. who is logged in :SOLVED

Dr Obx
on 8/25/15, 7:02 AM 683 views

As in subject.

How can I hide menu depending on what is user department_id ?

Already tried use domain:


domain="[('department_id', '=', Warehouse)]"
filter_domain="[('department_id', '=', Warehouse)]"

but ....

File "lxml.etree.pyx", line 3027, in lxml.etree._Validator.assert_ (src/lxml/lxml.etree.c:129517)
AssertionError: Invalid attribute filter_domain for element menuitem, line 226

no luck.

This is totally wrong question. Please double check your question. You can never hide menu depending on data. I think you want to know, how to hide data based on department_id ?

Emipro Technologies Pvt. Ltd.
on 8/25/15, 7:48 AM

Question is actually correct. How can i hide menu depending on department_id. So if user working on Warehouse is logged in selected menu should appear or disappear. In this case Menu for Warehouse should be displayed. How can I do it then ?

Dr Obx
on 8/25/15, 7:51 AM

Tarek Mohamed Ibrahim

--Tarek Mohamed Ibrahim--
| 5 3 7
Gîza, Egypt
--Tarek Mohamed Ibrahim--

I am an old VFP developer on ERP

I have moved to 2p since Nov-2014 and started developing with Python on Odoo.



Tarek Mohamed Ibrahim
On 8/25/15, 8:13 AM

via groups.

Actually, menu definition is as follows

 <menuitem id="menu_act_for_warehouse" action="act_for_warehouse" sequence="2" parent="some_parent_id"/> 

Where 'act_for_warehouse' is the action id that call a specific view.

You have to define a group for all users in department A, say. You have after that to rewrite the menu definition as follows

<menuitem id="menu_act_for_warehouse" action="act_for_warehouse" sequence="2" parent="some_parent_id" groups="your_module_name.group_for_department_a"/>

This menu will be seen only by the users in the group 'group_for_department_a', and other users won't see it. This is the most trivia solution even it requires double work. I mean, you have to add users to department and add them also to the group that is related to this department.

I think one can invent other solution that avoid double work. Try this first and let us see.

OK, done, created groups, assigned users to the groups and it works beautifully :)

Dr Obx
on 8/25/15, 9:22 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 8/25/15, 7:02 AM
Seen: 683 times
Last updated: 8/25/15, 11:49 AM