Odoo Help


Autocomplete the field in Python

on 9/9/15, 4:57 AM 734 views

I have a field called 'name' the data which are entered in 'name' are going to the database. Whenever i want to enter a new name for example 'hello' it should show the related words which are starting from 'he'.

I am new to Python. How can we do this? I have written a function for this.


def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100): 
if not args:
args = []
if context is None:
context = {}
ids = []
name = name + '%'
cr.execute("select name from learner_info where name like %s", (name,))
ids = cr.dictfetchall()
return self.name_get(cr, uid, ids, context)


<field name="name" on_change="name_search(name)"/>

How to call this function in field?

I don't know how to accomplish this task, but I think you also need some javascript along with python code

Tarek Mohamed Ibrahim
on 9/9/15, 6:01 AM

should i create another table/class for that field? I need it for particular object.

on 9/9/15, 6:10 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

1 follower(s)


Asked: 9/9/15, 4:57 AM
Seen: 734 times
Last updated: 9/9/15, 6:10 AM