Odoo Help


Need to Hide Menu Item Based on the Field condition

on 7/21/14, 3:14 AM 1,523 views

A boolean field created in res_users, if that boolean field is True for the user logged in, the Supplier menuitem Should be visible... if False need to hide the Suppliers Menu


René Schuster

--René Schuster--
| 5 5 8
Weinheim, Germany
--René Schuster--

Challenge Everything!

René Schuster
On 7/21/14, 4:27 AM

The visibility of menuitems is set via the groups tag.

You could add a group for your suppliers and use an on_change method to add or remove the group when the boolean field is changed.

XML snippets:

<menuitem name="supplier_menu" string="Supplier Menu" groups="my_model.supplier_group" action="menu_action"/>

<field name="is_supplier" on_change="onchange_is_supplier(is_supplier)"/>


def onchange_is_supplier(self, cr, uid, ids, is_supplier):
    supplier_group_id = self.pool.get('ir.model.data').get_object(cr, uid, 'my_model', 'supplier_group').id
    if is_supplier:
        result = {'value': {'groups_id': [(4, supplier_group_id)]}};
        result = {'value': {'groups_id': [(3, supplier_group_id)]}};
    return result;



About This Community

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


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/21/14, 3:14 AM
Seen: 1523 times
Last updated: 6/23/15, 4:43 PM