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.

0

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

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

As in subject.

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

Already tried use domain:

ex:

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
0

Tarek Mohamed Ibrahim

--Tarek Mohamed Ibrahim--
896
| 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.

https://www.linkedin.com/profile/public-profile-settings?trk=prof-edit-edit-public_profile

tibrahim@2p.com.sa

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

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

2 follower(s)

Stats

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