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

Transaction with Cost with currency only not working in output to file #744

Open
hswong opened this issue Jan 16, 2023 · 0 comments
Open

Comments

@hswong
Copy link

hswong commented Jan 16, 2023

The following beancount transaction cannot be generated using the code directly as cost_to_str in position.py does not properly handle a Cost object with currency but no amount.

`

    posting1 = self._create_posting(transaction_date,
                                    account='Assets:Stock',
                                    units=BAmount(-1, 'AAPL'),
                                    cost=_Cost(None, currency, None, None),_
                                    price=None,
                                    flag=None,
                                    meta={})

    transaction = Transaction(meta={},
                                         date=transaction_date,
                                         flag="*",
                                         payee=None,
                                         narration='',
                                         tags=None,
                                         links=None,
                                         postings=[posting1, posting2])

`

Target output
2019-05-29 * "Sell a stock"
Assets:Stock -1 AAPL {USD}
Assets:Cash 150 USD

Actual output
2019-05-29 * "Sell a stock"
Assets:Stock -1 AAPL {}
Assets:Cash 150 USD

I had to patch position.py (in red) to be able to handle the above code and generate the target output above.

Screenshot from 2023-01-16 16-33-51

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

1 participant