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.

0

Filter begins with and greater or less than

By
Dale
on 1/27/14, 3:53 AM 1,515 views

Good day

Please advise how one might filter partners with additional conditions that are not available in the current filter options. I have a database with a field for number of employees.

I would like to filter for greater or less than a certain number of employees.

I also have other fields that I want to use other conditions for such as: Begins with - i.e. we have segmented using codes such as AYR which equals (A) Highest class client, (Y) Product they buy from us, (R) Cycle they are on. So I want a filter that says Field begins with A

etc etc.

Thanks

0
shashank verma
On 1/27/14, 4:14 AM

Hello Dale

Use domain field in xml file to set your own conditions for filtering

syntax domain="[('field_name,'operator',value]

assume for product module go to product module-> open product_view.xml

<record id="product_search_form_view" model="ir.ui.view">

        <field name="name">product.search.form</field>
        <field name="model">product.product</field>

        <field name="arch" type="xml">

            <search string="Product">
               <field name="name" string="Product" filter_domain="['|',('name','ilike',self),('default_code','ilike',self)]"/>
               <filter string="Services" icon="terp-accessories-archiver" domain="[('type','=','service')]"/>
               <filter string="Consumable" name="consumable" icon="terp-accessories-archiver" domain="[('type','=','consu')]" help="Consumable products"/>
               <separator/>
               <filter string="Can be Sold" name="filter_to_sell" icon="terp-accessories-archiver-minus" domain="[('sale_ok','=',1)]"/>
               <field name="categ_id"/>
               <group expand="0" string="Context...">
                   <field name="pricelist_id" context="{'pricelist': self}" groups="product.group_sale_pricelist"/>
                   <field name="company_id" groups="base.group_multi_company"/>
               </group>
               <group  expand='0' string='Group by...'>
                   <filter string='Category' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'categ_id'}"/>
                   <filter string='Default Unit of Measure' icon="terp-mrp" domain="[]" context="{'group_by' : 'uom_id'}"/>
                   <filter string='Type' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'type'}"/>
                   <filter string='Company' icon="terp-go-home" domain="[]" context="{'group_by' : 'company_id'}" groups="base.group_multi_company"/>
               </group>
            </search>
        </field>
    </record>

here u can add or modify domain .

Thanks Shashank. I am new to this. Could you possibly give me the steps as to where I do this?

Dale
on 1/27/14, 4:29 AM

i have updated my post above, Hope this will help u

shashank verma
on 1/27/14, 9:18 AM

Great that's exactly what we needed. Thanx!!!

Dale
on 1/27/14, 9:24 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: 1/27/14, 3:53 AM
Seen: 1515 times
Last updated: 3/16/15, 8:10 AM