diff --git a/app/models/utilities/plan_comptable_comite.rb b/app/models/utilities/plan_comptable_comite.rb index 8b49e50c..c8df8a63 100644 --- a/app/models/utilities/plan_comptable_comite.rb +++ b/app/models/utilities/plan_comptable_comite.rb @@ -6,8 +6,8 @@ class Utilities::PlanComptableComite < Utilities::PlanComptable def initialize(period) @status = 'comite' @period = period - @asc_id = Sector.where('name LIKE ?', 'ASC').first.id - @fonc_id = Sector.where('name LIKE ?', 'Fonctionnement').first.id + @asc_id = period.organism.sectors.where('name LIKE ?', 'ASC').first.id + @fonc_id = period.organism.sectors.where('name LIKE ?', 'Fonctionnement').first.id end # crée des comptes à partir d'un fichier source diff --git a/config/initializers/version.rb b/config/initializers/version.rb index cc382bf3..28a454df 100644 --- a/config/initializers/version.rb +++ b/config/initializers/version.rb @@ -111,5 +111,5 @@ # FLCVERSION = '1.14.3RC' # Amélioration module Adhérent (rapidité, icone nb_supprimer) # FLCVERSION = '1.14.4RC' # Les banques et caisses sont ordonnées par leur id # FLCVERSION = '1.14.5RC' # Refactorisation des bank_extract_lines et démarrage des écritures à 1 -FLCVERSION = '1.14.6RC' # Correction lines_to_point affichage piece_number et non id - \ No newline at end of file +# FLCVERSION = '1.14.6RC' # Correction lines_to_point affichage piece_number et non id +FLCVERSION = '1.14.7RC' # correction bug dans la création du plan comptable comité \ No newline at end of file diff --git a/spec/models/utilities/plan_comptable_comite_spec.rb b/spec/models/utilities/plan_comptable_comite_spec.rb index 41f1387f..a5dfc140 100644 --- a/spec/models/utilities/plan_comptable_comite_spec.rb +++ b/spec/models/utilities/plan_comptable_comite_spec.rb @@ -11,8 +11,8 @@ before(:each) do Tenant.set_current_tenant(1) - Sector.create(organism_id:1, name:'ASC') - Sector.create(organism_id:1, name:'Fonctionnement') + @s1 = Sector.create(organism_id:1, name:'ASC') + @s2 = Sector.create(organism_id:1, name:'Fonctionnement') Period.any_instance.stub(:organism).and_return o Account.any_instance.stub(:organism).and_return o @@ -22,6 +22,10 @@ @p.stub(:should_not_have_more_than_two_open_periods).and_return(true) @p.stub(:check_nomenclature).and_return true @p.save + + o.stub(:sectors).and_return(@ar = double(Arel)) + @ar.stub(:where).with('name LIKE ?', 'ASC').and_return [@s1] + @ar.stub(:where).with('name LIKE ?', 'Fonctionnement').and_return [@s2] end