Changeset - 680bb6e30528
[Not reviewed]
0 3 0
Brett Smith - 4 years ago 2020-07-28 20:41:34
brettcsmith@brettcsmith.org
meta_tax_implication: Update values for TY2020 1099-MISC changes.

Support the new 1099-NEC form.
3 files changed with 36 insertions and 5 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/plugin/meta_tax_implication.py
Show inline comments
...
 
@@ -19,13 +19,33 @@ import decimal
 
from . import core
 
from .. import config as configmod
 
from .. import data
 

	
 
from typing import (
 
    Iterator,
 
    Optional,
 
    Tuple,
 
)
 
from ..beancount_types import (
 
    Transaction,
 
)
 

	
 
def _make_aliases(s: str, stdname: Optional[str]=None) -> Iterator[Tuple[str, str]]:
 
    if stdname is None:
 
        stdname = s
 
    elif s != stdname:
 
        yield (s, stdname)
 
    yield (s.lower(), stdname)
 
    if s.startswith('1099-'):
 
        yield from _make_aliases(f'1099{s[5:]}', stdname)
 
    elif s.startswith('USA-'):
 
        yield from _make_aliases(f'US-{s[4:]}', stdname)
 
    if s.endswith('-Corporation'):
 
        yield from _make_aliases(f's[:-12]-Corp', stdname)
 

	
 
class MetaTaxImplication(core._NormalizePostingMetadataHook):
 
    VALUES_ENUM = core.MetadataEnum('tax-implication', [
 
        '1099',
 
    _STDNAMES = [
 
        '1099-MISC-Other',
 
        '1099-NEC',
 
        'Bank-Transfer',
 
        'Chargeback',
 
        'Foreign-Corporation',
...
 
@@ -38,7 +58,14 @@ class MetaTaxImplication(core._NormalizePostingMetadataHook):
 
        'USA-501c3',
 
        'USA-Corporation',
 
        'W2',
 
    ])
 
    ]
 
    _ALIASES = dict(
 
        alias for value in _STDNAMES for alias in _make_aliases(value)
 
    )
 
    _ALIASES['1099'] = '1099-NEC'
 
    VALUES_ENUM = core.MetadataEnum('tax-implication', _STDNAMES, _ALIASES)
 
    del _STDNAMES, _ALIASES
 

	
 
    # Sometimes we accrue a payment before we have determined the recipient's
 
    # tax status.
 
    SKIP_FLAGS = '!'
setup.py
Show inline comments
...
 
@@ -5,7 +5,7 @@ from setuptools import setup
 
setup(
 
    name='conservancy_beancount',
 
    description="Plugin, library, and reports for reading Conservancy's books",
 
    version='1.6.1',
 
    version='1.6.2',
 
    author='Software Freedom Conservancy',
 
    author_email='info@sfconservancy.org',
 
    license='GNU AGPLv3+',
tests/test_meta_tax_implication.py
Show inline comments
...
 
@@ -21,7 +21,11 @@ from . import testutil
 
from conservancy_beancount.plugin import meta_tax_implication
 

	
 
VALID_VALUES = {
 
    '1099': '1099',
 
    '1099': '1099-NEC',
 
    '1099-NEC': '1099-NEC',
 
    '1099nec': '1099-NEC',
 
    '1099-MISC-Other': '1099-MISC-Other',
 
    '1099misc-other': '1099-MISC-Other',
 
    'Bank-Transfer': 'Bank-Transfer',
 
    'Chargeback': 'Chargeback',
 
    'Foreign-Corporation': 'Foreign-Corporation',
0 comments (0 inline, 0 general)