From 528dfea6bb15e244d4e0eda95e9be281e0fdb5ef Mon Sep 17 00:00:00 2001 From: Jorgen Schaefer Date: Wed, 23 Oct 2013 19:05:40 +0200 Subject: Add find_account method. --- gnucashxml.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gnucashxml.py b/gnucashxml.py index 2fea612..2a2599c 100644 --- a/gnucashxml.py +++ b/gnucashxml.py @@ -25,6 +25,7 @@ from xml.etree import ElementTree __version__ = "1.0" + class Book(object): """ A book is the main container for GNU Cash data. @@ -106,6 +107,11 @@ class Account(object): yield (acc, children, acc.splits) accounts.extend(children) + def find_account(self, name): + for account, children, splits in self.walk(): + if account.name == name: + return account + def get_all_splits(self): split_list = [] for account, children, splits in self.walk(): -- cgit v1.2.3