Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Search product name with different patterns in OpenERP(Odoo)?

    • 0
    • 2
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 449
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: