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

Correct way to modify existing menuitems their groups and position?

By
Yenthe
on 11/17/15, 6:01 AM 1,232 views

Hi guys,

I've been trying for a while to do this correctly now but couldn't find a correct way that does exactly what it should. The default menuitem 'Quotations' under Sales > Quotations should only be accessible for the group 'group_sale_manager' only and the same thing should be done for the menuitem 'Sales Orders' under Sales. My last attempt:

 <menuitem name="Quotations" 
id="sale.menu_sale_quotations"
parent="base.menu_sales"
groups="base.group_sale_manager"/> <menuitem name="Sales Orders" id="sale.menu_sale_order" parent="base.menu_sales" groups="base.group_sale_manager"/>

Somehow this seems to work for Quotations but not for Sales Orders. What am I doing wrong or missing? Another thing that I was wondering is how to move an existing menuitem ('Customers' under Sales) to another section in the sale module. I've created a new menuitem:

<!--Creates a new top menuitem named 'SEL' --> 
<menuitem id="base.menu_sel" name="SEL" parent="base.menu_base_partner" groups="aa_module.group_sel_manager" sequence="1"/>

So how do I move the menuitem 'Customers' under the menuitem 'SEL' in place of under 'Sales'?

Thanks,
Yenthe

Remember to always check your modification on account othr than Admin. Admin is sees everything so, create new users with and without group_sale_manager access rights, and then check if everything works.

devza
on 11/17/15, 6:41 AM

Thanks for your response Tobiasz. It does seem to work for the menuitem Quotations but not for Sales Orders but I don't know why. It is exactly the same code.

Yenthe
on 11/17/15, 7:27 AM

The menu Sale Orders have that group by default

Axel Mendoza
on 11/17/15, 7:49 AM
3

Axel Mendoza

--Axel Mendoza--
10308
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 11/17/15, 7:45 AM

I copy and paste your menuitem def and the Quotations menu get the group ok, as @Tobiasz saids check agains a user that doesn't have the group. You could also try this way:

<record model='ir.ui.menu' id='sale.menu_sale_quotations'>
<field name="groups_id" eval="[(4,ref('base.group_sale_manager'))]"/>
</record>

Also you need to check that the user that you are using to test this does not have a group assigned that inherit from base.group_sale_manager

For the menu position all depends of the sequence field so if you vary the value of that field to a value lesser than or higher than another menu sequence value the menu will be moved.

Always after a change in the menus you need to refresh the page because the menu need to reload

Hope this helps

=================================update========================================

The menu for sale orders by default have defined the groups: "base.group_sale_salesman" and "base.group_sale_manager". To left only the group "base.group_sale_manager" redefine it like this in your module:

<menuitem name="Sales Orders" id="sale.menu_sale_order" parent="base.menu_sales" groups="-base.group_sale_salesman"/>

Notice the - sign before the group name

@Axel thanks for your answer! the thing is that the 'Quotations' menuitem is indeed gone but somehow it doesn't work for the 'Sales Orders' and I have no idea why. I'm testing this on a new user with just the rights 'user' for sales. Could you give my second menuitem a try too please?

Yenthe
on 11/17/15, 7:52 AM

The default menu definition in the sale module have this two groups by default:
base.group_sale_salesman
base.group_sale_manager
You don't need to define it again

Axel Mendoza
on 11/17/15, 7:55 AM

@Axel it should only be accessible for the users in the group 'base.group_sale_manager' and not for 'base.group_sale_salesman' as it is by default.

Yenthe
on 11/17/15, 7:58 AM

check the update in the answer

Axel Mendoza
on 11/17/15, 8:09 AM

That is amazing! I didn't even know you could invoke access rights with the '-'! Accepted & upvoted, thanks Axel.

Yenthe
on 11/17/15, 8:29 AM

Happy to help

Axel Mendoza
on 11/17/15, 7:07 PM

Hi Axel I try as per your code.... not working ...I need this same scenario

Odoo
on 4/13/16, 1:33 AM

I tried this way no effect..

Odoo
on 4/13/16, 1:37 AM
Odoo
on 4/13/16, 1:39 AM
0

Odoo

--Odoo --
1328
| 5 2 5
kerala, India
--Odoo --

Working as a Odoo Functional and Technical Expert

Odoo
On 4/13/16, 1:40 AM

I tried like axel suggestion but not changing........


<record model='ir.ui.menu' id='sale.menu_sale_quotations'>     <field name="groups_id" eval="[(4,ref('base.group_sale_salesman'))]"/></record>      <record model='ir.ui.menu' id='sale.menu_sale_order'>     <field name="groups_id" eval="[(4,ref('base.group_sale_salesman'))]"/></record>

Hi Dep. Yours it's not the same scenario described in the solution of this thread

Axel Mendoza
on 4/17/16, 11:15 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

3 follower(s)

Stats

Asked: 11/17/15, 6:01 AM
Seen: 1232 times
Last updated: 4/13/16, 1:40 AM