Add custom fields to invoice, odergroup, supplier and user
This commit is contained in:
parent
72b5a5ca82
commit
75deec9f06
13 changed files with 48 additions and 7 deletions
16
app/models/concerns/custom_fields.rb
Normal file
16
app/models/concerns/custom_fields.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
module CustomFields
|
||||
extend ActiveSupport::Concern
|
||||
include RailsSettings::Extend
|
||||
|
||||
attr_accessor :custom_fields
|
||||
|
||||
included do
|
||||
after_initialize do
|
||||
settings.defaults['custom_fields'] = { } unless settings.custom_fields
|
||||
end
|
||||
|
||||
after_save do
|
||||
self.settings.custom_fields = custom_fields if custom_fields
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue