From 0c4ea6ebbb56c8e65c6d77b17967d047478c06c7 Mon Sep 17 00:00:00 2001 From: Tom Naessens Date: Mon, 18 Mar 2024 19:46:16 +0100 Subject: [PATCH] Finetune invoice edit a bit --- app/models/note.rb | 10 ---------- app/views/notes/_form.html.slim | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/app/models/note.rb b/app/models/note.rb index 0597a28..cd7f3a8 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -23,9 +23,6 @@ class Note < ActiveRecord::Base enum kind: {invoice: 0, credit: 1, income: 2, reminder: 3} - # Notes should be immutable and never changed. - #validate :force_immutable - before_create :generate_and_set_note_number before_create :generate_and_set_pdf before_update :generate_and_set_pdf @@ -85,11 +82,4 @@ def generate_and_set_note_number def generate_and_set_pdf self.generated_pdf = generate_pdf end - - def force_immutable - return unless changed? && persisted? - - errors.add(:base, :immutable) - reload - end end diff --git a/app/views/notes/_form.html.slim b/app/views/notes/_form.html.slim index 164e86f..8583076 100644 --- a/app/views/notes/_form.html.slim +++ b/app/views/notes/_form.html.slim @@ -21,7 +21,7 @@ = f.label :costs, class: 'label' table.table thead - th Datum + th Aantal th width='60%' Omschrijving th Bedrag th