meta_tax_implication: Update values for TY2020 1099-MISC changes.
Support the new 1099-NEC form.
This commit is contained in:
parent
123508ef88
commit
680bb6e305
3 changed files with 36 additions and 5 deletions
|
@ -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 = '!'
|
||||
|
|
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.6.1',
|
||||
version='1.6.2',
|
||||
author='Software Freedom Conservancy',
|
||||
author_email='info@sfconservancy.org',
|
||||
license='GNU AGPLv3+',
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue