Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
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!!
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!
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?
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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 10/14/15, 7:59 AM|
|Seen: 934 times|
|Last updated: 3/28/17, 4:14 AM|