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
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
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)"/>
.py:
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)]}};
else:
result = {'value': {'groups_id': [(3, supplier_group_id)]}};
return result;
Regards.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up