wip multi orders
This commit is contained in:
parent
fd769509af
commit
f676497e43
29 changed files with 939 additions and 107 deletions
|
|
@ -10,6 +10,7 @@ class Order < ApplicationRecord
|
|||
has_many :comments, -> { order('created_at') }, class_name: 'OrderComment'
|
||||
has_many :stock_changes
|
||||
belongs_to :invoice, optional: true
|
||||
belongs_to :multi_order, optional: true, inverse_of: :orders
|
||||
belongs_to :supplier, optional: true
|
||||
belongs_to :updated_by, class_name: 'User', foreign_key: 'updated_by_user_id'
|
||||
belongs_to :created_by, class_name: 'User', foreign_key: 'created_by_user_id'
|
||||
|
|
@ -44,6 +45,8 @@ class Order < ApplicationRecord
|
|||
scope :finished, -> { where(state: %w[finished received closed]).order(ends: :desc) }
|
||||
scope :finished_not_closed, -> { where(state: %w[finished received]).order(ends: :desc) }
|
||||
|
||||
scope :non_multi_order, -> { where(multi_order_id: nil) }
|
||||
|
||||
# Allow separate inputs for date and time
|
||||
# with workaround for https://github.com/einzige/date_time_attribute/issues/14
|
||||
include DateTimeAttributeValidate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue