Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
3 Odpowiedzi
23248 Widoki

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

Awatar
Odrzuć

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.

Autor

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>
Najlepsza odpowiedź

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

Awatar
Odrzuć
Autor

@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

Autor

@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

Autor

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

Najlepsza odpowiedź

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



Awatar
Odrzuć

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>

Najlepsza odpowiedź

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])]"

                            
        

 

     


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
3
kwi 17
4112
1
lut 24
1504
3
maj 19
3144
1
wrz 17
4184
1
sty 17
6622