Nullify deliveries and orders depending on an invoice (#718)
This commit is contained in:
parent
5eb8abf431
commit
fc22a97f52
2 changed files with 10 additions and 2 deletions
|
|
@ -4,8 +4,8 @@ class Invoice < ApplicationRecord
|
|||
belongs_to :supplier
|
||||
belongs_to :created_by, :class_name => 'User', :foreign_key => 'created_by_user_id'
|
||||
belongs_to :financial_link
|
||||
has_many :deliveries
|
||||
has_many :orders
|
||||
has_many :deliveries, dependent: :nullify
|
||||
has_many :orders, dependent: :nullify
|
||||
|
||||
validates_presence_of :supplier_id
|
||||
validates_numericality_of :amount, :deposit, :deposit_credit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue