Skip to Content
Menu
This question has been flagged

Till now we used to toggle 'selectable' property of fields to manage what fields are shown in the 'Add Custom Filter' fields list. But seems like in Odoo 15 this property isn't controlling this feature anymore! Anybody else faced the issue? Is there any other way we can do the same now?


            res[field]['selectable'] = False # to hide in Add Custom filter view
            res[field]['sortable'] = False # to hide in group by view
            res[field]['exportable'] = False # to hide in export list
            res[field]['store'] = False # to hide in 'Select Columns' filter in tree views

Thanks in advance

Avatar
Discard
Author

but setting this to false isn't hiding the field from custom filter list apparently

Author

in fact only these properties are available for fields in fields_get function
{
'type': 'char',
'change_default': False,
'company_dependent': False,
'depends': (),
'manual': False,
'readonly': False,
'required': False,
'searchable': True,
'sortable': True,
'store': True,
'string': 'Email',
'translate': False,
'trim': True,
'name': 'submitted_email'
}

Dynamic Add Custom Filter Menu Visibility | Remove Add Custom Filter Menu | Disable Add Custom Filter Menu | Control Access by User Group
This module allows administrators to hide or show the "Add Custom Filter" menu based on user groups, ensuring that only authorized users can apply advanced search filters.
https://apps.odoo.com/apps/modules/16.0/mh_hide_add_custom_filter

Best Answer

    @api.model

    def fields_get(self, allfields=None, attributes=None):

        res = super().fields_get(allfields, attributes)

        hide_list = [ 'field_1',  'field_2',  'field_3']

        for field in hide_list:

            if res.get(field):

                res[field]['searchable'] = False

        return res


Avatar
Discard
Best Answer

Great its working. But the Group By Custom filter its not hiding the field.

Avatar
Discard
Related Posts Replies Views Activity
2
Mar 24
873
1
Nov 21
3400
5
Mar 25
15078
1
May 23
1305
5
Mar 25
13016