mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 15:49:39 +02:00
Allow CSV imports to be configured with single or multi-account mode (#1943)
* Allow CSV imports to be configured to a single account or multiple accounts * Initialize import directly from accounts page * Fix brakeman warnings * Fix schema * Fix Synth check
This commit is contained in:
parent
e907b073ed
commit
c5da8ea550
20 changed files with 118 additions and 57 deletions
|
@ -1,5 +1,5 @@
|
|||
class Import::AccountMapping < Import::Mapping
|
||||
validates :mappable, presence: true, if: -> { key.blank? || !create_when_empty }
|
||||
validates :mappable, presence: true, if: :requires_mapping?
|
||||
|
||||
class << self
|
||||
def mapping_values(import)
|
||||
|
@ -42,4 +42,9 @@ class Import::AccountMapping < Import::Mapping
|
|||
self.mappable = account
|
||||
save!
|
||||
end
|
||||
|
||||
private
|
||||
def requires_mapping?
|
||||
(key.blank? || !create_when_empty) && import.account.nil?
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue