balance_sheet: Correct "release from restrictions" calculation.

The old version was causing Income:Donations:Released postings to be
"double-released." This version gets the bottom line numbers for
Net Assets With/out Donor Restrictions match the corresponding numbers
in the fund report.
This commit is contained in:
Brett Smith 2020-08-18 16:26:12 -04:00
parent a0ff9e6834
commit 5a3ee24589
2 changed files with 8 additions and 6 deletions

View file

@ -433,14 +433,16 @@ class Report(core.BaseODS[Sequence[None], None]):
self.add_row( self.add_row(
self.string_cell("Net Assets released from restrictions:"), self.string_cell("Net Assets released from restrictions:"),
) )
released = self.balances.total( released_expenses = self.balances.total(
account='Expenses', period=Period.PERIOD, fund=Fund.RESTRICTED, account='Expenses', period=Period.PERIOD, fund=Fund.RESTRICTED,
) - self.balances.total(
classification=self.C_SATISFIED, period=Period.PERIOD, fund=Fund.RESTRICTED,
) )
other_totals = [core.MutableBalance() for _ in bal_kwargs] other_totals = [core.MutableBalance() for _ in bal_kwargs]
other_totals[0] += released other_totals[0] += released_expenses - self.balances.total(
other_totals[1] -= released classification=self.C_SATISFIED, period=Period.PERIOD, fund=Fund.UNRESTRICTED,
)
other_totals[1] -= released_expenses + self.balances.total(
classification=self.C_SATISFIED, period=Period.PERIOD, fund=Fund.RESTRICTED,
)
self.write_totals_row(self.C_SATISFIED, other_totals) self.write_totals_row(self.C_SATISFIED, other_totals)
self.write_totals_row( self.write_totals_row(
"Total Support and Revenue", "Total Support and Revenue",

View file

@ -5,7 +5,7 @@ from setuptools import setup
setup( setup(
name='conservancy_beancount', name='conservancy_beancount',
description="Plugin, library, and reports for reading Conservancy's books", description="Plugin, library, and reports for reading Conservancy's books",
version='1.8.4', version='1.8.5',
author='Software Freedom Conservancy', author='Software Freedom Conservancy',
author_email='info@sfconservancy.org', author_email='info@sfconservancy.org',
license='GNU AGPLv3+', license='GNU AGPLv3+',