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.

6

change search behavior

By
Andreas Maertens
on 8/29/13, 11:39 AM 4,125 views

Hi everybody,

is there a way to change standard search behavior? The users expectations of a search field are different from what OpenERP does as I think. Whenever I confront a user with this behavior he tells me that it's strange.

If I type in search fields stuff like "Mainboard | Asus" I expect to find all names with "Mainboards" and "Asus". You all know I find all Names with "Mainboards" and all Names with "Asus".

I know about the possibility to use advanced searches but changing that behavior will serve customers expectations and make working with openerp easier.

Does anyone knows a way to change that? Couldn't find something in expressions.py or orm.py

Thanks in advance

Thanks Ray, that sounds like a handy solution.

Andreas Maertens
on 8/30/13, 6:56 AM

how can be change the advance search labels ; eg: Active is changed to Present where did i edit the view

Ashmsh.M
on 11/27/13, 5:54 AM

I've found the source handle the "OR" behavior. In "web/addons/web/source/src/js/search.js" search for " if (domains.length === 1) { return domains[0]; } for (var i = domains.length; --i;) { domains.unshift(['|']); }"

Andreas Maertens
on 12/6/13, 6:02 AM

Thank you, that looks very interesting.

Andreas Maertens
on 12/9/13, 2:59 AM
2

Andreas Maertens

--Andreas Maertens--
912
| 5 5 7
Finsterwalde, Germany
--Andreas Maertens--

I develop odoo8.0 modules

Andreas Maertens
On 8/30/13, 9:29 AM

I could improve search behavior by adding more "search criteria" to the "search.view" In an addon I added following inherited views to improve searches. This is mainly the same as the module of Grover Menacho does but without the dynamic his module provides.

    <record id="rcs_product_search_form" model="ir.ui.view">
        <field name="inherit_id" ref="base.view_res_partner_filter"/>
        <field name="name">res.partner.select</field>
        <field name="model">res.partner</field>
        <field name="arch" type="xml">
            <field name="name" position="before">
               <field name="street2" string="full-text"
                      filter_domain="[
                            '|',('name','ilike',self),
                            '|',('parent_id','ilike',self),
                            '|',('ref','=',self),
                            '|',('street','ilike',self),
                            '|',('street2','ilike',self),
                            '|',('zip','ilike',self),
                            '|',('city','ilike',self),
                            '|',('email','ilike',self),
                            '|',('phone','ilike',self),
                            '|',('fax','ilike',self),
                            '|',('mobile','ilike',self),
                            '|',('lang','ilike',self),
                            '|',('website','ilike',self),
                            '|',('country_id.name','ilike',self),
                            ('ean13','ilike',self)
                            ]" />
            </field>
            <field name="name" position="after">
                <field name="parent_id" filter_domain="[('parent_id','ilike',self)]"/>
                <field name="ref" filter_domain="[('ref','ilike',self)]"/>
                <field name="street" filter_domain="['|',('street','ilike',self),('street2','ilike',self)]"/>
                <field name="zip" filter_domain="[('zip','ilike',self)]"/>
                <field name="city" filter_domain="[('city','ilike',self)]"/>
                <field name="email" filter_domain="[('email','ilike',self)]"/>
                <field name="phone" filter_domain="[('phone','ilike',self)]"/>
                <field name="fax" filter_domain="[('fax','ilike',self)]"/>
                <field name="mobile" filter_domain="[('mobile','ilike',self)]"/>
                <field name="lang" filter_domain="[('lang','ilike',self)]"/>
                <field name="website" filter_domain="[('website','ilike',self)]"/>
                <field name="country_id" filter_domain="[('country_id.name','ilike',self)]"/>
                <field name="ean13" filter_domain="[('ean13','ilike',self)]"/>
            </field>
        </field>
    </record>

and

        <record id="rcs_product_search_form_view" model="ir.ui.view">
        <field name="inherit_id" ref="product.product_search_form_view"/>
        <field name="name">product.search.form</field>
        <field name="model">product.product</field>
        <field name="arch" type="xml">
            <field name="name" position="before">
               <field name="description" string="full-text"
                      filter_domain="[
                            '|',('name','ilike',self),
                            '|',('description','ilike',self),
                            '|',('default_code','ilike',self),
                            '|',('seller_id','ilike',self),
                            '|',('seller_product_code','ilike',self),
                            '|',('description_sale','ilike',self),
                            ('producer_id.name','ilike',self),
                            ]" />
            </field>
            <field name="name" position="after">
                <field name="default_code" filter_domain="[('default_code','ilike',self)]"/>
                <field name="seller_id" filter_domain="[('seller_id','ilike',self)]"/>
                <field name="seller_product_code" filter_domain="[('seller_product_code','ilike',self)]"/>
                <field name="description_sale" filter_domain="[('description_sale','ilike',self)]"/>
                <field name="producer_id" filter_domain="[('producer_id','ilike',self)]"/>
            </field>
        </field>
    </record>
2

Grover Menacho

--Grover Menacho--
2523
| 5 7 8
La Paz, Bolivia
--Grover Menacho--

Systems Engineer + MBA

Grover Menacho
On 8/29/13, 3:04 PM

Hello.

I'm starting with Launchpad so I'm not sure if I did it well anyways you can find a module that improves search of products here:

https://code.launchpad.net/~hmen/openobject-poiesis/extra-addons-poiesis

I hope this can help you.

Thanks for your module. It really improves search a bit and I have some additional ideas, but it doesn't solve the probleme I talked about. The general search still is with an 'and'.

Andreas Maertens
on 8/30/13, 6:55 AM

After thinkin about your module I must say it does solve the Problem in a way. It helps me to find arguments for the existing solution in openerp and I think with your model and the standard behavior this may be the optimal solution. ty

Andreas Maertens
on 8/30/13, 9:31 AM

Yes, but I think I misunderstood your requirement, my module helps you to add fields to search but that was not the principal purpose, it helps you when you are searching a product in a sale order for example, you can write two words separated and you can find the product inmediately. For example 'Coca Cola Light' you only have to write 'Coc Lig' and it's going to find it. Basically it was to help in sale orders, anyways it can be improved a lot even in the search box adding some 'and' or 'or'.

GH Mediacloud, Grover Menacho
on 8/30/13, 10:57 AM

Do you have any idea where to find that functionality? I am looking for since hours.

Andreas Maertens
on 9/2/13, 9:12 AM

I don't think that some functionality like that exists, anyways I'll do it by the same method as I did this module. Only parsing some elements that is not really complicated you'll have a searchbox that can do what you want.

GH Mediacloud, Grover Menacho
on 9/2/13, 10:48 AM
0
brami
On 11/30/16, 3:34 AM

HELLO i know this post is not from now but i wanted to know if you have found a sloution because i am faced to the same problem

thanks a lot

Sorry, we still have no easy way to do that.

Andreas Maertens
on 11/30/16, 5:01 AM
0

Ahmet Altinisik

--Ahmet Altinisik--
2137
| 8 7 10
ANKARA, Turkey
--Ahmet Altinisik--

http://www.altinkaya.eu

Ahmet Altinisik
On 6/25/14, 1:07 PM

And I found https://www.openerp.com/apps/7.0/web_filter_and_condition/ - but haven't tested yet!

0
fisher
On 6/23/14, 4:36 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

2 follower(s)

Stats

Asked: 8/29/13, 11:39 AM
Seen: 4125 times
Last updated: 11/30/16, 3:34 AM