Introduced StockChange. Implemented first part of stockit-logic with updating article's quantity.
This commit is contained in:
parent
7ff0467b16
commit
b38025869a
27 changed files with 233 additions and 123 deletions
|
|
@ -12,6 +12,14 @@
|
|||
class Delivery < ActiveRecord::Base
|
||||
|
||||
belongs_to :supplier
|
||||
has_many :stock_changes
|
||||
|
||||
validates_presence_of :supplier_id
|
||||
|
||||
def stock_change_attributes=(stock_change_attributes)
|
||||
for attributes in stock_change_attributes
|
||||
stock_changes.build(attributes) unless attributes[:quantity] == 0.0 or attributes[:quantity].blank?
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue