Changeset - 948d3a2d14d1
[Not reviewed]
0 4 0
Brett Smith - 4 years ago 2020-06-09 19:59:09
brettcsmith@brettcsmith.org
accrual: Add columns to the aging report. RT#11439.

This adds almost all the metadata that's relevant to accruals.
I considered adding statement, but that cuased rows to get spaced out a lot,
and statement's kind of a low-value column, so I decided against it.

Ultimately I would like to make this configurable but that's for the
future.
4 files changed with 38 insertions and 6 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/reports/accrual.py
Show inline comments
...
 
@@ -336,4 +336,8 @@ class AgingODS(core.BaseODS[AccrualPostings, Optional[data.Account]]):
 
        'Booked Amount',
 
        'Project',
 
        'Ticket',
 
        'Invoice',
 
        'Approval',
 
        'Contract',
 
        'Purchase Order',
 
    ]
...
 
@@ -404,3 +408,3 @@ class AgingODS(core.BaseODS[AccrualPostings, Optional[data.Account]]):
 
        text_style = self.merge_styles(self.style_bold, self.style_endtext)
 
        text_span = self.COL_COUNT - 1
 
        text_span = 4
 
        last_age_text: Optional[str] = None
...
 
@@ -476,2 +480,4 @@ class AgingODS(core.BaseODS[AccrualPostings, Optional[data.Account]]):
 
            amount_cell = self.balance_cell(raw_balance)
 
        projects = {post.meta.get('project') or None for post in row}
 
        projects.discard(None)
 
        self.add_row(
...
 
@@ -481,4 +487,8 @@ class AgingODS(core.BaseODS[AccrualPostings, Optional[data.Account]]):
 
            self.balance_cell(row.end_balance),
 
            self.multiline_cell(sorted(projects)),
 
            self.multilink_cell(self._link_seq(row, 'rt-id')),
 
            self.multilink_cell(self._link_seq(row, 'invoice')),
 
            self.multilink_cell(self._link_seq(row, 'approval')),
 
            self.multilink_cell(self._link_seq(row, 'contract')),
 
            self.multilink_cell(self._link_seq(row, 'purchase-order')),
 
        )
setup.py
Show inline comments
...
 
@@ -7,3 +7,3 @@ setup(
 
    description="Plugin, library, and reports for reading Conservancy's books",
 
    version='1.1.5',
 
    version='1.1.6',
 
    author='Software Freedom Conservancy',
tests/books/accruals.beancount
Show inline comments
...
 
@@ -17,2 +17,3 @@
 
  invoice: "rt:40/400"
 
  project: "Conservancy"
 
  Assets:Receivable:Accounts  -500 USD
...
 
@@ -23,2 +24,3 @@
 
  invoice: "rt:44/440"
 
  project: "Conservancy"
 
  Liabilities:Payable:Accounts  125 USD
...
 
@@ -29,2 +31,3 @@
 
  invoice: "rt:470/4700"
 
  project: "Development Grant"
 
  Assets:Receivable:Accounts  5000 USD
...
 
@@ -35,2 +38,3 @@
 
  invoice: "rt:470/4700"
 
  project: "Development Grant"
 
  Assets:Receivable:Accounts  -5000 USD
...
 
@@ -41,2 +45,3 @@
 
  invoice: "rt:490/4900"
 
  project: "Conservancy"
 
  Liabilities:Payable:Accounts  -75 USD
...
 
@@ -47,2 +52,3 @@
 
  invoice: "rt:480/4800"
 
  project: "Conservancy"
 
  Expenses:Travel  250 USD
...
 
@@ -56,2 +62,3 @@
 
  invoice: "rt:480/4800"
 
  project: "Conservancy"
 
  Liabilities:Payable:Accounts  125 USD
...
 
@@ -62,2 +69,3 @@
 
  invoice: "rt:480/4800"
 
  project: "Conservancy"
 
  Liabilities:Payable:Accounts  125 USD
...
 
@@ -69,2 +77,3 @@
 
  invoice: "FIXME"  ; still waiting on them to send it
 
  project: "Conservancy"
 
  Liabilities:Payable:Accounts  -200 USD
...
 
@@ -76,2 +85,3 @@
 
  approval: "rt:505/5040"
 
  project: "Conservancy"
 
  Income:Donations  -2,500 EUR {1.100 USD}
...
 
@@ -83,2 +93,3 @@
 
  contract: "rt:510/4000"
 
  project: "Conservancy"
 
  Expenses:Services:Legal  200.00 USD
...
 
@@ -89,2 +100,3 @@
 
  approval: "rt://ticket/515/attachments/5140"
 
  project: "Conservancy"
 
  Income:Donations  -1500.00 USD
...
 
@@ -95,2 +107,3 @@
 
  invoice: "rt:505/5050"
 
  project: "Conservancy"
 
  Assets:Receivable:Accounts  -2,750.00 USD
...
 
@@ -102,2 +115,3 @@
 
  invoice: "rt:510/5100"
 
  project: "Conservancy"
 
  Liabilities:Payable:Accounts  200.00 USD
...
 
@@ -111,2 +125,3 @@
 
  contract: "rt:510/4000"
 
  project: "Conservancy"
 
  Expenses:Services:Legal  220.00 USD
...
 
@@ -118,2 +133,3 @@
 
  contract: "rt:510/4000"
 
  project: "Conservancy"
 
  Expenses:FilingFees  60.00 USD
...
 
@@ -127,2 +143,3 @@
 
  contract: "rt:520/5220"
 
  project: "Conservancy"
 
  Liabilities:Payable:Accounts  -1,000 EUR {1.100 USD}
...
 
@@ -133,2 +150,3 @@
 
  invoice: "rt:470/4700"
 
  project: "Development Grant"
 
  Assets:Receivable:Accounts  5500 USD
tests/test_reports_accrual.py
Show inline comments
...
 
@@ -77,5 +77,7 @@ class AgingRow(NamedTuple):
 
    invoice: Sequence[str]
 
    project: Sequence[str]
 

	
 
    @classmethod
 
    def make_simple(cls, date, entity, at_cost, invoice, rt_id=None, orig_amount=None):
 
    def make_simple(cls, date, entity, at_cost, invoice,
 
                    rt_id=None, orig_amount=None, project='Conservancy'):
 
        if isinstance(date, str):
...
 
@@ -86,3 +88,3 @@ class AgingRow(NamedTuple):
 
            rt_id, _, _ = invoice.partition('/')
 
        return cls(date, [entity], orig_amount, at_cost, [rt_id], [invoice])
 
        return cls(date, [entity], orig_amount, at_cost, [rt_id], [invoice], [project])
 

	
...
 
@@ -90,3 +92,3 @@ class AgingRow(NamedTuple):
 
        cells = testutil.ODSCell.from_row(sheet_row)
 
        assert len(cells) == len(self)
 
        assert len(cells) >= len(self)
 
        cells = iter(cells)
...
 
@@ -101,2 +103,3 @@ class AgingRow(NamedTuple):
 
        assert usd_cell.value == self.at_cost.number
 
        assert next(cells).text == '\0'.join(self.project)
 
        for index, cell in enumerate(cells):
...
 
@@ -120,3 +123,4 @@ AGING_AR = [
 
                         'rt://ticket/515/attachments/5150'),
 
    AgingRow.make_simple('2010-06-15', 'GrantCo', 5500, 'rt:470/4700'),
 
    AgingRow.make_simple('2010-06-15', 'GrantCo', 5500, 'rt:470/4700',
 
                         project='Development Grant'),
 
]
0 comments (0 inline, 0 general)