Skip to Content
Menu
This question has been flagged
2 Replies
4954 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)]"   />
            </field>
        </field>
    </record>

 

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"/>
        </record>

Avatar
Discard
Best Answer

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

Avatar
Discard