Skip to content
Advertisement

Odoo. Hide some options in field selection

I have some selection field in my model. Here example:

JavaScript

In some cases I need hide specific options in selection(or radio buttons). How I can do this properly?

Below screen from base calendar module which can more explain about my problem.

enter image description here

Thanks in advance.

Advertisement

Answer

I found the solution.

First of all we need to create custom widget for FieldSelection. Here example(path_to_your_module/static/src/js/form_widgets.js):

JavaScript

After this you need just set your widget to field in your view like this:

JavaScript

If you don’t know how to include static of your module HERE example which can help you.

I hope this helps someone ;)

Advertisement