class PPaymentType < ApplicationRecord
  belongs_to :p_bank_account
  has_many :p_payments
  
  after_save do
    if self.p_bank_account
      self.p_payments.where(:remise => false).update_all(:p_bank_account_id => self.p_bank_account_id)
    elsif
      self.p_payments.where(:remise => false).update_all(:p_bank_account_id => nil)
    end
  end
end
