Make StockEvent a base class for Delivery and StockTaking
This helps to share code between the two entities and allows easier extensions in the future.
This commit is contained in:
parent
a5582e9542
commit
785313ac23
9 changed files with 69 additions and 33 deletions
|
|
@ -1,10 +1,4 @@
|
|||
class StockTaking < ApplicationRecord
|
||||
|
||||
has_many :stock_changes, :dependent => :destroy
|
||||
has_many :stock_articles, :through => :stock_changes
|
||||
|
||||
validates_presence_of :date
|
||||
|
||||
class StockTaking < StockEvent
|
||||
def stock_change_attributes=(stock_change_attributes)
|
||||
for attributes in stock_change_attributes
|
||||
stock_changes.build(attributes) unless attributes[:quantity].to_i == 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue