This question has been flagged
2 Replies
4129 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?

 

 

 

Avatar
Discard
Author

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.

Author

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.

Best Answer

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.

Avatar
Discard
Best Answer

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>

Avatar
Discard