Fix CSV import with no currency (#462)

* FIX use the accounts we are importing currency as default, not family default

* FIX add family fallback for multi account import
This commit is contained in:
soky srm
2025-12-17 18:37:35 +01:00
committed by GitHub
parent 0300bf9c24
commit 64c25725c9
4 changed files with 45 additions and 4 deletions

View File

@@ -29,11 +29,14 @@ class MintImport < Import
category = mappings.categories.mappable_for(row.category)
tags = row.tags_list.map { |tag| mappings.tags.mappable_for(tag) }.compact
# Use account's currency when no currency column was mapped in CSV, with family currency as fallback
effective_currency = currency_col_label.present? ? row.currency : (account.currency.presence || family.currency)
entry = account.entries.build \
date: row.date_iso,
amount: row.signed_amount,
name: row.name,
currency: row.currency,
currency: effective_currency,
notes: row.notes,
entryable: Transaction.new(category: category, tags: tags),
import: self