accrual: Restore "since last nonzero" behavior to outgoing report.
Basically this behavior is an extension of the fact that the outgoing report is grouped by RT ticket rather than "accrual data." Ripping this functionality out of other reports was correct, but it needed to stay for the outgoing report.
This commit is contained in:
parent
52e7f3a221
commit
708d48699a
3 changed files with 20 additions and 4 deletions
|
@ -539,6 +539,15 @@ class OutgoingReport(BaseReport):
|
|||
)
|
||||
requestor = f'{requestor_name} <{rt_requestor["EmailAddress"]}>'.strip()
|
||||
|
||||
last_zero_index = -1
|
||||
for index, (post, balance) in enumerate(posts.iter_with_balance()):
|
||||
if balance.is_zero():
|
||||
prior_zero_index = last_zero_index
|
||||
last_zero_index = index
|
||||
if last_zero_index == index:
|
||||
last_zero_index = prior_zero_index
|
||||
posts = posts[last_zero_index + 1:]
|
||||
|
||||
balance = -posts.balance_at_cost()
|
||||
balance_s = balance.format(None)
|
||||
raw_balance = -posts.balance()
|
||||
|
|
2
setup.py
2
setup.py
|
@ -5,7 +5,7 @@ from setuptools import setup
|
|||
setup(
|
||||
name='conservancy_beancount',
|
||||
description="Plugin, library, and reports for reading Conservancy's books",
|
||||
version='1.5.10',
|
||||
version='1.5.11',
|
||||
author='Software Freedom Conservancy',
|
||||
author_email='info@sfconservancy.org',
|
||||
license='GNU AGPLv3+',
|
||||
|
|
|
@ -510,9 +510,16 @@ def test_outgoing_report(accrual_postings, caplog):
|
|||
r'^TOTAL TO PAY: \$280\.00$',
|
||||
fr'^AGREEMENT: {contract_url}',
|
||||
r'^BEANCOUNT ENTRIES:$',
|
||||
# For each transaction, check for the date line, a metadata, and the
|
||||
# Expenses posting.
|
||||
r'^\s*2010-06-10\s',
|
||||
])
|
||||
# Find the date line of the first transaction.
|
||||
# For each transaction, check for the date line, a metadata, and the
|
||||
# Expenses posting.
|
||||
for line in output:
|
||||
if not line.isspace():
|
||||
break
|
||||
assert re.match(r'\s*2010-06-10\s', line), \
|
||||
"first entry line did not have expected date"
|
||||
check_output(output, [
|
||||
fr'^\s+rt-id: "{rt_id_url}"$',
|
||||
r'^\s+Expenses:Services:Legal\s+220\.00 USD$',
|
||||
r'^\s*2010-06-10\s',
|
||||
|
|
Loading…
Reference in a new issue