TODO: - AJAX for add_p_article and add_stock_movement_p_article in stock_movement views - Fix select p_article with in stock_movement partial view - Fix query to display available p_article in stock_movement partial
23 lines
624 B
Ruby
23 lines
624 B
Ruby
class StockMovementLine < ApplicationRecord
|
|
belongs_to :stock_movement
|
|
belongs_to :p_product_ref
|
|
|
|
has_many :stock_movement_line_p_articles
|
|
has_many :p_articles, through: :stock_movement_line_p_articles
|
|
accepts_nested_attributes_for :stock_movement_line_p_articles
|
|
accepts_nested_attributes_for :p_articles, allow_destroy: true
|
|
|
|
acts_as_caching :fields => [:tot_amount_ht, :price_u_ht]
|
|
|
|
acts_as_sorting :fields => {
|
|
:qte => {:name => "Qté", :reorder => true},
|
|
:actions => {:name => "Actions"}
|
|
}
|
|
|
|
def ca_tot_amount_ht
|
|
if self.ct_tot_amount_ht
|
|
self.ct_tot_amount_ht
|
|
end
|
|
end
|
|
end
|