jrwrigh / csv2cash

Python package for importing CSV files to GNUCash
GNU General Public License v3.0
23 stars 7 forks source link

Account used in transaction is placeholder #14

Closed jrwrigh closed 6 years ago

jrwrigh commented 6 years ago

See error log:

Traceback (most recent call last):
  File "personal.py", line 19, in <module>
    csv2cash.do_csv2cash(path_to_Book, path_to_CSV, path_to_translationJSON)
  File "C:\Users\USERNAME\gitRepos\csv2cash\csv2cash\main.py", line 31, in do_csv2cash
    import2cash(transactions_compiled, path_to_Book)
  File "C:\Users\USERNAME\gitRepos\csv2cash\csv2cash\main.py", line 428, in import2cash
    book.save()
  File "C:\tools\miniconda3\envs\csv2cash\lib\site-packages\piecash\core\book.py", line 270, in save
    self.session.commit()
  File "C:\tools\miniconda3\envs\csv2cash\lib\site-packages\sqlalchemy\orm\session.py", line 943, in commit
    self.transaction.commit()
  File "C:\tools\miniconda3\envs\csv2cash\lib\site-packages\sqlalchemy\orm\session.py", line 467, in commit
    self._prepare_impl()
  File "C:\tools\miniconda3\envs\csv2cash\lib\site-packages\sqlalchemy\orm\session.py", line 436, in _prepare_impl
    self.session.dispatch.before_commit(self.session)
  File "C:\tools\miniconda3\envs\csv2cash\lib\site-packages\sqlalchemy\event\attr.py", line 246, in __call__
    fn(*args, **kw)
  File "C:\tools\miniconda3\envs\csv2cash\lib\site-packages\piecash\core\book.py", line 214, in validate_book
    tx.validate()
  File "C:\tools\miniconda3\envs\csv2cash\lib\site-packages\piecash\core\transaction.py", line 271, in validate
    raise GncValidationError("Account '{}' used in the transaction is a placeholder".format(sp.account))
piecash._common.GncValidationError: Account 'Account<Income[USD]>' used in the transaction is a placeholder
jrwrigh commented 6 years ago

From GNUCash documentation:

Placeholder accounts are used to create a hierarchy of accounts and normally do not have transactions or opening balances.

A transaction used a place holder account ('Account<Income[USD]>') which is illegal. This isn't caught until book.save() for whatever reason.

I simply need to update the translations.json to fix the issue.