Changeset - f7d24cd8ab27
[Not reviewed]
0 2 0
Brett Smith - 4 years ago 2020-06-29 13:39:41
brettcsmith@brettcsmith.org
fund: ODS report usability improvements.

* Lock the first column.
* Open the breakdown sheet by default.
2 files changed with 4 insertions and 1 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/reports/fund.py
Show inline comments
...
 
@@ -117,24 +117,25 @@ class ODSReport(core.BaseODS[FundPosts, None]):
 
                                stylename=center_bold),
 
            self.string_cell("Income", stylename=center_bold),
 
            self.string_cell("Expenses", stylename=center_bold),
 
            self.string_cell("Equity", stylename=center_bold),
 
            self.multiline_cell(["Balance as of", self.stop_date.isoformat()],
 
                                stylename=center_bold),
 
            self.multiline_cell(["Of Which", "Receivable"], stylename=center_bold),
 
            self.multiline_cell(["Of Which", "Prepaid Expenses"], stylename=center_bold),
 
            self.multiline_cell(["Of Which", "Payable"], stylename=center_bold),
 
            self.multiline_cell(["Of Which", "Unearned Income"], stylename=center_bold),
 
        )
 
        self.lock_first_row()
 
        self.lock_first_column()
 
        self.add_row()
 
        self.add_row(self.string_cell(
 
            f"Fund Report From {self.start_date.isoformat()} To {self.stop_date.isoformat()}",
 
            stylename=center_bold,
 
            numbercolumnsspanned=6,
 
        ))
 
        self.add_row()
 

	
 
    def end_spreadsheet(self) -> None:
 
        sheet = self.copy_element(self.sheet)
 
        sheet.setAttribute('name', 'Fund Report')
 
        row_qname = odf.table.TableRow().qname
...
 
@@ -162,25 +163,27 @@ class ODSReport(core.BaseODS[FundPosts, None]):
 
            elif not any(
 
                    # Multiple childNodes means it's a multi-currency balance.
 
                    len(cell.childNodes) > 1
 
                    # Some column has to round up to 1 to be reportable.
 
                    or (cell.getAttribute('valuetype') == 'currency'
 
                        and Decimal(cell.getAttribute('value')) >= report_threshold)
 
                    for cell in row.childNodes
 
            ):
 
                skip_rows.append(index)
 
        for index in reversed(skip_rows):
 
            del sheet.childNodes[index]
 
        self.lock_first_row(sheet)
 
        self.lock_first_column(sheet)
 
        self.document.spreadsheet.insertBefore(sheet, self.sheet)
 
        self.set_open_sheet(self.sheet)
 

	
 
    def _row_balances(self, accounts_map: AccountsMap) -> Iterable[core.Balance]:
 
        acct_order = ['Income', 'Expenses', 'Equity']
 
        key_order = [core.OPENING_BALANCE_NAME, *acct_order, core.ENDING_BALANCE_NAME]
 
        balances: Dict[str, core.Balance] = {key: core.MutableBalance() for key in key_order}
 
        for acct_s, balance in core.account_balances(accounts_map, acct_order):
 
            if acct_s in balances:
 
                balances[acct_s] = balance
 
            else:
 
                acct_root, _, _ = acct_s.partition(':')
 
                balances[acct_root] += balance
 
        for key in key_order:
setup.py
Show inline comments
 
#!/usr/bin/env python3
 

	
 
from setuptools import setup
 

	
 
setup(
 
    name='conservancy_beancount',
 
    description="Plugin, library, and reports for reading Conservancy's books",
 
    version='1.5.3',
 
    version='1.5.4',
 
    author='Software Freedom Conservancy',
 
    author_email='info@sfconservancy.org',
 
    license='GNU AGPLv3+',
 

	
 
    install_requires=[
 
        'babel>=2.6',  # Debian:python3-babel
 
        'beancount>=2.2',  # Debian:beancount
 
        # 1.4.1 crashes when trying to save some documents.
 
        'odfpy>=1.4.0,!=1.4.1',  # Debian:python3-odf
 
        'PyYAML>=3.0',  # Debian:python3-yaml
 
        'regex',  # Debian:python3-regex
 
        'rt>=2.0',
0 comments (0 inline, 0 general)