I am trying to make a csv importer based on the handy library 
beancount_reds_importers, but I am struggling with two things:

1. to find a way to attach custom metadata to some of the postings. Here is 
a sample csv file (
https://drive.google.com/file/d/1zGuGoUW4jNmSPjoEbw1K1fpe9jRskA1b/view?usp=sharing),
 
but the thing is that basically I have an installment column that I want to 
attach to the posting as a metadata (below is an example of such 
transaction). 

2024-04-08 * "DELL" "Laptop purchase"
  Expenses:Personal:Devices
  Liabilities:BR:XP:VisaCard                                     -263.0 BRL
    installment: "9 out of 12"


Currently, there’s no code to add metadata to postings, but it should be 
simple to add. Beancount’s create_simple_posting() currently does not 
support 
<https://github.com/beancount/beancount/blob/a9fd82def1aee017de1831e06a5ac4bc02def9d1/beancount/core/data.py#L522>
 
a metadata param. However, the Posting class itself does 
<https://github.com/beancount/beancount/blob/a9fd82def1aee017de1831e06a5ac4bc02def9d1/beancount/core/data.py#L191>.
 
So you’d have to:

   1. write a small function (here 
   
<https://github.com/redstreet/beancount_reds_importers/blob/5573a63eeca572d3ac7f190e62a489427bc8bcbd/beancount_reds_importers/libtransactionbuilder/common.py#L15>)
 
   to call Posting directly 
   2. then call that function from banking.py when creating the postings 
   3. and write a overridable function within the importers to use the 
   above. Perhaps called build_posting_metadata(), which would need to know 
   the context (eg: whether it’s the main posting or the target account 
   posting in the banking transaction builder) 

​

2. The other issue is that I want to aggregate the transactions that have 
the card_holder other than me into one single transaction with the total 
value. I want to do that just to separate from my expenses categories (I 
have a category Expenses:AdditionalCard for that).
The only way I figured so far was to override the Extract method 
from libtransactionbuilder/banking.py, but I believe there is a better 
approach. 


How would you handle the different dates for each posting? And the memo? 
Anyway, why not simply book each transaction separately into 
Expenses:AdditionalCard? This will give you the flexibility to use queries 
later on rather than stuff all these into one transaction. If this doesn’t 
work for you, could you please post an example? 
​

-- 
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 beancount+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/beancount/14f98f74-929e-4336-b068-c6e7a575a33en%40googlegroups.com.

Reply via email to