diff --git a/conservancy_beancount/reports/core.py b/conservancy_beancount/reports/core.py index d2cc8645de53be47f166c4303b9cad6b5a665e3c..48ba9c4e158ee7ac4462e0611d7e52a020602f1a 100644 --- a/conservancy_beancount/reports/core.py +++ b/conservancy_beancount/reports/core.py @@ -274,6 +274,12 @@ class RelatedPostings(Sequence[data.Posting]): for value, posts in mapping.items(): yield value, cls(posts, _can_own=True) + @classmethod + def group_by_account(cls: Type[RelatedType], + postings: Iterable[data.Posting], + ) -> Iterator[Tuple[data.Account, RelatedType]]: + return cls._group_by(postings, operator.attrgetter('account')) + @classmethod def group_by_meta(cls: Type[RelatedType], postings: Iterable[data.Posting],