Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Currency mismatch #185

Open
jasonhuhx opened this issue Feb 5, 2023 · 4 comments
Open

Currency mismatch #185

jasonhuhx opened this issue Feb 5, 2023 · 4 comments

Comments

@jasonhuhx
Copy link
Contributor

The following item is listed as a candidate in the beancount-import UI:

+2023-01-02 * 
"APPLE.COM/BILL 866-712-7753 ON"

+  Liabilities:BMO:CC:Visa  -2.25 USD
+    date: 2023-01-02
+    source_desc: "APPLE.COM/BILL 866-712-7753 ON"
+  Expenses:FIXME           2.25 USD

And I have in accounts.beancount

2000-01-01 open   Liabilities:BMO:CC:Visa CAD
  mint_id: "Visa"

In mint.csv

"1/02/2023","APPLE.COM/BILL 866-712-7753 ON","APPLE.COM/BILL 866-712-7753 ON","2.25","debit","Electronics & Software","Visa","",""

The importer was able to recognize this transaction from CSV but did not respect the currency. Instead of CAD, it shows USD in the candidate interface. Is this a bug or I'm missing something?

@Zburatorul
Copy link
Collaborator

It looks like while the code is able to handle non-USD currencies, it never does so.
https://github.com/jbms/beancount-import/blob/master/beancount_import/source/mint.py#L178

There's a couple of ways to fix this. Does your mint.csv have transactions in multiple currencies?

@jasonhuhx
Copy link
Contributor Author

@Zburatorul My CSV and all of the accounts only have one currency CAD

@Zburatorul
Copy link
Collaborator

In that case the easiest fix for you is to add the currency in the importer config:
dict(module='beancount_import.source.mint', directory=os.path.join(journal_dir, 'data', 'mint', 'mint.csv'), balances_directory=os.path.join(journal_dir, 'data', 'mint'), currency='CAD' )
and then pass it to load_transactions:
self.mint_entries = load_transactions(filename, currency = kwargs.get("currency", None)

If you get this working, a PR is welcome.

@jasonhuhx
Copy link
Contributor Author

PR created: #186

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants