Odoo Help


fnct_search new API implementation

on 11/24/14, 12:01 PM 1,368 views

I am trying to implement a custom search method on a field using the following code. However search method (word_search) is never being called(using Advanced Search). I tried to go through the new api docs and have tried to model the method in a similar way. Not sure what is going wrong here.

class myclass(models.Model):

    _name = "myclass"
    myfield = fields.Char(string='Word', size=100, required=True)


    def word_search(self, operator, operand):
       _logger.info("search function called %s" % operand)
       domain = [('id', 'in', ids)]
       return domain  # e.g. [('id', 'in', ids)]

    searchfield = fields.Text(compute = "anothermethod", store='False', string="Match Expression", search='word_search')

Any ideas please. Why isnt this method being called

on 11/24/14, 10:56 PM

Have you tried removing @api.model ? Since this is your own class, you don't need to make your function available to the old api, so @api.model is not required. Just to check: you made your advanced search on "searchfield" not on "myfield", right?

on 11/25/14, 3:22 AM

Thanks. This is fixed. Changing store='False' to store=False fixed this

on 11/25/14, 4:22 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 11/24/14, 12:01 PM
Seen: 1368 times
Last updated: 3/16/15, 8:10 AM