Revert "Do not subtract articles in open orders when calculating quantity."
This reverts commit 6bf3b241e6
.
This commit is contained in:
parent
6bf3b241e6
commit
93a99c45d8
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
|
# Check for unclosed orders and substract its ordered quantity
|
||||||
def quantity_available
|
def quantity_available
|
||||||
quantity - OrderArticle.where(article_id: id).
|
quantity - OrderArticle.where(article_id: id).
|
||||||
joins(:order).where("orders.state = 'finished'").sum(:units_to_order)
|
joins(:order).where("orders.state = 'open' OR orders.state = 'finished'").sum(:units_to_order)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.stock_value
|
def self.stock_value
|
||||||
|
|
Loading…
Reference in a new issue