Odoo Help

Welcome!

This community 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.

1

How to Search for product references only in Order line

By
kaynis
on 12/10/13, 1:09 PM 1,657 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)"/>
1

AJ Schrafel Paper Corp

--AJ Schrafel Paper Corp--
2060
| 4 5 8
Bronx, United States
--AJ Schrafel Paper Corp--

Exploring OpenERP for business

AJ Schrafel Paper Corp
On 12/10/13, 2:35 PM

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.

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

kaynis
on 12/12/13, 9:49 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 12/10/13, 1:09 PM
Seen: 1657 times
Last updated: 7/11/16, 5:56 PM