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

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

By
Abegail Sanchez
on 9/8/14, 1:07 AM 1,107 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>

0

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

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

deep
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

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

1 follower(s)

Stats

Asked: 9/8/14, 1:07 AM
Seen: 1107 times
Last updated: 3/16/15, 8:10 AM