Changeset - 123508ef8882
[Not reviewed]
2 3 2
Brett Smith - 4 years ago 2020-07-28 15:46:00
brettcsmith@brettcsmith.org
expense_type: Revamp expense-allocation metadata.

* Change the name for symmetry with income-type.
* Standardize on "management" value because that's what it's called in the 990.
5 files changed with 24 insertions and 20 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/plugin/__init__.py
Show inline comments
...
 
@@ -57,3 +57,3 @@ class HookRegistry:
 
        '.meta_entity': None,
 
        '.meta_expense_allocation': None,
 
        '.meta_expense_type': None,
 
        '.meta_income_type': None,
conservancy_beancount/plugin/meta_expense_type.py
Show inline comments
 
file renamed from conservancy_beancount/plugin/meta_expense_allocation.py to conservancy_beancount/plugin/meta_expense_type.py
 
"""meta_expense_allocation - Validate expense-allocation metadata"""
 
"""meta_expense_type - Validate expense-type metadata"""
 
# Copyright © 2020  Brett Smith
...
 
@@ -23,13 +23,15 @@ from ..beancount_types import (
 

	
 
class MetaExpenseAllocation(core._NormalizePostingMetadataHook):
 
    VALUES_ENUM = core.MetadataEnum('expense-allocation', {
 
        'administration',
 
class MetaExpenseType(core._NormalizePostingMetadataHook):
 
    VALUES_ENUM = core.MetadataEnum('expense-type', {
 
        'fundraising',
 
        'management',
 
        'program',
 
    }, {
 
        'admin': 'administration',
 
        'admin': 'management',
 
        'administration': 'management',
 
        'mgmt': 'management',
 
    })
 
    DEFAULT_VALUES = {
 
        'Expenses:Services:Accounting': VALUES_ENUM['administration'],
 
        'Expenses:Services:Administration': VALUES_ENUM['administration'],
 
        'Expenses:Services:Accounting': VALUES_ENUM['management'],
 
        'Expenses:Services:Administration': VALUES_ENUM['management'],
 
        'Expenses:Services:Fundraising': VALUES_ENUM['fundraising'],
conservancy_beancount/reports/ledger.py
Show inline comments
...
 
@@ -102,3 +102,3 @@ class LedgerODS(core.BaseODS[data.Posting, None]):
 
        ('Income', ['project', 'rt-id', 'receipt', 'income-type', 'memo']),
 
        ('Expenses', ['project', 'rt-id', 'receipt', 'approval', 'expense-allocation']),
 
        ('Expenses', ['project', 'rt-id', 'receipt', 'approval', 'expense-type']),
 
        ('Equity', ['rt-id']),
setup.py
Show inline comments
...
 
@@ -7,3 +7,3 @@ setup(
 
    description="Plugin, library, and reports for reading Conservancy's books",
 
    version='1.6.0',
 
    version='1.6.1',
 
    author='Software Freedom Conservancy',
tests/test_meta_expense_type.py
Show inline comments
 
file renamed from tests/test_meta_expense_allocation.py to tests/test_meta_expense_type.py
 
"""Test handling of expense-allocation metadata"""
 
"""Test handling of expense-type metadata"""
 
# Copyright © 2020  Brett Smith
...
 
@@ -20,3 +20,3 @@ from . import testutil
 

	
 
from conservancy_beancount.plugin import meta_expense_allocation
 
from conservancy_beancount.plugin import meta_expense_type
 

	
...
 
@@ -24,5 +24,7 @@ VALID_VALUES = {
 
    'program': 'program',
 
    'administration': 'administration',
 
    'fundraising': 'fundraising',
 
    'admin': 'administration',
 
    'management': 'management',
 
    'admin': 'management',
 
    'administration': 'management',
 
    'mgmt': 'management',
 
}
...
 
@@ -30,10 +32,10 @@ VALID_VALUES = {
 
INVALID_VALUES = {
 
    'invalid',
 
    'porgram',
 
    'adimn',
 
    'mangement',
 
    'fundrasing',
 
    '',
 
    *testutil.NON_STRING_METADATA_VALUES,
 
}
 

	
 
TEST_KEY = 'expense-allocation'
 
TEST_KEY = 'expense-type'
 

	
...
 
@@ -42,3 +44,3 @@ def hook():
 
    config = testutil.TestConfig()
 
    return meta_expense_allocation.MetaExpenseAllocation(config)
 
    return meta_expense_type.MetaExpenseType(config)
 

	
...
 
@@ -103,4 +105,4 @@ def test_non_expense_accounts_skipped(hook, account):
 
@pytest.mark.parametrize('account,set_value', [
 
    ('Expenses:Services:Accounting', 'administration'),
 
    ('Expenses:Services:Administration', 'administration'),
 
    ('Expenses:Services:Accounting', 'management'),
 
    ('Expenses:Services:Administration', 'management'),
 
    ('Expenses:Services:Advocacy', 'program'),
0 comments (0 inline, 0 general)