class LineStockUsage < ApplicationRecord belongs_to :line_stock acts_as_caching :fields => %w( price_u_ht price_ht ) after_destroy do self.line_stock.save end def ca_price_u_ht self.line_stock.price_u_ht end def ca_price_ht self.price_u_ht * self.qte end end