Odoo Help


How to modify the product search when creating a new quotation?

Ahmed Ababneh
on 10/14/15, 7:59 AM 1,044 views


We need to modify the product search behavior in the "New" quotation page. We need to make it faster, because we have a lot of products (more that 10 millions)

In the "Quotations" page, when the user creates a new quotation and adds a new order line and starts typing in the "Product field", Odoo starts searching automatically while the user is typing. Odoo searches in all the products and takes very long time to respond while the user is typing in the "Product" field.

I have overridden the "product_id_change" method of the "sale.sale_order" class and changed it. However, it did not work!

In order to make the product lookup faster, I want Odoo to get only the product(s) that have "default_code" equal to the value entered in the product field. There is no need to search in other fields such as the product name. How can I achieve this?

Thanks you a lot!!




| 4 4 6
Hyderabad, India

On 10/14/15, 10:12 AM


Try overriding the name_search() of product_product and in args attribute keep args = [('default_code', 'ilike', name)]:

def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):

    args = [('default_code', 'ilike', name)]

    p_ids= self.search(cr, uid, args, limit=limit, context=context)

    return self.name_get(cr, uid, p_ids, context=context)

Hope it helps!

Thanks my friend ... worked like a charm :)

Ahmed Ababneh
on 10/19/15, 4:45 AM

Axel Mendoza

--Axel Mendoza--
| 7 8 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
On 10/14/15, 3:24 PM

I face this before in OpenERP 7, there is a few steps that improve the search in many2one fields. Check this:


Also I end up modifying the widget to do not trigger the lookup search when the user start typing, just 1sec after the user stop typing. What Odoo version it's affecting you with this?

Thank Axel, I am using Odoo V8. So how did you modify the widget in order not to trigger the lookup search?

Ahmed Ababneh
on 10/18/15, 3:46 AM

In the widget 'instance.web.form.FieldMany2One' on the function render_editable there is delay value for the this.$input.autocomplete() call that in Odoo 8 have the value 200 milliseconds. You could change it to a higher value like 1000 for 1 second. Just create an extension for that widget to change the value

Axel Mendoza
on 10/18/15, 4:29 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: 10/14/15, 7:59 AM
Seen: 1044 times
Last updated: 3/28/17, 4:14 AM