This question has been flagged
2 Replies
3255 Views

Version: 10 Community
module: stock_account
model: stock.history (report)


How can I have filter for showing only positive values?

Tried:

<filter name="positive" string="Positive" domain="[('inventory_value', '&gt;', 0.0)]"/>

but inventory_value is calculated field and cannot use it in filter

<filter name="positive" string="Positive" domain="[('quantity', '&gt;', 0.0)]"/>

is wrong because it needs to be the SUM of quantity > 0

Avatar
Discard

Give store=True for the field and see

Best Answer
Hello,

You just need to write this domain in different way.

domain="[('qty', '&gt;', 0.0)]"
Just update domain with  Qty instead of value. Cost won't be negative. If the qty is negative then you will get inventory value negative.
Avatar
Discard

If so there is default filter named possitive

Author

well I tried this already but it is wrong because the quantity is the sum of all the quantities from all the moves belonging to the product (sum of all negative and positive quants). So this filter will remove the negatives and so the resulting quantity will be wrong. As I said you need the SUM of the qty to be > 0

Author

Please note that this is about "Inventory at Date" report and not the "Inventory valuation" where you have predefined Positive and Negative filters but the data is pulled in a different way so "qty>0" works there