Changeset - e06b400998a9
[Not reviewed]
0 2 0
Brett Smith - 4 years ago 2020-12-23 23:31:32
brettcsmith@brettcsmith.org
meta_payroll_type: Prefer :Tax: over :Taxes: in metadata values.

This is something we're doing generally, e.g., in our chart of accounts.
Do it here too for consistency. Accept the :Taxes: versions as synonyms.
2 files changed with 21 insertions and 14 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/plugin/meta_payroll_type.py
Show inline comments
...
 
@@ -29,71 +29,78 @@ METADATA_KEY = 'payroll-type'
 

	
 
class _PayrollTypeHook(core._NormalizePostingMetadataHook):
 
    ACCOUNT: str
 
    VALUES_ENUM = core.MetadataEnum(METADATA_KEY, [])
 
    TXN_DATE_RANGE = ranges.DateRange(
 
        datetime.date(2020, 3, 1),
 
        core.DEFAULT_STOP_DATE,
 
    )
 

	
 
    def _run_on_post(self, txn: Transaction, post: data.Posting) -> bool:
 
        return post.account.is_under(self.ACCOUNT) is not None
 

	
 

	
 
class HealthInsuranceHook(_PayrollTypeHook):
 
    ACCOUNT = 'Expenses:Payroll:Benefits:HealthInsurance'
 
    VALUES_ENUM = core.MetadataEnum(METADATA_KEY, [
 
        'US:HRA:Fees',
 
        'US:HRA:Usage',
 
        'US:Premium:DentalVision',
 
        'US:Premium:Main',
 
    ])
 

	
 

	
 
class OtherBenefitsHook(_PayrollTypeHook):
 
    ACCOUNT = 'Expenses:Payroll:Benefits:Other'
 
    VALUES_ENUM = core.MetadataEnum(METADATA_KEY, [
 
        'US:403b:Fees',
 
    ])
 

	
 

	
 
class SalaryHook(_PayrollTypeHook):
 
    ACCOUNT = 'Expenses:Payroll:Salary'
 
    _tax_values = [
 
        'CA:Tax:EI',
 
        'CA:Tax:Income',
 
        'CA:Tax:PP',
 
        'US:IL:Tax:Income',
 
        'US:MA:Tax:Income',
 
        'US:NY:Tax:Income',
 
        'US:NY:Tax:NYC',
 
        'US:OR:Tax:Income',
 
        'US:OR:Tax:STT',
 
        'US:Tax:Income',
 
        'US:Tax:Medicare',
 
        'US:Tax:SocialSecurity',
 
    ]
 
    VALUES_ENUM = core.MetadataEnum(METADATA_KEY, [
 
        'CA:General',
 
        'CA:PTO',
 
        'CA:Taxes:EI',
 
        'CA:Taxes:Income',
 
        'CA:Taxes:PP',
 
        'US:403b:Employee',
 
        'US:403b:Match',
 
        'US:General',
 
        'US:IL:Taxes:Income',
 
        'US:MA:Disability:PFL',
 
        'US:MA:Disability:PML',
 
        'US:MA:Taxes:Income',
 
        'US:NY:Disability',
 
        'US:NY:Disability:PFL',
 
        'US:NY:Taxes:Income',
 
        'US:NY:Taxes:NYC',
 
        'US:OR:Taxes:Income',
 
        'US:OR:Taxes:STT',
 
        'US:PTO',
 
        'US:Taxes:Income',
 
        'US:Taxes:Medicare',
 
        'US:Taxes:SocialSecurity',
 
    ])
 
        *_tax_values,
 
    ], {
 
        value.replace(':Tax:', ':Taxes:', 1): value
 
        for value in _tax_values
 
    })
 
    del _tax_values
 

	
 

	
 
class TaxHook(_PayrollTypeHook):
 
    ACCOUNT = 'Expenses:Payroll:Taxes'
 
    VALUES_ENUM = core.MetadataEnum(METADATA_KEY, [
 
        'CA:EI',
 
        'CA:PP',
 
        'US:IL:Unemployment',
 
        'US:MA:Health',
 
        'US:MA:Unemployment',
 
        'US:MA:WorkTrain',
 
        'US:Medicare',
 
        'US:OR:Unemployment',
 
        'US:SocialSecurity',
 
    ])
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.14.0',
 
    version='1.14.1',
 
    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
 
        'GitPython>=2.0',  # Debian:python3-git
 
        # 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',
 
    ],
 
    setup_requires=[
 
        'pytest-mypy',
 
        'pytest-runner',  # Debian:python3-pytest-runner
 
    ],
 
    tests_require=[
 
        'mypy>=0.770',  # Debian:python3-mypy
 
        'pytest',  # Debian:python3-pytest
 
    ],
 

	
 
    packages=[
 
        'conservancy_beancount',
 
        'conservancy_beancount.plugin',
 
        'conservancy_beancount.reports',
 
        'conservancy_beancount.tools',
 
    ],
 
    entry_points={
 
        'console_scripts': [
 
            'accrual-report = conservancy_beancount.reports.accrual:entry_point',
0 comments (0 inline, 0 general)