negos_app/app/models/sub_product.rb
Nicolas Bally d6861c3c20 suite
2018-03-02 00:52:56 +01:00

23 lines
390 B
Ruby

class SubProduct < ActiveRecord::Base
belongs_to :fournisseur
belongs_to :product
belongs_to :product_order_product
def price_ht_with_qte
self.price_ht * self.qte
end
def qte_tot
if self.product_order_product
self.qte * self.product_order_product.qty
else
0.0
end
end
def price_tot_with_qte
self.qte_tot * self.price_ht
end
end