Odoo Help


How to set search default filter on quantity available in product search view module?

Abegail Sanchez
on 9/8/14, 1:07 AM 1,902 views

I want to show only the products that has quantity

but this doesn't work:

my search view:

 <record model="ir.ui.view" id="product_search_form_custom">
        <field name="name">product_search_form_custom</field>
        <field name="model">product.product</field>
        <field name="inherit_id" ref="product.product_search_form_view" />
        <field name="type">search</field>
        <field name="arch" type="xml">
            <field name="name" position="before">
                <filter string="Has Quantity" name="qty_avail" domain="[('qty_available','!=',0)]"   />


my action:

<record model="ir.actions.act_window" id="action_product_custom_form">
            <field name="name">Products</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">product.product</field>
            <field name="view_type">form</field>
            <field name="context">{'search_default_qty_avail':True}</field>
           <field name="search_view_id" ref="product_search_form_custom"/>
            <field name="view_id" ref="product_search_tree"/>


Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

On 9/8/14, 3:37 AM

Is your field "qty_avail" a functional one? is it stored to database ?

If it is saved in the database then it will work without changes...

But if it is a functional field where value is not stored in database, then you must write "fnct_search" attribute.. which will help in search process....

Check this Doc: Functional Fields

About This Community

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


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 9/8/14, 1:07 AM
Seen: 1902 times
Last updated: 3/28/17, 4:15 AM