Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Tuesday, December 15, 2015

Odoo: How to inherit menu items (make menu items invisible)

Odoo: How to inherit menu items (make menu items invisible)


I need to remove (or make invisible) a menu item. I guess this should be done with an inherit and xpath.

But I'm not sure which name, model and inherit_id I should use. Where can I find the correct values for these?

I also don't know how to use xpath correctly for this. As far as I know, there are only expressions for pages, groups and fields? (http://www.odoo.yenthevg.com/xpath-expressions-in-odoo-8/)

The menu that has to be removed is Product Variants: enter image description here

In addons/product/product_view.xml I found something that might have to do with it.

Line 1:

  

line 444-446:

  

The way I tried to make the menu item invisible in my own views.xml:

          name">product.prod_config_main      base.menu_product                                                                     

The error it gives:

ParseError: "ValidateError  Field(s) `arch` failed against a constraint: Invalid view definition    Error details:  Element '' cannot be located in parent view    Error context:  View `name">product.prod_config_main`  [view_id: 971, xml_id: n/a, model: base.menu_product, parent_id: 257]" while parsing /root/git/odoo/modulesdewieuw/dewieuw/views.xml:59, near            name">product.prod_config_main          base.menu_product                                                                                                 

Edit: After the tips on making a new group I tried it. I've created a group "verborgenmenus" and added a user to it.

In my xml I just put this, somewhere:

  

It gives me the following error:

    raise ValueError('External ID not found in the system: %s' % (xmlid))  ParseError: "External ID not found in the system: dewieuw.verborgenmenus" while parsing /root/git/odoo/modulesdewieuw/dewieuw/views.xml:34, near    

What is wrong in my code?

Edit: I got it how I wanted by just removing the users from the group Usability/Technical Features.

Answer by ChesuCR for Odoo: How to inherit menu items (make menu items invisible)


You can delete it like this:

  

But it's not recommendable, because maybe some other module is trying to access it. Instead of that you can add it to the admin group to make it invisible for the rest of users:

  

Update:

In your case the id of the menuitem should be id="product.menu_products"

Answer by forvas for Odoo: How to inherit menu items (make menu items invisible)


You can't make a menuitem invisible in Odoo as if it were a field. You must remove it with the delete tag:

  

A way to make it invisible without removing it is to add the attribute groups to the menuitem, and put there a group whose components are only the users who can see the menuitem. If you don't want any user to see it, then create a empty group and assign it that attribute:

  

Answer by BSL Technologies for Odoo: How to inherit menu items (make menu items invisible)


      Hide      Hide.        

You also need to remove "Usability/Technical Features" from this menu..

For that Goto : Settings -> User Interface -> Menu Items. Search : product variants open form view : remove "Usability/Technical Features" from group grid.

Answer by Alessandro Ruffolo for Odoo: How to inherit menu items (make menu items invisible)


Actually, given a menuitem, this is the correct way to hide a menuitem by using an "hiding" group

              Hidden items                                  

This works just fine for me. Of course you can use it also for redefine others of its properties (parent, name, etc...)

Answer by BBBagdiya for Odoo: How to inherit menu items (make menu items invisible)


      Invisible              


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 71

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.