Step-1 Install multi_search module.
Step-2 inherit = 'product.product' class in .py(Python file) in multi_search module.
In below example, I have custmozied .py file. You can directly copy the below python code in multi_search module -
class product_product_override_search(osv.osv):
''' Override search function
'''
_name='product.product'
_inherit = 'product.product'
new_args = []
for search_item in args:
if len(search_item) == 3 and search_item[0] == 'name':
multi_search = search_item[2].split(split_element)
if multi_search > 1:
total_split = len(multi_search)
for i in range(0, total_split):
if i != total_split - 1:
new_args.append("&")
new_args.append(('name', 'ilike', multi_search[i]))
else:
new_args.append(search_item)
else:
new_args.append(search_item)
return super(product_product_override_search, self).search(cr, user, new_args, offset, limit, order, context, count)
0 Comment(s)