Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
16 Odpovědi
16385 Zobrazení

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

Avatar
Zrušit
Autor

Thanks Ray, that sounds like a handy solution.

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

Autor

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(['|']); }"

Autor

Thank you, that looks very interesting.

Hello Andres,

You can change search behaviour , override def _search method .

Thanks,

Autor Nejlepší odpověď

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>
Avatar
Zrušit
Nejlepší odpověď

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.

Avatar
Zrušit
Autor

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'.

Autor

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

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'.

Autor

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

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.

Nejlepší odpověď

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

Avatar
Zrušit
Autor

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

Nejlepší odpověď

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

Avatar
Zrušit
Nejlepší odpověď
Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
8
čvc 24
16350
0
dub 15
4072
3
bře 15
11005
2
bře 15
5755
0
bře 15
8457