For fields of type function
or compute
you have two options:
1) Either give the field the attribute store=True
so that the calculated values are saved on the database
2) Or even better provide your own search
method that will do the searching and apply the domain.
How you will do the above depends on the version of Odoo that you are using. Take a look at the documentation on odoo/fields.py
on field class. Use the search parameter on the field definition:
One can define a field whose value is computed instead of simply being
read from the database. The attributes that are specific to computed
fields are given below. To define such a field, simply provide a value
for the attribute ``compute``.
:param compute: name of a method that computes the field
:param inverse: name of a method that inverses the field (optional)
**:param search: name of a method that implement search on the field (optional)**