How To Make Fields Readonly Or Invisible In Odoo

In the previous article, we described how to restrict access to menu items in Odoo. But sometimes you just need to hide or make readonly one or several fields on the view without hiding a menu. For now, there is no way to do this using Odoo interface and you will have to write a code.

For a good amount of reasons, you better not to change Odoo source code. So, you need to create a new module where create a View, provide an appropriate inheritance, redefine necessary fields, and preferable to create a new XML ID. This work requires special qualification and knowledge of Odoo code, and is unlikely to be suitable for ordinary Odoo users.

Specially for users, we developed the Generic Security Restriction addon.

This addon allows to:

  • Hide menus by security groups

  • Restrict menus from specific users

  • Hide specific fields of the selected model from certain security groups

  • Make fields readonly for certain security groups

And here are some examples of hiding and making fields readonly using our module:

To hide the field, you need to activate the Developer Mode. Then, click Database Structure -> Models and select the desired model. On the Fields Security tab, specify the fields to hide and user security groups to hide from.

Same operations to make fields readonly, but select the Set Readonly check box.

How To Hide Menus In Odoo