Do not subtract articles in open orders when calculating quantity.
This commit is contained in:
parent
5032fbb63d
commit
6bf3b241e6
1 changed files with 1 additions and 1 deletions
|
@ -16,7 +16,7 @@ class StockArticle < Article
|
|||
# Check for unclosed orders and substract its ordered quantity
|
||||
def quantity_available
|
||||
quantity - OrderArticle.where(article_id: id).
|
||||
joins(:order).where("orders.state = 'open' OR orders.state = 'finished'").sum(:units_to_order)
|
||||
joins(:order).where("orders.state = 'finished'").sum(:units_to_order)
|
||||
end
|
||||
|
||||
def self.stock_value
|
||||
|
|
Loading…
Reference in a new issue