New issue 357: Cannot run booking_full.book on transactions created with data.create_simple_posting
https://bitbucket.org/blais/beancount/issues/357/cannot-run-booking_fullbook-on Robert Sesek: In creating a one-time converter for some account data files, I wrote code that basically did this: ```python txn = data.Transaction(…) data.create_simple_posting(txn, 'Assets', 100.00 'USD') data.create_simple_posting(txn, 'Expenses', None, None) booking_full.book([txn], …) ``` My converter ultimately uses printer to produce a beancount file. But I want to run book() manually to determine when a transaction does not balance. If an error exists between two specific accounts in specific currencies, the script inserts an additional posting to assume the rounding error. But when running the book() on data like the above, I encountered two errors: ``` > if units.currency is MISSING: E AttributeError: 'NoneType' object has no attribute 'currency' beancount/parser/booking_full.py:451: AttributeError ``` ``` > new_posting.meta[interpolate.AUTOMATIC_META] = True E TypeError: 'NoneType' object does not support item assignment beancount/parser/booking_full.py:894: TypeError ``` These errors occur because the Postings created by create_simple_posting() have None for fields (`units` and `meta` respectively). The booking algorithm normally runs on parser-produced data, which do not have this problem. Since the transaction's postings were created with the data API, I think the booking algorithm should be able to handle them. Patch and test forthcoming. -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/20181231051629.2861.17980%40celery-worker-111.ash1.bb-inf.net. For more options, visit https://groups.google.com/d/optout.
