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 core
|
||||||
from .. import config as configmod
|
from .. import config as configmod
|
||||||
from .. import data
|
from .. import data
|
||||||
|
|
||||||
|
from typing import (
|
||||||
|
Iterator,
|
||||||
|
Optional,
|
||||||
|
Tuple,
|
||||||
|
)
|
||||||
from ..beancount_types import (
|
from ..beancount_types import (
|
||||||
Transaction,
|
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):
|
class MetaTaxImplication(core._NormalizePostingMetadataHook):
|
||||||
VALUES_ENUM = core.MetadataEnum('tax-implication', [
|
_STDNAMES = [
|
||||||
'1099',
|
'1099-MISC-Other',
|
||||||
|
'1099-NEC',
|
||||||
'Bank-Transfer',
|
'Bank-Transfer',
|
||||||
'Chargeback',
|
'Chargeback',
|
||||||
'Foreign-Corporation',
|
'Foreign-Corporation',
|
||||||
|
@ -38,7 +58,14 @@ class MetaTaxImplication(core._NormalizePostingMetadataHook):
|
||||||
'USA-501c3',
|
'USA-501c3',
|
||||||
'USA-Corporation',
|
'USA-Corporation',
|
||||||
'W2',
|
'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
|
# Sometimes we accrue a payment before we have determined the recipient's
|
||||||
# tax status.
|
# tax status.
|
||||||
SKIP_FLAGS = '!'
|
SKIP_FLAGS = '!'
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -5,7 +5,7 @@ from setuptools import setup
|
||||||
setup(
|
setup(
|
||||||
name='conservancy_beancount',
|
name='conservancy_beancount',
|
||||||
description="Plugin, library, and reports for reading Conservancy's books",
|
description="Plugin, library, and reports for reading Conservancy's books",
|
||||||
version='1.6.1',
|
version='1.6.2',
|
||||||
author='Software Freedom Conservancy',
|
author='Software Freedom Conservancy',
|
||||||
author_email='info@sfconservancy.org',
|
author_email='info@sfconservancy.org',
|
||||||
license='GNU AGPLv3+',
|
license='GNU AGPLv3+',
|
||||||
|
|
|
@ -21,7 +21,11 @@ from . import testutil
|
||||||
from conservancy_beancount.plugin import meta_tax_implication
|
from conservancy_beancount.plugin import meta_tax_implication
|
||||||
|
|
||||||
VALID_VALUES = {
|
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',
|
'Bank-Transfer': 'Bank-Transfer',
|
||||||
'Chargeback': 'Chargeback',
|
'Chargeback': 'Chargeback',
|
||||||
'Foreign-Corporation': 'Foreign-Corporation',
|
'Foreign-Corporation': 'Foreign-Corporation',
|
||||||
|
|
Loading…
Reference in a new issue