Changeset - d6821b13681b
[Not reviewed]
0 2 0
Brett Smith - 4 years ago 2020-06-28 13:43:44
brettcsmith@brettcsmith.org
fund: Fund report columns more closely match the audit report.
2 files changed with 23 insertions and 9 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/reports/fund.py
Show inline comments
...
 
@@ -119,3 +119,3 @@ class ODSReport(core.BaseODS[FundPosts, None]):
 
            self.string_cell("Expenses", stylename=center_bold),
 
            self.multiline_cell(["Realized", "Gain/Loss"], stylename=center_bold),
 
            self.string_cell("Equity", stylename=center_bold),
 
            self.multiline_cell(["Balance as of", self.stop_date.isoformat()],
...
 
@@ -139,12 +139,25 @@ class ODSReport(core.BaseODS[FundPosts, None]):
 
        sheet.setAttribute('name', 'Fund Report')
 
        row_qname = sheet.lastChild.qname
 
        row_qname = odf.table.TableRow().qname
 
        skip_rows: List[int] = []
 
        report_threshold = Decimal('.5')
 
        first_row = True
 
        for index, row in enumerate(sheet.childNodes):
 
            row.childNodes = row.childNodes[:6]
 
            if len(row.childNodes) < 6:
 
                continue
 
            row.childNodes = [*row.childNodes[:4], row.childNodes[5]]
 
            if row.qname != row_qname:
 
                pass
 
            elif first_row:
 
                ref_child = row.childNodes[2]
 
                stylename = ref_child.getAttribute('stylename')
 
                row.insertBefore(self.string_cell(
 
                    "Additions", stylename=stylename,
 
                ), ref_child)
 
                row.insertBefore(self.multiline_cell(
 
                    ["Releases from", "Restrictions"], stylename=stylename,
 
                ), ref_child)
 
                del row.childNodes[4:6]
 
                first_row = False
 
            # Filter out fund rows that don't have anything reportable.
 
            if (row.qname == row_qname
 
                # len(childNodes) makes sure this isn't a header/spacer row.
 
                and len(row.childNodes) == 6
 
                and not any(
 
            elif not any(
 
                    # Multiple childNodes means it's a multi-currency balance.
...
 
@@ -155,3 +168,3 @@ class ODSReport(core.BaseODS[FundPosts, None]):
 
                    for cell in row.childNodes
 
            )):
 
            ):
 
                skip_rows.append(index)
tests/test_reports_fund.py
Show inline comments
...
 
@@ -187,3 +187,4 @@ def check_ods_sheet(sheet, account_balances, *, full):
 
        check_cell_balance(next(cells), -balances['Expenses'])
 
        check_cell_balance(next(cells), balances['Equity:Realized'])
 
        if full:
 
            check_cell_balance(next(cells), balances['Equity:Realized'])
 
        check_cell_balance(next(cells), sum(balances[key] for key in [
0 comments (0 inline, 0 general)