帮助

2

Attribute list of hide export list, filter list, group by list in fields_get

Avatar
andy

After looking all over the internet (google included)

Combining this answers:

https://www.odoo.com/id_ID/forum/help-1/question/how-to-remove-field-from-the-measures-dropdown-in-pivot-and-graph-view-100340

and

https://www.odoo.com/de_DE/forum/hilfe-1/question/hide-fields-from-filter-in-odoo-12-171219

this is how i hide them:

@api.model
def fields_get(self, fields=None):
    hide = ['fieldname1','fieldname2']
    hide1 = ['fieldname3']
    hide2 = ['fieldname4']
    res = super(ClassName, self).fields_get()
    for field in hide:
        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
    for field in hide1:
        res[field]['exportable'] = False # to hide in export list
    for field in hide2:
        res[field]['selectable'] = False # to hide in Add Custom filter view
        res[field]['sortable'] = False # to hide in group by view
        res[field]['store'] = False # to hide in 'Select Columns' filter in tree views
    return res

was looking this for i don't know how long... 

but the question is from where do you get the attribute list? selectable, exportable...

头像
丢弃
1答案
1
Avatar
Nicky Treuter
最佳答案

Hi Andy,

in Odoo 14 the option 'exportable' is not defined but is checked in the function "fields_get" from the file "odoo/addons/web/controllers/main.py"

Following values are the default available options from an field in Odoo 14:

'change_default': Boolean,
'company_dependent': Boolean,
'depends': ...,
'manual': Boolean,
'readonly': Boolean,
'related': ...,
'required': Boolean,
'searchable': Boolean,
'sortable': Boolean,
'store': Boolean,

1备注
头像
丢弃
Avatar
andy
-

Hi Nick, thank you for replying