odoo中tree 视图中的筛选、分组里添加自定义时能不能不加载全部字段?求指导
已解决
Odoo 新手求助
-
@api.model def fields_get(self, allfields=None, attributes=None): # 筛选 - 添加自定义筛选 - ID 自定义显示字段 res = super(Course, self).fields_get(allfields=allfields, attributes=attributes) # 不想显示的字段 fields_not_search = ['id', 'name', 'session_ids', 'create_uid', 'create_date', 'write_uid', 'write_date'] for field in fields_not_search: # 筛选 res[field]['searchable'] = False # 分组 res[field]['sortable'] = False return res
-
@api.model def fields_get(self, allfields=None, attributes=None): # 筛选 - 添加自定义筛选 - ID 自定义显示字段 res = super(Course, self).fields_get(allfields=allfields, attributes=attributes) # 不想显示的字段 fields_not_search = ['id', 'name', 'session_ids', 'create_uid', 'create_date', 'write_uid', 'write_date'] for field in fields_not_search: # 筛选 res[field]['searchable'] = False # 分组 res[field]['sortable'] = False return res