تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
23157 أدوات العرض

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.

الكاتب

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.

The menu Sale Orders have that group by default

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>
أفضل إجابة

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?

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

check the update in the answer

الكاتب

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

Happy to help

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

I tried this way no effect..

أفضل إجابة

hey guys , i want to delete a group from an existing menuitem, i used this code
<record id="stock_menu_inherited" model="ir.ui.menu">
<field name="name">Stockfield>
<field name="parent_id" ref="stock_account.menu_valuation"/>
<field name="groups_id" eval="[(3, ref('base.group_no_one'))]"/>
record>
but it didnt work



الصورة الرمزية
إهمال

it worked using this code
<record id="stock_account.menu_valuation" model="ir.ui.menu">
<field name="groups_id" eval="[(3, ref('base.group_no_one'))]"/>
</record>

أفضل إجابة

I also faced this issue to replace the existing group on the menu and it was solved by following.

To replace existing groups use "[(6,0,[group])]"

                            
        

 

     


الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
3
أبريل 17
3971
1
فبراير 24
1442
3
مايو 19
3094
1
سبتمبر 17
4135
1
يناير 17
6540