Add payment structure

This commit is contained in:
2015-04-29 10:21:12 +02:00
parent 9d5e3f684c
commit e4e7198af5
8 changed files with 59 additions and 5 deletions
+5
View File
@@ -17,6 +17,7 @@ class List
belongs_to :table
belongs_to :supplier
belongs_to :section
has_many :list_payments
has_and_belongs_to_many :users, storing_keys: true
has_and_belongs_to_many :employees, storing_keys: true
@@ -274,6 +275,10 @@ class List
state == 'active'
end
def closed?
state == 'closed'
end
def place_order(product_orders: [], user: nil, employee: nil)
return false unless product_orders.any?
order = Order.create list: self, supplier: supplier, user: user, employee: employee, section_id: section_id, table_id: table_id