Odoo Help


Auto-completion - Odoo 8

Alejandro Perez Cosio
on 1/5/15, 3:19 PM 1,626 views


On sales order, I would like to select a partner from the select box by start typing its phone number.
How can I do that?

Thank you in advance!


Atul Arvind

--Atul Arvind--
| 3 3 5
vadodara, India
--Atul Arvind--


I am odoo Enthusiast/Developer from Vadodara, India. Working with odoo from v5 to v11 and other opensource technology since 5+ years. Having Strong Expertise in

Odoo Development

Odoo Customization

Odoo Training

Odoo Integration

Server Administration

Odoo Migration


Here is my StackOverflow profile.  you can also find me on LinkedIn.

Contact: atul.surficle@gmail.com.

Atul Arvind
On 1/6/15, 4:44 AM

_name_search method will allow to customize the search based on other field.
to search based on phone filed you need to override the method of res_partner like

    def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
        if not context: context={}
        res = super(res_partner, self). name_search(cr, user, name, args=args, operator=operator, context=context, limit=limit)
        if name:
            ids = self.search(cr, user, [('phone','=',name)]+ args, limit=limit, context=context)
        if ids:
            res = self.name_get(cr, user, ids, context=context)
        return res
it will give you partner when you search related partner phone.

@Atul, it is more performant if you just add the args before calling the super. Then, it will only search once. Also, I think you shouldn't return the return of name_get.

on 1/6/15, 6:25 AM



| 5 3 6
Jakarta, Indonesia
On 1/6/15, 4:12 AM

You need to enhance the name_search method of res.partner to also search the phone number field.  You may want to enhance the name_get method as well to display the phone number field.

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

3 follower(s)


Asked: 1/5/15, 3:19 PM
Seen: 1626 times
Last updated: 5/21/16, 1:51 PM