Improved delivery-invoice-workflow.
This commit is contained in:
parent
936e6ef69a
commit
ff6b460cfc
28 changed files with 253 additions and 231 deletions
|
|
@ -27,7 +27,9 @@
|
|||
class Article < ActiveRecord::Base
|
||||
belongs_to :supplier
|
||||
belongs_to :article_category
|
||||
|
||||
|
||||
named_scope :in_stock, :conditions => "quantity > 0", :order => 'suppliers.name', :include => :supplier
|
||||
|
||||
validates_presence_of :name, :unit, :net_price, :tax, :deposit, :unit_quantity, :supplier_id
|
||||
validates_length_of :name, :in => 4..60
|
||||
validates_length_of :unit, :in => 2..15
|
||||
|
|
|
|||
|
|
@ -12,8 +12,11 @@
|
|||
class Delivery < ActiveRecord::Base
|
||||
|
||||
belongs_to :supplier
|
||||
has_one :invoice
|
||||
has_many :stock_changes
|
||||
|
||||
named_scope :recent, :order => 'created_at DESC', :limit => 10
|
||||
|
||||
validates_presence_of :supplier_id
|
||||
|
||||
def stock_change_attributes=(stock_change_attributes)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
class Invoice < ActiveRecord::Base
|
||||
|
||||
belongs_to :supplier
|
||||
belongs_to :delivery
|
||||
|
||||
validates_presence_of :supplier_id
|
||||
validates_uniqueness_of :date, :scope => [:supplier_id]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue