Re: Modify postings in transactions and update the input beancount file

2024-03-16 Thread Chary Chary
I think I probably misunderstand the question. Why is it not possible just to print entries in the new file? printer.print_entries(entries, file=open("new_file.bean", "w", encoding=" utf-8")) On Friday, March 15, 2024 at 11:47:56 PM UTC+1 Saglara S wrote: > I want to add and modify postings

Re: Modify postings in transactions and update the input beancount file

2024-03-16 Thread Red S
You can do this with autobean-refactor . Note that if you did it with Beancount as it currently us, like with the code you posted, it would be writing out processed entries. I.e., entries that have been through interpolation, plugins, and such.

Re: Modify postings in transactions and update the input beancount file

2024-03-16 Thread Red S
You can do this with [autobean-refactor](https://github.com/SEIAROTg/autobean-refactor). Note that if you did it with Beancount as it currently us, like with the code you posted, it would be writing out processed entries. I.e., entries that have been through interpolation, plugins, and such.

Re: Modify postings in transactions and update the input beancount file

2024-03-15 Thread Martin Blais
There's a far fetched idea for the next version to augment the parser such that it is possible to completely reverse the process and regenerate the input file with modifications, but it's just a fanciful idea at this point. On Fri, Mar 15, 2024 at 6:47 PM Saglara S wrote: > I want to add and

Modify postings in transactions and update the input beancount file

2024-03-15 Thread Saglara S
I want to add and modify postings in transactions based on a lookup table (search string : account). The script here does the job and will print out the modified transactions. But how on earth to modify / update the transactions in the input file accordingly? import json import re from