diff --git a/db/migrate/20241203101328_add_vat_category_id_to_tarifs.rb b/db/migrate/20241203101328_add_vat_category_id_to_tarifs.rb index fc5bed859..b59560c00 100644 --- a/db/migrate/20241203101328_add_vat_category_id_to_tarifs.rb +++ b/db/migrate/20241203101328_add_vat_category_id_to_tarifs.rb @@ -20,7 +20,7 @@ def change def migrate_tarif(tarif) return if !tarif.respond_to?(:vat) || tarif.vat.blank? - vat_category = organisation.vat_categories.find_or_create_by!(percentage: tarif.vat) + vat_category = tarif.organisation.vat_categories.find_or_create_by!(percentage: tarif.vat) tarif.update(vat_category:) tarif.invoice_parts.find_each { |invoice_part| invoice_part.update(vat_category:) } end