Odoo Help


This community 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.


Autocomplete the field in Python

on 9/9/15, 4:57 AM 323 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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


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