Hello everyone, I'm really learning beancount and building my importers. 
We're an international family so the multi-currency support trough fava 
makes our life easier to keep track of expenses against our two base 
account currencies. After doing some research I found out I can simplify 
currency reporting quite a bit by adding implicit prices. One of our main 
banks exposes the following fields in their export csv: amount, currency, 
local amount, local currency. I;m trying to write an importer with explicit 
prices (e.g. Expenses:Foo 100 GBP @@ 110 EUR) however I'm having trouble 
using the data.Posting function to validate it.

from my *importers/bank_name.py*: 
def implicit_amount(self, base_amount, local_amt, local_cur):
implicit_formatted = "" + local_amt + local_cur + " @@ " + amount + 
self.currency # try to see if we hardcode the string...
return amount.Amount(D(base_amount), self.currency) if (base_amount, 
self.currency) == (local_amt, local_cur) else implicit_formatted
[....]
amount = self.implicit_amount(row['Amount'], row['Local amount'], 
row['Local currency'])
[....]
postings = [data.Posting(self.account, amount, None, None, None, None),]

*Gives..*
...r.py", line 31, in _process
    if entry.postings[0].units.number > 0:
AttributeError: 'str' object has no attribute 'number'

How do I build an importer that supports implicit prices? I couldn't find 
any example/existing importers that support that and where I could re-use 
code from.

Thanks a lot! 

-- 
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 on the web visit 
https://groups.google.com/d/msgid/beancount/d27098b1-c32a-4ea6-b2c2-0eb07ee2a710n%40googlegroups.com.

Reply via email to