23 lines
390 B
Ruby
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
|