Odoo Help


Why won't domain filtering work on my product.product view?

Michael Thomas
on 12/9/14, 2:54 PM 1,420 views

In order to provide warehouse access to my portal users, I created a view of the product.product model:

<?xml version="1.0"?>

<tree colors="red:virtual_available&lt;0;blue:virtual_available&gt;=0 and state in ('draft', 'end', 'obsolete');black:virtual_available&gt;=0 and state not in ('draft', 'end', 'obsolete')" string="Products">
                    <field name="default_code"/>
                    <field name="name"/>
                    <field name="categ_id" invisible="1"/>
                    <field name="type" invisible="1"/>
                    <field name="variants" groups="product.group_product_variant"/>
                    <field name="uom_id" string="Unit of Measure" groups="product.group_uom"/>
                    <field name="qty_available"/>
                    <field name="virtual_available"/>
                    <field name="lst_price"/>
                    <field name="price" invisible="not context.get('pricelist',False)"/>
                    <field name="standard_price" invisible="1"/>
                    <field name="state"/>
                    <field name="company_id" groups="base.group_multi_company" invisible="1"/>

I then gave my portal users access to the required models. They can see all the approriate products. I now want to filter that view to remove products where qty_available is less that 1. I have put the following in the domain value for the filter on the window action: 


I have the filter check box selected. 

Why is there no filtering taking place on the model? Alternatively, can I not filter by a calculated field like qty_available?




Edited this post Eric, as I don't have Karma to comment on your Answer yet. I tried adding that line to my view, but only received an error.

Michael Thomas
on 12/9/14, 3:19 PM

Specifically, I am getting an invalid xml error. The syntax on my xml views is a single tag, (sans your closing tag), so I am thinking maybe we are dealing with different versions of Odoo. I am on version 7.

Michael Thomas
on 12/9/14, 3:26 PM



| 5 3 6
Jakarta, Indonesia
On 12/9/14, 10:50 PM

qty_available and virtual_available are function fields that are not stored and don't have fnct_inv function so basically they cannot be used in domain or search or anything that requires the construct of WHERE SQL clause on them.

On 12/9/14, 3:08 PM

did you try adding this line in your view?

using the greater than symbol is what the problem is. update the next line and see if this works

<field name="domain">[('qty_available','&gt;=',1)]</field>

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: 12/9/14, 2:54 PM
Seen: 1420 times
Last updated: 3/16/15, 8:10 AM