basic_app/app/models/p_ship_bill.rb
Nicolas Bally fd027c16c1 initial
2020-04-21 21:53:16 +02:00

18 lines
312 B
Ruby

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