This question has been flagged
1 Reply
5331 Views

Working on Windows.

I am trying to search reference/default_code of products from the sale order line without considering the case but only searching the beginning of each reference. similar to searching LIKE 's%' in sql. At the moment OpenERP search LIKE '%s%' is it possible to have a code that ---

    get product_id in product.product 
    for default_code (that is reference) like ? (search+'%',)

I want to apply this to sales order line for getting the products. Please anyone help. thanks Also I should say all products have unique reference (default_code) and we only search by these. So I would be glad if anyone could suggest how I can make the search look in the reference only rather than both reference and product name. Thank you in advance. python code:

def onchange_case(self, cr, uid, ids, default_code):
    result = {'value': {
        'default_code': str(default_code).upper()
        }
    }
    return result

xml code:

           <field name="default_code" on_change="onchange_case(default_code)"/>
Avatar
Discard
Best Answer

use the lower() or upper() function to format the user input.

This will require your database to be uniformly upper or lower case, but that is easier to control than user input.

Avatar
Discard
Author

thanks but unfortunately the database is already live and doing this will be lots of work, all old orders and moves may require changes too