Skip to content
Permalink
Browse files

Merge pull request #2561 from ekylibre/debug/fix-two-clicks-intervent…

…ion-creation

Add a default value of 1 for quantity_population of InterventionOutput
  • Loading branch information...
Aquaj committed Jul 3, 2019
2 parents 0ca3e8a + 42d403d commit 639046456ad6aeadb988fa8324dbdb5233ab11a6
Showing with 6 additions and 0 deletions.
  1. +6 −0 app/models/intervention_output.rb
@@ -63,6 +63,12 @@ class InterventionOutput < InterventionProductParameter
has_one :product_movement, as: :originator, dependent: :destroy
validates :variant, :quantity_population, presence: true

after_initialize do
next if persisted?

self.quantity_population ||= 1
end

after_save do
unless destroyed?
output = product

0 comments on commit 6390464

Please sign in to comment.
You can’t perform that action at this time.