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

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

By
Michael Thomas
on 12/9/14, 2:54 PM 983 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"/>
                </tree>

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: 

[('qty_available','>=',1)]

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
0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
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.

0
Eric
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>

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