class PShipBill < ApplicationRecord
  belongs_to :p_fournisseur
  
  has_many :p_ship_bill_lines
  accepts_nested_attributes_for :p_ship_bill_lines
  
  
  before_save do
    self.a_ok_total = 0.0
    self.p_ship_bill_lines.each do |psbl|
      self.a_ok_total += psbl.a_ok_total
      
    end
  end 
  
  
end
