Refactored ordering part two. Integrated stock order.

This commit is contained in:
benni 2011-06-19 19:56:04 +02:00
parent eb4705857b
commit 38b5dcba1f
17 changed files with 177 additions and 374 deletions

View file

@ -99,6 +99,13 @@ class OrderArticle < ActiveRecord::Base
end
end
# Units missing for the next full unit_quantity of the article
def missing_units
units = article.unit_quantity - ((quantity % article.unit_quantity) + tolerance)
units = 0 if units < 0
units
end
private
def article_and_price_exist