suite
This commit is contained in:
parent
2c09c5decb
commit
b97e5612d0
@ -25,7 +25,7 @@ class MOdrRep < ApplicationRecord
|
|||||||
has_many :m_odr_files, :dependent => :destroy
|
has_many :m_odr_files, :dependent => :destroy
|
||||||
accepts_nested_attributes_for :m_odr_files, :allow_destroy => true
|
accepts_nested_attributes_for :m_odr_files, :allow_destroy => true
|
||||||
|
|
||||||
|
validates :m_odr_product_cat_id, :presence => true, :if => :product_cat_needed?
|
||||||
|
|
||||||
validates :qte, :presence => true
|
validates :qte, :presence => true
|
||||||
validates :m_odr_product_id, :presence => true
|
validates :m_odr_product_id, :presence => true
|
||||||
@ -37,6 +37,14 @@ class MOdrRep < ApplicationRecord
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def product_cat_needed?
|
||||||
|
if self.m_odr.m_odr_product_cats.count > 0
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def rgpd_needed?
|
def rgpd_needed?
|
||||||
if self.m_odr and self.m_odr.confirm_case_needed
|
if self.m_odr and self.m_odr.confirm_case_needed
|
||||||
true
|
true
|
||||||
|
@ -128,7 +128,7 @@
|
|||||||
|
|
||||||
-if f.object.m_odr.m_odr_product_cats.count > 0
|
-if f.object.m_odr.m_odr_product_cats.count > 0
|
||||||
=f.inputs do
|
=f.inputs do
|
||||||
=f.input :m_odr_product_cat_id, :label => (!@m_odr_rep.m_odr.placeholder ? false :(@m_odr_rep.m_odr.product_cat_label? ? @m_odr_rep.m_odr.product_cat_label : "Types :")), :as => :select, :collection => f.object.m_odr.m_odr_product_cats.order("id ASC"), :member_label => :name, :include_blank => false
|
=f.input :m_odr_product_cat_id, :label => (!@m_odr_rep.m_odr.placeholder ? false :(@m_odr_rep.m_odr.product_cat_label? ? @m_odr_rep.m_odr.product_cat_label : "Types :")), :as => :select, :collection => f.object.m_odr.m_odr_product_cats.order("id ASC"), :member_label => :name, :include_blank => true, :prompt => (@m_odr_rep.m_odr.product_cat_label? ? @m_odr_rep.m_odr.product_cat_label : "Nombre de pneus")
|
||||||
|
|
||||||
|
|
||||||
=f.inputs do
|
=f.inputs do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user