diff --git a/app/models/dossier.rb b/app/models/dossier.rb index 9e5f8628d..5a32acf74 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -1,4 +1,6 @@ class Dossier < ApplicationRecord + self.ignored_columns += [:re_instructed_at] + include DossierCloneConcern include DossierCorrectableConcern include DossierFilteringConcern @@ -974,7 +976,6 @@ class Dossier < ApplicationRecord self.sva_svr_decision_on = nil self.motivation = nil self.justificatif_motivation.purge_later - self.re_instructed_at = Time.zone.now save! rebase_later diff --git a/app/models/procedure.rb b/app/models/procedure.rb index 25bb06d75..a3d8db109 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -594,7 +594,11 @@ class Procedure < ApplicationRecord when Dossier.states.fetch(:en_construction) initiated_mail_template when Dossier.states.fetch(:en_instruction) - dossier.re_instructed_at.present? ? re_instructed_mail_template : received_mail_template + if dossier.traitements.where(state: Dossier.states.fetch(:en_instruction)).one? + received_mail_template + else + re_instructed_mail_template + end when Dossier.states.fetch(:accepte) closed_mail_template when Dossier.states.fetch(:refuse)