You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

23 lines
685 B

# Copyright 2019 Onestein
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class IrFilters(models.Model):
_inherit = 'ir.filters'
facet = fields.Text()
@api.model
def get_filters(self, model, action_id=None):
res = super().get_filters(model, action_id)
ids = map(lambda f: f['id'], res)
# Browse filters that are in res
filters = self.browse(ids)
for i, res_filter in enumerate(res):
# Add the field 'facet' to the result
res[i]['facet'] = filters.filtered(
lambda f: f.id == res_filter['id']
).facet
return res