From 90f2b232c666879abb187bce863354c1f46ea3fd Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Wed, 1 Apr 2020 12:51:28 -0400
Subject: [PATCH 01/20] IMP `l10n_us_hr_payroll` for Indiana 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/state/in_indiana.xml | 122 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
l10n_us_hr_payroll/models/state/in_indiana.py | 34 +++++
.../models/us_payroll_config.py | 2 +
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../tests/test_us_in_indiana_payslip_2020.py | 36 ++++++
.../views/us_payroll_config_views.xml | 6 +
8 files changed, 205 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/in_indiana.xml
create mode 100644 l10n_us_hr_payroll/models/state/in_indiana.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_in_indiana_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 2785d47b..f6aec784 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -39,6 +39,7 @@ United States of America - Payroll Rules.
'data/state/ia_iowa.xml',
'data/state/id_idaho.xml',
'data/state/il_illinois.xml',
+ 'data/state/in_indiana.xml',
'data/state/mi_michigan.xml',
'data/state/mn_minnesota.xml',
'data/state/mo_missouri.xml',
diff --git a/l10n_us_hr_payroll/data/state/in_indiana.xml b/l10n_us_hr_payroll/data/state/in_indiana.xml
new file mode 100644
index 00000000..9bda9b1e
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/in_indiana.xml
@@ -0,0 +1,122 @@
+
+
+
+
+ US IN Indiana SUTA Wage Base
+ us_in_suta_wage_base
+
+
+
+
+ 9500.00
+
+
+
+
+
+
+
+ US IN Indiana SUTA Rate
+ us_in_suta_rate
+
+
+
+
+ 2.5
+
+
+
+
+
+
+ US IN Indiana SUTA Income Rate
+ us_in_suta_income_rate
+
+
+
+
+ 3.23
+
+
+
+
+
+
+ US IN Indiana SIT Personal Exemption Rate
+ us_in_sit_personal_exemption_rate
+
+
+
+
+ {
+ 'daily': ( 2.74, 5.48, 8.22, 10.96, 13.70, 16.44),
+ 'weekly': ( 19.23, 38.46, 57.69, 76.92, 96.15, 115.38),
+ 'bi-weekly': ( 38.46, 76.92, 115.38, 153.85, 192.31, 230.77),
+ 'semi-monthly': ( 41.67, 83.33, 125.00, 166.67, 208.33, 250.00),
+ 'monthly': ( 83.33, 166.67, 250.00, 333.33, 416.67, 500.00),
+ }
+
+
+
+
+
+
+ US IN Indiana SIT Dependent Exemption Rate
+ us_in_sit_dependent_exemption_rate
+
+
+
+
+ {
+ 'daily': ( 4.11, 8.22, 12.33, 16.44, 20.55),
+ 'weekly': ( 28.85, 57.69, 86.54, 115.38, 144.23),
+ 'bi-weekly': ( 57.69, 115.38, 173.08, 230.77, 288.46),
+ 'semi-monthly': ( 62.50, 125.00, 187.50, 250.00, 312.50),
+ 'monthly': (125.00, 250.00, 375.00, 500.00, 625.00),
+ }
+
+
+
+
+
+
+
+ US Indiana - Department of Workforce Development - Unemployment Tax
+
+
+
+ US Indiana - Department of Revenue - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US IN Indiana State Unemployment
+ ER_US_IN_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_in_suta_wage_base', rate='us_in_suta_rate', state_code='IN')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_in_suta_wage_base', rate='us_in_suta_rate', state_code='IN')
+
+
+
+
+
+
+
+
+ EE: US IN Indiana State Income Tax Withholding
+ EE_US_IN_SIT
+ python
+ result, _ = in_indiana_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = in_indiana_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index 888a9ebc..91dc4352 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -24,6 +24,7 @@ from .state.hi_hawaii import hi_hawaii_state_income_withholding
from .state.ia_iowa import ia_iowa_state_income_withholding
from .state.id_idaho import id_idaho_state_income_withholding
from .state.il_illinois import il_illinois_state_income_withholding
+from .state.in_indiana import in_indiana_state_income_withholding
from .state.mi_michigan import mi_michigan_state_income_withholding
from .state.mn_minnesota import mn_minnesota_state_income_withholding
from .state.mo_missouri import mo_missouri_state_income_withholding
@@ -79,6 +80,7 @@ class HRPayslip(models.Model):
'ia_iowa_state_income_withholding': ia_iowa_state_income_withholding,
'id_idaho_state_income_withholding': id_idaho_state_income_withholding,
'il_illinois_state_income_withholding': il_illinois_state_income_withholding,
+ 'in_indiana_state_income_withholding': in_indiana_state_income_withholding,
'mi_michigan_state_income_withholding': mi_michigan_state_income_withholding,
'mn_minnesota_state_income_withholding': mn_minnesota_state_income_withholding,
'mo_missouri_state_income_withholding': mo_missouri_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/in_indiana.py b/l10n_us_hr_payroll/models/state/in_indiana.py
new file mode 100644
index 00000000..0b6bd03e
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/in_indiana.py
@@ -0,0 +1,34 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def in_indiana_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'IN'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ schedule_pay = payslip.contract_id.schedule_pay
+ additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ personal_exemption = payslip.contract_id.us_payroll_config_value('in_w4_sit_personal_exemption')
+ personal_exemption_rate = payslip.rule_parameter('us_in_sit_personal_exemption_rate')[schedule_pay][personal_exemption - 1]
+ dependent_exemption = payslip.contract_id.us_payroll_config_value('in_w4_sit_dependent_exemption')
+ dependent_exemption_rate = payslip.rule_parameter('us_in_sit_dependent_exemption_rate')[schedule_pay][dependent_exemption - 1]
+ income_tax_rate = payslip.rule_parameter('us_in_suta_income_rate')
+
+ taxable_income = wage - (personal_exemption_rate + dependent_exemption_rate)
+ withholding = taxable_income * (income_tax_rate / 100.0)
+
+ withholding = max(withholding, 0.0)
+ withholding += additional
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index b1aa0699..cf5a7c81 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -124,6 +124,8 @@ class HRContractUSPayrollConfig(models.Model):
il_w4_sit_basic_allowances = fields.Integer(string='Illinois IL-W-4 Number of Basic Allowances', help='IL-W-4 Step 1.')
il_w4_sit_additional_allowances = fields.Integer(string='Illinois IL-W-4 Number of Additional Allowances', help='IL-W-4 Step 2.')
+ in_w4_sit_personal_exemption = fields.Integer(string='Indiana In-W-4 Number of Personal Exemption', help='IN-W-4 5.')
+ in_w4_sit_dependent_exemption = fields.Integer(string='Indiana In-W-4 Number of Dependent Exemption', help='IN-W-4 6.')
mi_w4_sit_exemptions = fields.Integer(string='Michigan MI W-4 Exemptions', help='MI-W4 6.')
mn_w4mn_sit_filing_status = fields.Selection([
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 11a045e2..aa4fc5ab 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -44,6 +44,8 @@ from . import test_us_id_idaho_payslip_2020
from . import test_us_il_illinois_payslip_2019
from . import test_us_il_illinois_payslip_2020
+from . import test_us_in_indiana_payslip_2020
+
from . import test_us_mi_michigan_payslip_2019
from . import test_us_mi_michigan_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_in_indiana_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_in_indiana_payslip_2020.py
new file mode 100755
index 00000000..53b7ddf3
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_in_indiana_payslip_2020.py
@@ -0,0 +1,36 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsINPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ IN_UNEMP_MAX_WAGE = 9500.0
+ IN_UNEMP = 2.5
+ # Calculation based on https://www.in.gov/dor/files/dn01.pdf
+
+ def _test_sit(self, wage, additional_withholding, personal_exemption, dependent_exemption, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('IN'),
+ state_income_tax_additional_withholding=additional_withholding,
+ in_w4_sit_personal_exemption=personal_exemption,
+ in_w4_sit_dependent_exemption=dependent_exemption,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('IN', self.IN_UNEMP, date(2020, 1, 1), wage_base=self.IN_UNEMP_MAX_WAGE)
+ self._test_sit(800.0, 0.0, 5.0, 3.0, 'weekly', date(2020, 1, 1), 19.94)
+ self._test_sit(800.0, 10.0, 5.0, 3.0, 'weekly', date(2020, 1, 1), 29.94)
+ self._test_sit(9000.0, 0.0, 4.0, 3.0, 'monthly', date(2020, 1, 1), 267.82)
+ self._test_sit(10000.0, 0.0, 2.0, 2.0, 'bi-weekly', date(2020, 1, 1), 316.79)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index a91f80e4..a294fa51 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -119,6 +119,12 @@
+
+ Form IN W-4 - State Income Tax
+
+
+
+
Form MI-W4 - State Income Tax
From 7c9158dfd2162a3af6f8b994c0b61dc3f9837364 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Wed, 1 Apr 2020 14:04:11 -0400
Subject: [PATCH 02/20] IMP `l10n_us_hr_payroll` Port `l10n_us_la_hr_payroll`
LA Louisiana including migration
---
l10n_us_hr_payroll/__manifest__.py | 1 +
.../data/state/la_louisiana.xml | 141 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/la_louisiana.py | 60 ++++++++
.../models/us_payroll_config.py | 8 +
l10n_us_hr_payroll/tests/__init__.py | 3 +
.../test_us_la_louisiana_payslip_2019.py | 87 +++++++++++
.../test_us_la_louisiana_payslip_2020.py | 34 +++++
.../views/us_payroll_config_views.xml | 6 +
9 files changed, 342 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/la_louisiana.xml
create mode 100644 l10n_us_hr_payroll/models/state/la_louisiana.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_la_louisiana_payslip_2019.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_la_louisiana_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index f6aec784..fee61b48 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -40,6 +40,7 @@ United States of America - Payroll Rules.
'data/state/id_idaho.xml',
'data/state/il_illinois.xml',
'data/state/in_indiana.xml',
+ 'data/state/la_louisiana.xml',
'data/state/mi_michigan.xml',
'data/state/mn_minnesota.xml',
'data/state/mo_missouri.xml',
diff --git a/l10n_us_hr_payroll/data/state/la_louisiana.xml b/l10n_us_hr_payroll/data/state/la_louisiana.xml
new file mode 100644
index 00000000..5f23bea4
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/la_louisiana.xml
@@ -0,0 +1,141 @@
+
+
+
+
+ US LA Louisiana SUTA Wage Base
+ us_la_suta_wage_base
+
+
+
+
+ 7700.0
+
+
+
+
+ 7700.0
+
+
+
+
+
+
+
+ US LA Louisiana SUTA Rate
+ us_la_suta_rate
+
+
+
+
+ 6.20
+
+
+
+
+ 6.20
+
+
+
+
+
+
+ US LA Louisiana SIT Tax Rate
+ us_la_sit_tax_rate
+
+
+
+
+ {
+ 'single': ((12500.00, 2.10), (50000.00, 1.60), ('inf', 1.35)),
+ 'married': ((25000.00, 2.10), (100000.00, 1.65), ('inf', 1.35)),
+ }
+
+
+
+
+ {
+ 'single': ((12500.00, 2.10), (50000.00, 1.60), ('inf', 1.35)),
+ 'married': ((25000.00, 2.10), (100000.00, 1.65), ('inf', 1.35)),
+ }
+
+
+
+
+
+
+ US LA Louisiana Personal Exemption Rate
+ us_la_sit_personal_exemption_rate
+
+
+
+
+ 4500
+
+
+
+
+ 4500
+
+
+
+
+
+
+ US LA Louisiana Dependent Rate
+ us_la_sit_dependent_rate
+
+
+
+
+ 1000.0
+
+
+
+
+ 1000.0
+
+
+
+
+
+
+
+ US Louisiana - Workforce Commission (LWC) - Unemployment Tax
+
+
+
+ US Louisiana - Department of Revenue (LDOR) - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US LA Louisiana State Unemployment
+ ER_US_LA_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_la_suta_wage_base', rate='us_la_suta_rate', state_code='LA')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_la_suta_wage_base', rate='us_la_suta_rate', state_code='LA')
+
+
+
+
+
+
+
+
+ EE: US LA Louisiana State Income Tax Withholding
+ EE_US_LA_SIT
+ python
+ result, _ = la_louisiana_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = la_louisiana_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index 91dc4352..bf663242 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -25,6 +25,7 @@ from .state.ia_iowa import ia_iowa_state_income_withholding
from .state.id_idaho import id_idaho_state_income_withholding
from .state.il_illinois import il_illinois_state_income_withholding
from .state.in_indiana import in_indiana_state_income_withholding
+from .state.la_louisiana import la_louisiana_state_income_withholding
from .state.mi_michigan import mi_michigan_state_income_withholding
from .state.mn_minnesota import mn_minnesota_state_income_withholding
from .state.mo_missouri import mo_missouri_state_income_withholding
@@ -81,6 +82,7 @@ class HRPayslip(models.Model):
'id_idaho_state_income_withholding': id_idaho_state_income_withholding,
'il_illinois_state_income_withholding': il_illinois_state_income_withholding,
'in_indiana_state_income_withholding': in_indiana_state_income_withholding,
+ 'la_louisiana_state_income_withholding': la_louisiana_state_income_withholding,
'mi_michigan_state_income_withholding': mi_michigan_state_income_withholding,
'mn_minnesota_state_income_withholding': mn_minnesota_state_income_withholding,
'mo_missouri_state_income_withholding': mo_missouri_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/la_louisiana.py b/l10n_us_hr_payroll/models/state/la_louisiana.py
new file mode 100644
index 00000000..0697d696
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/la_louisiana.py
@@ -0,0 +1,60 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def la_louisiana_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'LA'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ filing_status = payslip.contract_id.us_payroll_config_value('la_l4_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ pay_periods = payslip.dict.get_pay_periods_in_year()
+ personal_exemptions = payslip.contract_id.us_payroll_config_value('la_l4_sit_exemptions')
+ dependent_exemptions = payslip.contract_id.us_payroll_config_value('la_l4_sit_dependents')
+ tax_table = payslip.rule_parameter('us_la_sit_tax_rate')[filing_status]
+ exemption_rate = payslip.rule_parameter('us_la_sit_personal_exemption_rate')
+ dependent_rate = payslip.rule_parameter('us_la_sit_dependent_rate')
+
+ annual_wage = wage * pay_periods
+
+ effect_cap = 0.0
+ multiplier = 0.0
+ if filing_status == 'single':
+ effect_cap = 12500.00
+ multiplier = 1.60
+ elif filing_status == 'married':
+ effect_cap = 25000.00
+ multiplier = 1.65
+
+ after_credits_under = (2.100 / 100) * (((personal_exemptions * exemption_rate) +
+ (dependent_exemptions * dependent_rate)) / pay_periods)
+ after_credits_over = 0.00
+ if after_credits_under > effect_cap:
+ after_credits_under = effect_cap
+ after_credits_over_check = ((personal_exemptions * exemption_rate) + (dependent_exemptions * dependent_rate)) - effect_cap
+ after_credits_over = (multiplier / 100.00) * (after_credits_over_check / pay_periods) if after_credits_over_check > 0 else 0.00
+ withholding = 0.0
+ last = 0.0
+ for amt, rate in tax_table:
+ withholding = withholding + ((rate / 100.0) * (wage - (last / pay_periods)))
+ if annual_wage <= float(amt):
+ break
+ last = amt
+
+ withholding = withholding - (after_credits_under + after_credits_over)
+ withholding = round(withholding, 2)
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index cf5a7c81..d548e87c 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -126,6 +126,14 @@ class HRContractUSPayrollConfig(models.Model):
in_w4_sit_personal_exemption = fields.Integer(string='Indiana In-W-4 Number of Personal Exemption', help='IN-W-4 5.')
in_w4_sit_dependent_exemption = fields.Integer(string='Indiana In-W-4 Number of Dependent Exemption', help='IN-W-4 6.')
+
+ la_l4_sit_filing_status = fields.Selection([
+ ('single', 'Single'),
+ ('married', 'Married'),
+ ], string='Louisiana LA L-4 Filing Status', help='LA L-4 3.')
+ la_l4_sit_exemptions = fields.Integer(string='Louisiana LA L-4 Number of Exemptions', help='LA L-4 6.')
+ la_l4_sit_dependents = fields.Integer(string='Louisiana LA L-4 Number of Dependents', help='LA L-4 7.')
+
mi_w4_sit_exemptions = fields.Integer(string='Michigan MI W-4 Exemptions', help='MI-W4 6.')
mn_w4mn_sit_filing_status = fields.Selection([
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index aa4fc5ab..526762c3 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -46,6 +46,9 @@ from . import test_us_il_illinois_payslip_2020
from . import test_us_in_indiana_payslip_2020
+from . import test_us_la_louisiana_payslip_2019
+from . import test_us_la_louisiana_payslip_2020
+
from . import test_us_mi_michigan_payslip_2019
from . import test_us_mi_michigan_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_la_louisiana_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_la_louisiana_payslip_2019.py
new file mode 100644
index 00000000..f723744a
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_la_louisiana_payslip_2019.py
@@ -0,0 +1,87 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .common import TestUsPayslip, process_payslip
+
+
+class TestUsLAPayslip(TestUsPayslip):
+
+ # TAXES AND RATES
+ LA_UNEMP_MAX_WAGE = 7700.00
+ LA_UNEMP = -(6.20 / 100.0)
+
+ def test_taxes_single_weekly(self):
+ salary = 700.00
+ schedule_pay = 'weekly'
+ filing_status = 'single'
+ exemptions = 1
+ dependents = 2
+ # SEE http://revenue.louisiana.gov/TaxForms/1306(1_12)TF.pdf for example calculations
+ # wh_to test is 19.42
+ # Our algorithm correctly rounds whereas theirs does it prematurely.
+ wh_to_check = -19.43
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('LA'),
+ la_l4_sit_filing_status=filing_status,
+ la_l4_sit_exemptions=exemptions,
+ la_l4_sit_dependents=dependents,
+ schedule_pay=schedule_pay)
+
+ self._log('2019 Louisiana tax first payslip weekly:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['ER_US_SUTA'], salary * self.LA_UNEMP)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh_to_check)
+
+ process_payslip(payslip)
+
+ remaining_la_unemp_wages = self.LA_UNEMP_MAX_WAGE - salary if (self.LA_UNEMP_MAX_WAGE - 2*salary < salary) \
+ else salary
+
+ self._log('2019 Louisiana tax second payslip weekly:')
+ payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_la_unemp_wages * self.LA_UNEMP)
+
+ def test_taxes_married_biweekly(self):
+ salary = 4600.00
+ schedule_pay = 'bi-weekly'
+ filing_status = 'married'
+ exemptions = 2
+ dependents = 3
+ # SEE http://revenue.louisiana.gov/TaxForms/1306(1_12)TF.pdf for example calculations
+ # wh_to test is 157.12
+ wh_to_check = -157.12
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('LA'),
+ la_l4_sit_filing_status=filing_status,
+ la_l4_sit_exemptions=exemptions,
+ la_l4_sit_dependents=dependents,
+ schedule_pay=schedule_pay)
+
+ self._log('2019 Louisiana tax first payslip bi-weekly:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['ER_US_SUTA'], salary * self.LA_UNEMP)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh_to_check)
+
+ process_payslip(payslip)
+
+ remaining_la_unemp_wages = self.LA_UNEMP_MAX_WAGE - salary if (self.LA_UNEMP_MAX_WAGE - 2*salary < salary) \
+ else salary
+
+ self._log('2019 Louisiana tax second payslip bi-weekly:')
+ payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_la_unemp_wages * self.LA_UNEMP)
diff --git a/l10n_us_hr_payroll/tests/test_us_la_louisiana_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_la_louisiana_payslip_2020.py
new file mode 100755
index 00000000..14dde5bf
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_la_louisiana_payslip_2020.py
@@ -0,0 +1,34 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsLAPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ LA_UNEMP_MAX_WAGE = 7700.0
+ LA_UNEMP = 6.20
+ # Calculation based on http://revenue.louisiana.gov/TaxForms/1306(1_12)TF.pdf
+
+ def _test_sit(self, wage, filing_status, exemptions, dependents, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('LA'),
+ la_l4_sit_filing_status=filing_status,
+ la_l4_sit_exemptions=exemptions,
+ la_l4_sit_dependents=dependents,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('LA', self.LA_UNEMP, date(2020, 1, 1), wage_base=self.LA_UNEMP_MAX_WAGE)
+ self._test_sit(700.0, 'single', 1.0, 2.0, 'weekly', date(2020, 1, 1), 19.43)
+ self._test_sit(4600.0, 'married', 2.0, 3.0, 'bi-weekly', date(2020, 1, 1), 157.12)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index a294fa51..7865d1f8 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -125,6 +125,12 @@
+
+ Form LA L-4 - State Income Tax
+
+
+
+
Form MI-W4 - State Income Tax
From e96ae2dde4b855ff27b507513b40400fb200e021 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Wed, 1 Apr 2020 14:05:09 -0400
Subject: [PATCH 03/20] IMP `l10n_us_hr_payroll` Port `l10n_us_sc_hr_payroll`
SC South Carolina including migration
---
l10n_us_hr_payroll/__manifest__.py | 1 +
.../data/state/sc_south_carolina.xml | 149 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/sc_south_carolina.py | 48 ++++++
.../models/us_payroll_config.py | 1 +
l10n_us_hr_payroll/tests/__init__.py | 3 +
.../test_us_sc_south_carolina_payslip_2019.py | 97 ++++++++++++
.../test_us_sc_south_carolina_payslip_2020.py | 34 ++++
.../views/us_payroll_config_views.xml | 5 +
9 files changed, 340 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/sc_south_carolina.xml
create mode 100644 l10n_us_hr_payroll/models/state/sc_south_carolina.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2019.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index fee61b48..c8a0acaf 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -52,6 +52,7 @@ United States of America - Payroll Rules.
'data/state/nm_new_mexico.xml',
'data/state/oh_ohio.xml',
'data/state/pa_pennsylvania.xml',
+ 'data/state/sc_south_carolina.xml',
'data/state/tx_texas.xml',
'data/state/va_virginia.xml',
'data/state/wa_washington.xml',
diff --git a/l10n_us_hr_payroll/data/state/sc_south_carolina.xml b/l10n_us_hr_payroll/data/state/sc_south_carolina.xml
new file mode 100644
index 00000000..95867646
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/sc_south_carolina.xml
@@ -0,0 +1,149 @@
+
+
+
+
+ US SC South Carolina SUTA Wage Base
+ us_sc_suta_wage_base
+
+
+
+
+ 14000.0
+
+
+
+
+ 14000.0
+
+
+
+
+
+
+
+ US SC South Carolina SUTA Rate
+ us_sc_suta_rate
+
+
+
+
+ 1.09
+
+
+
+
+ 1.09
+
+
+
+
+
+
+ US SC South Carolina SIT Tax Rate
+ us_sc_sit_tax_rate
+
+
+
+
+ [
+ ( 2450, 1.1, 0.0),
+ ( 4900, 3.0, 26.95),
+ ( 7350, 4.0, 100.45),
+ ( 9800, 5.0, 198.45),
+ (12250, 6.0, 320.95),
+ ('inf', 7.0, 467.95),
+ ]
+
+
+
+
+ [
+ ( 2620, 0.8, 0.0),
+ ( 5240, 3.0, 57.64),
+ ( 7860, 4.0, 110.04),
+ (10490, 5.0, 188.64),
+ (13110, 6.0, 293.54),
+ ('inf', 7.0, 424.64),
+ ]
+
+
+
+
+
+
+ US SC South Carolina Personal Exemption Rate
+ us_sc_sit_personal_exemption_rate
+
+
+
+
+ 2510
+
+
+
+
+ 2590
+
+
+
+
+
+
+ US SC South Carolina Standard Deduction Rate
+ us_sc_sit_standard_deduction_rate
+
+
+
+
+ 3470.0
+
+
+
+
+ 3820.0
+
+
+
+
+
+
+
+ US South Carolina - Department of Labor and Industrial Relations - Unemployment Tax
+
+
+
+ US South Carolina - Department of Taxation - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US SC South Carolina State Unemployment
+ ER_US_SC_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_sc_suta_wage_base', rate='us_sc_suta_rate', state_code='SC')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_sc_suta_wage_base', rate='us_sc_suta_rate', state_code='SC')
+
+
+
+
+
+
+
+
+ EE: US SC South Carolina State Income Tax Withholding
+ EE_US_SC_SIT
+ python
+ result, _ = sc_south_carolina_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = sc_south_carolina_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index bf663242..a35f3b38 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -35,6 +35,7 @@ from .state.nc_northcarolina import nc_northcarolina_state_income_withholding
from .state.nj_newjersey import nj_newjersey_state_income_withholding
from .state.nm_new_mexico import nm_new_mexico_state_income_withholding
from .state.oh_ohio import oh_ohio_state_income_withholding
+from .state.sc_south_carolina import sc_south_carolina_state_income_withholding
from .state.va_virginia import va_virginia_state_income_withholding
from .state.wa_washington import wa_washington_fml_er, \
wa_washington_fml_ee
@@ -92,6 +93,7 @@ class HRPayslip(models.Model):
'nj_newjersey_state_income_withholding': nj_newjersey_state_income_withholding,
'nm_new_mexico_state_income_withholding': nm_new_mexico_state_income_withholding,
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
+ 'sc_south_carolina_state_income_withholding': sc_south_carolina_state_income_withholding,
'va_virginia_state_income_withholding': va_virginia_state_income_withholding,
'wa_washington_fml_er': wa_washington_fml_er,
'wa_washington_fml_ee': wa_washington_fml_ee,
diff --git a/l10n_us_hr_payroll/models/state/sc_south_carolina.py b/l10n_us_hr_payroll/models/state/sc_south_carolina.py
new file mode 100644
index 00000000..169961eb
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/sc_south_carolina.py
@@ -0,0 +1,48 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def sc_south_carolina_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+ WAGE = GROSS + DED_FIT_EXEMPT
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'SC'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ personal_exempt = payslip.contract_id.us_payroll_config_value('state_income_tax_exempt')
+ if personal_exempt:
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ pay_periods = payslip.dict.get_pay_periods_in_year()
+ allowances = payslip.contract_id.us_payroll_config_value('sc_w4_sit_allowances')
+ tax_rate = payslip.rule_parameter('us_sc_sit_tax_rate')
+ personal_exemption = payslip.rule_parameter('us_sc_sit_personal_exemption_rate')
+ deduction = payslip.rule_parameter('us_sc_sit_standard_deduction_rate')
+
+ annual_wage = wage * pay_periods
+ personal_exemption_amt = allowances * personal_exemption
+ standard_deduction = 0.0
+ if allowances > 0:
+ if (annual_wage * 0.1) > deduction:
+ standard_deduction = deduction
+ else:
+ standard_deduction = annual_wage * (10 / 100)
+ taxable_income = annual_wage - personal_exemption_amt - standard_deduction
+ withholding = 0.0
+ last = 0.0
+ for cap, rate, flat_amt in tax_rate:
+ if float(cap) > taxable_income:
+ withholding = (taxable_income * (rate / 100.0) - flat_amt)
+ break
+ withholding /= pay_periods
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index d548e87c..5abc4759 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -202,6 +202,7 @@ class HRContractUSPayrollConfig(models.Model):
# Ohio will use generic SIT exempt and additional fields
oh_it4_sit_exemptions = fields.Integer(string='Ohio IT-4 Exemptions',
help='Line 4')
+ sc_w4_sit_allowances = fields.Integer(string='South Carolina SC W-4 Allowances', help='SC W-4 5.')
va_va4_sit_exemptions = fields.Integer(string='Virginia VA-4(P) Personal Exemptions',
help='VA-4(P) 1(a)')
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 526762c3..85be27cb 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -80,6 +80,9 @@ from . import test_us_oh_ohio_payslip_2020
from . import test_us_pa_pennsylvania_payslip_2019
from . import test_us_pa_pennsylvania_payslip_2020
+from . import test_us_sc_south_carolina_payslip_2019
+from . import test_us_sc_south_carolina_payslip_2020
+
from . import test_us_tx_texas_payslip_2019
from . import test_us_tx_texas_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2019.py
new file mode 100644
index 00000000..793f84c4
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2019.py
@@ -0,0 +1,97 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .common import TestUsPayslip, process_payslip
+
+
+class TestUsSCPayslip(TestUsPayslip):
+
+ # Taxes and Rates
+ SC_UNEMP_MAX_WAGE = 14000.0
+ US_SC_UNEMP = -1.09 / 100
+ US_SC_exemption_amount = 2510.00
+
+ def test_2019_taxes_weekly(self):
+ # We will hand calculate the amount to test for state withholding.
+ schedule_pay = 'weekly'
+ salary = 50000.00 # Employee is paid 50000 per week to be in top tax bracket
+ allowances = 2
+ # Calculate annual wages
+ annual = 50000 * 52.0
+ # From our annual we deduct personal exemption amounts.
+ # We deduct 2510.00 per exemption. Since we have two exemptions:
+ personal_exemption = self.US_SC_exemption_amount * allowances # 5020.0
+ # From annual, we will also deduct a standard_deduction of 3470.00 or .1 of salary, which ever
+ # is small -> if 1 or more exemptions, else 0
+ standard_deduction = 3470.00
+ taxable_income = annual - personal_exemption - standard_deduction # 2591510.0
+ # We then calculate the amounts off the SC tax pdf tables.
+ # 2591478.0 is in the highest bracket
+ test_amt = (taxable_income * (7.0 / 100.0)) - 467.95
+ test_amt = 180935.51
+ # Make it per period then negative
+ test_amt = (test_amt / 52.0) # Divided by 52 since it is weekly.
+ # test_amt = 3479.52
+ test_amt = -test_amt
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('SC'),
+ state_income_tax_exempt=False,
+ sc_w4_sit_allowances=allowances,
+ schedule_pay=schedule_pay)
+
+ self._log('2019 South Carolina tax first payslip:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollAlmostEqual(cats['ER_US_SUTA'], self.SC_UNEMP_MAX_WAGE * self.US_SC_UNEMP)
+ self.assertPayrollAlmostEqual(cats['EE_US_SIT'], test_amt)
+
+ process_payslip(payslip)
+
+ remaining_SC_UNEMP_wages = self.SC_UNEMP_MAX_WAGE - annual if (annual < self.SC_UNEMP_MAX_WAGE) \
+ else 0.00
+
+ self._log('2019 South Carolina tax second payslip:')
+
+ payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertEqual(0.0, remaining_SC_UNEMP_wages)
+ self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_SC_UNEMP_wages * self.US_SC_UNEMP)
+
+ def test_2019_taxes_filing_status(self):
+ salary = 20000.00 # Wages per pay period
+ schedule_pay = 'monthly'
+ annual = salary * 12
+ allowances = 1
+ # Hand Calculations
+ personal_exemption = 2510.00
+ standard_deduction = min(3470.00, .1 * annual) # 3470.0 but min is shown for the process
+ taxable = annual - personal_exemption - standard_deduction
+ # taxable = 234020
+ test_amt = ((taxable) * (7.0 / 100.0)) - 467.95 # 15991.850000000002
+ test_amt = test_amt / 12.0 # Put it into monthly -> 1332.654166666667
+ # Make it negative
+ test_amt = -test_amt
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('SC'),
+ state_income_tax_exempt=False,
+ sc_w4_sit_allowances=allowances,
+ schedule_pay=schedule_pay)
+
+ self._log('2019 South Carolina tax first payslip: ')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['ER_US_SUTA'], self.SC_UNEMP_MAX_WAGE * self.US_SC_UNEMP)
+ self.assertPayrollAlmostEqual(cats['EE_US_SIT'], test_amt)
+
+ process_payslip(payslip)
diff --git a/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2020.py
new file mode 100644
index 00000000..e17a8052
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_sc_south_carolina_payslip_2020.py
@@ -0,0 +1,34 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsSCPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ SC_UNEMP_MAX_WAGE = 14000.0
+ SC_UNEMP = 1.09
+ # Calculation based on https://dor.sc.gov/forms-site/Forms/WH1603F_2020.pdf
+
+ def _test_sit(self, wage, exempt, allowances, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('SC'),
+ state_income_tax_exempt=exempt,
+ sc_w4_sit_allowances=allowances,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('SC', self.SC_UNEMP, date(2020, 1, 1), wage_base=self.SC_UNEMP_MAX_WAGE)
+ self._test_sit(750.0, False, 3.0, 'weekly', date(2020, 1, 1), 28.73)
+ self._test_sit(800.0, True, 0.0, 'weekly', date(2020, 1, 1), 0.00)
+ self._test_sit(9000.0, False, 0.0, 'monthly', date(2020, 1, 1), 594.61)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index 7865d1f8..a517bdb4 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -191,6 +191,11 @@
+
+ Form SC W-4 - State Income Tax
+
+
+
No additional fields.
From ef25f0c3ebe2a1985bed6d127157459884f19f6d Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Tue, 14 Apr 2020 12:44:08 -0400
Subject: [PATCH 04/20] IMP `l10n_us_hr_payroll` for Nebraska 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/state/ne_nebraska.xml | 125 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/ne_nebraska.py | 49 +++++++
.../models/us_payroll_config.py | 6 +
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../tests/test_us_ne_nebraska_payslip_2020.py | 37 ++++++
.../views/us_payroll_config_views.xml | 7 +
8 files changed, 229 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/ne_nebraska.xml
create mode 100644 l10n_us_hr_payroll/models/state/ne_nebraska.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_ne_nebraska_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index c8a0acaf..65318ff4 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -47,6 +47,7 @@ United States of America - Payroll Rules.
'data/state/ms_mississippi.xml',
'data/state/mt_montana.xml',
'data/state/nc_northcarolina.xml',
+ 'data/state/ne_nebraska.xml',
'data/state/nh_new_hampshire.xml',
'data/state/nj_newjersey.xml',
'data/state/nm_new_mexico.xml',
diff --git a/l10n_us_hr_payroll/data/state/ne_nebraska.xml b/l10n_us_hr_payroll/data/state/ne_nebraska.xml
new file mode 100644
index 00000000..4db292ba
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/ne_nebraska.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ US NE Nebraska SUTA Wage Base
+ us_ne_suta_wage_base
+
+
+
+
+ 9000.0
+
+
+
+
+
+
+
+ US NE Nebraska SUTA Rate
+ us_ne_suta_rate
+
+
+
+
+ 1.25
+
+
+
+
+
+
+ US NE Nebraska SIT Tax Rate
+ us_ne_sit_tax_rate
+
+
+
+
+ {
+ 'single': {
+ 'weekly': ((57, 0.00, 0.0), (105, 0.00, 2.26), (342, 1.08, 3.22), (496, 8.71, 4.91), (629, 16.27, 6.20), (1182, 24.52, 6.59), ('inf', 60.96, 6.95)),
+ 'bi-weekly': ((114, 0.00, 0.0), (211, 0.00, 2.26), (684, 2.19, 3.22), (992, 17.42, 4.91), (1259, 32.54, 6.20), (2364, 49.09, 6.59), ('inf', 121.91, 6.95)),
+ 'semi-monthly': ((124, 0.00, 0.0), (228, 0.00, 2.26), (741, 2.35, 3.22), (1074, 18.87, 4.91), (1364, 35.22, 6.20), (2561, 53.20, 6.59), ('inf', 132.08, 6.95)),
+ 'monthly': ((248, 0.00, 0.0), (457, 0.00, 2.26), (1483, 4.72, 3.22), (2148, 37.76, 4.91), (2728, 70.41, 6.20), (5123, 106.37, 6.59), ('inf', 264.20, 6.95)),
+ 'quarterly': ((744, 0.00, 0.0), (1370, 0.00, 2.26), (4448, 14.15, 3.22), (6445, 113.26, 4.91), (8183, 211.31, 6.20), (15368, 319.07, 6.59), ('inf', 792.56, 6.95)),
+ 'semi-annual': ((1488, 0.00, 0.0), (2740, 0.00, 2.26), (8895, 28.30, 3.22), (12890, 226.49, 4.91), (16365, 422.64, 6.20), (30735, 638.09, 6.59), ('inf', 1585.07, 6.95)),
+ 'annually': ((2975, 0.00, 0.0), (5480, 0.00, 2.26), (17790, 56.61, 3.22), (25780, 452.99, 4.91), (32730, 845.30, 6.20), (61470, 1276.20, 6.59), ('inf', 3170.17, 6.95)),
+ },
+ 'married': {
+ 'weekly': ((137, 0.00, 0.0), (204, 0.00, 2.26), (508, 1.51, 3.22), (790, 11.30, 4.91), (981, 25.15, 6.20), (1300, 36.99, 6.59), ('inf', 58.01, 6.95)),
+ 'bi-weekly': ((273, 0.00, 0.0), (408, 0.00, 2.26), (1016, 3.05, 3.22), (1581, 22.63, 4.91), (1961, 50.37, 6.20), (2601, 73.93, 6.59), ('inf', 116.11, 6.95)),
+ 'semi-monthly': ((296, 0.00, 0.0), (442, 0.00, 2.26), (1101, 3.30, 3.22), (1713, 24.52, 4.91), (2125, 54.57, 6.20), (2818, 80.11, 6.59), ('inf', 125.78, 6.95)),
+ 'monthly': ((592, 0.00, 0.0), (884, 0.00, 2.26), (2202, 6.60, 3.22), (3425, 49.04, 4.91), (4249, 109.09, 6.20), (5635, 160.18, 6.59), ('inf', 251.52, 6.95)),
+ 'quarterly': ((1775, 0.00, 0.0), (2653, 0.00, 2.26), (6605, 19.84, 3.22), (10275, 147.09, 4.91), (12748, 327.29, 6.20), (16905, 480.62, 6.59), ('inf', 754.57, 6.95)),
+ 'semi-annual': ((3550, 0.00, 0.0), (5305, 0.00, 2.26), (13210, 39.66, 3.22), (20550, 294.20, 4.91), (25495, 654.59, 6.20), (33810, 961.18, 6.59), ('inf', 1509.14, 6.95)),
+ 'annually': ((7100, 0.00, 0.0), (10610, 0.00, 2.26), (26420, 79.33, 3.22), (41100, 588.41, 4.91), (50990, 1309.20, 6.20), (67620, 1992.38, 6.59), ('inf', 3018.30, 6.95)),
+ },
+ }
+
+
+
+
+
+
+ US NE Nebraska Allowances Rate
+ us_ne_sit_allowances_rate
+
+
+
+
+ {
+ 'weekly' : 37.69,
+ 'bi-weekly' : 75.38,
+ 'semi-monthly': 81.67,
+ 'monthly' : 163.33,
+ 'quarterly' : 490.00,
+ 'semi-annual': 980.00,
+ 'annually': 1960.00,
+ }
+
+
+
+
+
+
+
+
+ US Nebraska - Nebraska Department of Labor - Unemployment Tax
+
+
+
+ US Nebraska - Nebraska Department of Revenue - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US NE Nebraska State Unemployment
+ ER_US_NE_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ne_suta_wage_base', rate='us_ne_suta_rate', state_code='NE')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ne_suta_wage_base', rate='us_ne_suta_rate', state_code='NE')
+
+
+
+
+
+
+
+
+ EE: US NE Nebraska State Income Tax Withholding
+ EE_US_NE_SIT
+ python
+ result, _ = ne_nebraska_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = ne_nebraska_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index a35f3b38..a45a9613 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -32,6 +32,7 @@ from .state.mo_missouri import mo_missouri_state_income_withholding
from .state.ms_mississippi import ms_mississippi_state_income_withholding
from .state.mt_montana import mt_montana_state_income_withholding
from .state.nc_northcarolina import nc_northcarolina_state_income_withholding
+from .state.ne_nebraska import ne_nebraska_state_income_withholding
from .state.nj_newjersey import nj_newjersey_state_income_withholding
from .state.nm_new_mexico import nm_new_mexico_state_income_withholding
from .state.oh_ohio import oh_ohio_state_income_withholding
@@ -90,6 +91,7 @@ class HRPayslip(models.Model):
'ms_mississippi_state_income_withholding': ms_mississippi_state_income_withholding,
'mt_montana_state_income_withholding': mt_montana_state_income_withholding,
'nc_northcarolina_state_income_withholding': nc_northcarolina_state_income_withholding,
+ 'ne_nebraska_state_income_withholding': ne_nebraska_state_income_withholding,
'nj_newjersey_state_income_withholding': nj_newjersey_state_income_withholding,
'nm_new_mexico_state_income_withholding': nm_new_mexico_state_income_withholding,
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/ne_nebraska.py b/l10n_us_hr_payroll/models/state/ne_nebraska.py
new file mode 100644
index 00000000..9b360778
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/ne_nebraska.py
@@ -0,0 +1,49 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def ne_nebraska_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+ WAGE = GROSS + DED_FIT_EXEMPT
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'NE'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ personal_exempt = payslip.contract_id.us_payroll_config_value('state_income_tax_exempt')
+ if personal_exempt:
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ filing_status = payslip.contract_id.us_payroll_config_value('ne_w4n_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ schedule_pay = payslip.contract_id.schedule_pay
+ additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ allowances = payslip.contract_id.us_payroll_config_value('ne_w4n_sit_allowances')
+ tax_rate = payslip.rule_parameter('us_ne_sit_tax_rate')[filing_status].get(schedule_pay)
+ sit_allowance = payslip.rule_parameter('us_ne_sit_allowances_rate')[schedule_pay]
+
+ allowance_amt = allowances * sit_allowance
+ taxable_income = wage - allowance_amt
+ withholding = 0.0
+ last = 0.0
+ for row in tax_rate:
+ amt, flat_fee, rate = row
+ if taxable_income < float(amt):
+ withholding = ((taxable_income - last) * (rate / 100)) + flat_fee
+ break
+ last = amt
+
+ withholding = max(withholding, 0.0)
+ withholding += additional
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index 5abc4759..3677d3e2 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -182,6 +182,12 @@ class HRContractUSPayrollConfig(models.Model):
], string='North Carolina NC-4 Filing Status', help='NC-4')
nc_nc4_sit_allowances = fields.Integer(string='North Carolina NC-4 Allowances', help='NC-4 1.')
+ ne_w4n_sit_filing_status = fields.Selection([
+ ('single', 'Single'),
+ ('married', 'Married'),
+ ], string='Nebraska NE W-4N Filing Status', help='NE W-4N')
+ ne_w4n_sit_allowances = fields.Integer(string='Nebraska NE W-4N Allowances', help='NE W-4N 1.')
+
nj_njw4_sit_filing_status = fields.Selection([
('', 'Exempt'),
('single', 'Single'),
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 85be27cb..06c618b6 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -67,6 +67,8 @@ from . import test_us_mt_montana_payslip_2020
from . import test_us_nc_northcarolina_payslip_2019
from . import test_us_nc_northcarolina_payslip_2020
+from . import test_us_ne_nebraska_payslip_2020
+
from . import test_us_nh_new_hampshire_payslip_2020
from . import test_us_nj_newjersey_payslip_2019
diff --git a/l10n_us_hr_payroll/tests/test_us_ne_nebraska_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_ne_nebraska_payslip_2020.py
new file mode 100644
index 00000000..bbf2b7b0
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_ne_nebraska_payslip_2020.py
@@ -0,0 +1,37 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsNEPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ NE_UNEMP_MAX_WAGE = 9000.0
+ NE_UNEMP = 1.25
+
+ def _test_sit(self, wage, filing_status, exempt, additional_withholding, allowances, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('NE'),
+ ne_w4n_sit_filing_status=filing_status,
+ state_income_tax_exempt=exempt,
+ state_income_tax_additional_withholding=additional_withholding,
+ ne_w4n_sit_allowances=allowances,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('NE', self.NE_UNEMP, date(2020, 1, 1), wage_base=self.NE_UNEMP_MAX_WAGE)
+ self._test_sit(750.0, 'single', False, 0.0, 2, 'weekly', date(2020, 1, 1), 27.53)
+ self._test_sit(9500.0, 'single', False, 0.0, 1, 'bi-weekly', date(2020, 1, 1), 612.63)
+ self._test_sit(10500.0, 'married', False, 0.0, 1, 'bi-weekly', date(2020, 1, 1), 659.85)
+ self._test_sit(9500.0, 'single', True, 0.0, 1, 'bi-weekly', date(2020, 1, 1), 0.0)
+ self._test_sit(10500.0, 'single', False, 10.0, 2, 'monthly', date(2020, 1, 1), 625.2)
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index a517bdb4..9c95f730 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -167,6 +167,13 @@
+
+ Form NC-4 - State Income Tax
+
+
+
+
+
No additional fields.
From 45e589ba0ad5940867b9019754d4d2a5a748ea18 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Tue, 14 Apr 2020 12:49:34 -0400
Subject: [PATCH 05/20] IMP `l10n_us_hr_payroll` Port `l10n_us_ny_hr_payroll`
NY New York including migration
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/state/ny_new_york.xml | 279 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/ny_new_york.py | 54 ++++
.../models/us_payroll_config.py | 7 +
l10n_us_hr_payroll/tests/__init__.py | 3 +
.../tests/test_us_ny_new_york_payslip_2019.py | 106 +++++++
.../tests/test_us_ny_new_york_payslip_2020.py | 38 +++
.../views/us_payroll_config_views.xml | 6 +
9 files changed, 496 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/ny_new_york.xml
create mode 100644 l10n_us_hr_payroll/models/state/ny_new_york.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_ny_new_york_payslip_2019.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_ny_new_york_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 65318ff4..f49d1257 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -51,6 +51,7 @@ United States of America - Payroll Rules.
'data/state/nh_new_hampshire.xml',
'data/state/nj_newjersey.xml',
'data/state/nm_new_mexico.xml',
+ 'data/state/ny_new_york.xml',
'data/state/oh_ohio.xml',
'data/state/pa_pennsylvania.xml',
'data/state/sc_south_carolina.xml',
diff --git a/l10n_us_hr_payroll/data/state/ny_new_york.xml b/l10n_us_hr_payroll/data/state/ny_new_york.xml
new file mode 100644
index 00000000..d3f4cc10
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/ny_new_york.xml
@@ -0,0 +1,279 @@
+
+
+
+
+ US NY New York SUTA Wage Base
+ us_ny_suta_wage_base
+
+
+
+
+ 14000.0
+
+
+
+
+ 14000.0
+
+
+
+
+
+
+
+ US NY New York SUTA Rate
+ us_ny_suta_rate
+
+
+
+
+ 1.09
+
+
+
+
+ 3.295
+
+
+
+
+
+
+ US NY New York SUTA RSF Rate
+ us_ny_suta_rsf_rate
+
+
+
+
+ 0.075
+
+
+
+
+ 0.075
+
+
+
+
+
+
+ US NY New York SUTA MCTMT Rate
+ us_ny_suta_mctmt_rate
+
+
+
+
+ 0.0
+
+
+
+
+ 0.0
+
+
+
+
+
+
+ US NY New York SIT Tax Rate
+ us_ny_sit_tax_rate
+
+
+
+
+ {
+ 'single': {
+ 'weekly': ((163, 0.0400, 0.0), (225, 0.0450, 6.54), (267, 0.0525, 9.31), (412, 0.0590, 11.54), (1551, 0.0633, 20.04), (1862, 0.0657, 92.17), (2070, 0.0758, 112.58), (3032, 0.0808, 128.38), (4142, 0.0707, 206.08), (5104, 0.0856, 284.60), (20722, 0.0735, 366.90), (21684, 0.5208, 1514.85), ('inf', 0.0962, 2015.62)),
+ 'bi-weekly': ((327, 0.0400, 0.0), (450, 0.0450, 13.08), (535, 0.0525, 18.62), (823, 0.0590, 23.08), (3102, 0.0633, 40.08), (3723, 0.0657, 184.35), (4140, 0.0758, 225.15), (6063, 0.0808, 256.77), (8285, 0.0707, 412.15), (10208, 0.0856, 569.19), (41444, 0.0735, 733.81), (43367, 0.5208, 3029.69), ('inf', 0.0962, 4021.23)),
+ 'semi-monthly': ((354, 0.0400, 0.0), (488, 0.0450, 14.17), (579, 0.0525, 20.17), (892, 0.0590, 25.00), (3360, 0.0633, 43.42), (4033, 0.0657, 199.71), (4485, 0.0758, 243.92), (6569, 0.0808, 278.17), (8975, 0.0707, 446.50), (11058, 0.0856, 616.63), (44898, 0.0735, 794.96), (46981, 0.5208, 3282.17), ('inf', 0.0962, 4367.17)),
+ 'monthly': ((708, 0.0400, 0.0), (975, 0.0450, 28.33), (1158, 0.0525, 40.33), (1783, 0.0590, 50.00), (6721, 0.0633, 86.83), (8067, 0.0657, 399.42), (8971, 0.0758, 487.83), (13138, 0.0808, 556.33), (17950, 0.0707, 893.00), (22117, 0.0856, 1233.25), (89796, 0.0735, 1589.92), (93963, 0.5208, 6564.33), ('inf', 0.0962, 8734.33)),
+ 'annually': ((8500, 0.0400, 0.0), (11700, 0.0450, 340.00), (13900, 0.0525, 484.00), (21400, 0.0590, 600.00), (80650, 0.0633, 1042.00), (96800, 0.0657, 4793.00), (107650, 0.0758, 5854.00), (157650, 0.0808, 6676.00), (215400, 0.0707, 10716.00), (265400, 0.0856, 14799.00), (1077550, 0.0735, 19079.00), (1127550, 0.5208, 78772.00), ('inf', 0.0962, 104812.00)),
+ },
+ 'married': {
+ 'weekly': ((163, 0.0400, 0.0), (225, 0.0450, 6.54), (267, 0.0525, 9.31), (412, 0.0590, 11.54), (1551, 0.0633, 20.04), (1862, 0.0657, 92.17), (2070, 0.0783, 112.58), (3032, 0.0833, 128.90), (4068, 0.0785, 209.00), (6215, 0.0707, 290.37), (7177, 0.0916, 442.17), (20722, 0.0735, 530.25), (41449, 0.0765, 1525.83), (42411, 0.9454, 3111.42), ('inf', 0.0962, 4020.46)),
+ 'bi-weekly': ((327, 0.0400, 0.0), (450, 0.0450, 13.08), (535, 0.0525, 18.62), (823, 0.0590, 23.08), (3102, 0.0633, 40.08), (3723, 0.0657, 184.35), (4140, 0.0783, 225.15), (6063, 0.0833, 257.81), (8137, 0.0785, 418.00), (12431, 0.0707, 580.73), (14354, 0.0916, 884.35), (41444, 0.0735, 1060.50), (82898, 0.0765, 3051.65), (84821, 0.9454, 6222.85), ('inf', 0.0962, 8040.92)),
+ 'semi-monthly': ((354, 0.0400, 0.0), (488, 0.0450, 14.17), (579, 0.0525, 20.17), (892, 0.0590, 25.00), (3360, 0.0633, 43.42), (4033, 0.0657, 199.71), (4485, 0.0783, 243.92), (6569, 0.0833, 279.29), (8815, 0.0785, 452.83), (13476, 0.0707, 629.13), (15550, 0.0916, 958.04), (44898, 0.0735, 1148.88), (89806, 0.0765, 3305.96), (91890, 0.9454, 6741.42), ('inf', 0.0962, 8711.00)),
+ 'monthly': ((708, 0.0400, 0.0), (975, 0.0450, 28.33), (1158, 0.0525, 40.33), (1783, 0.0590, 50.00), (6721, 0.0633, 86.83), (8067, 0.0657, 399.42), (8971, 0.0783, 487.83), (13138, 0.0833, 558.58), (17629, 0.0785, 905.67), (26933, 0.0707, 1258.25), (31100, 0.0916, 1916.08), (89796, 0.0735, 2297.75), (179613, 0.0765, 6611.92), (183779, 0.9454, 13482.83), ('inf', 0.0962, 17422.00)),
+ 'annually': ((8500, 0.0400, 0.0), (11700, 0.0450, 340.00), (13900, 0.0525, 484.00), (21400, 0.0590, 600.00), (80650, 0.0633, 1042.00), (96800, 0.0657, 4793.00), (107650, 0.0783, 5854.00), (157650, 0.0833, 6703.00), (211550, 0.0785, 10868.00), (323200, 0.0707, 15099.00), (373200, 0.0916, 22993.00), (1077550, 0.0735, 27573.00), (2155350, 0.0765, 79343.00), (2205350, 0.9454, 161794.00), ('inf', 0.0962, 209064.00)),
+ }
+ }
+
+
+
+
+ {
+ 'single': {
+ 'weekly': ((163, 0.0400, 0.0), (225, 0.0450, 6.54), (267, 0.0525, 9.31), (412, 0.0590, 11.54), (1551, 0.0633, 20.04), (1862, 0.0657, 92.17), (2070, 0.0758, 112.58), (3032, 0.0808, 128.38), (4142, 0.0707, 206.08), (5104, 0.0856, 284.60), (20722, 0.0735, 366.90), (21684, 0.5208, 1514.85), ('inf', 0.0962, 2015.62)),
+ 'bi-weekly': ((327, 0.0400, 0.0), (450, 0.0450, 13.08), (535, 0.0525, 18.62), (823, 0.0590, 23.08), (3102, 0.0633, 40.08), (3723, 0.0657, 184.35), (4140, 0.0758, 225.15), (6063, 0.0808, 256.77), (8285, 0.0707, 412.15), (10208, 0.0856, 569.19), (41444, 0.0735, 733.81), (43367, 0.5208, 3029.69), ('inf', 0.0962, 4021.23)),
+ 'semi-monthly': ((354, 0.0400, 0.0), (488, 0.0450, 14.17), (579, 0.0525, 20.17), (892, 0.0590, 25.00), (3360, 0.0633, 43.42), (4033, 0.0657, 199.71), (4485, 0.0758, 243.92), (6569, 0.0808, 278.17), (8975, 0.0707, 446.50), (11058, 0.0856, 616.63), (44898, 0.0735, 794.96), (46981, 0.5208, 3282.17), ('inf', 0.0962, 4367.17)),
+ 'monthly': ((708, 0.0400, 0.0), (975, 0.0450, 28.33), (1158, 0.0525, 40.33), (1783, 0.0590, 50.00), (6721, 0.0633, 86.83), (8067, 0.0657, 399.42), (8971, 0.0758, 487.83), (13138, 0.0808, 556.33), (17950, 0.0707, 893.00), (22117, 0.0856, 1233.25), (89796, 0.0735, 1589.92), (93963, 0.5208, 6564.33), ('inf', 0.0962, 8734.33)),
+ 'annually': ((8500, 0.0400, 0.0), (11700, 0.0450, 340.00), (13900, 0.0525, 484.00), (21400, 0.0590, 600.00), (80650, 0.0633, 1042.00), (96800, 0.0657, 4793.00), (107650, 0.0758, 5854.00), (157650, 0.0808, 6676.00), (215400, 0.0707, 10716.00), (265400, 0.0856, 14799.00), (1077550, 0.0735, 19079.00), (1127550, 0.5208, 78772.00), ('inf', 0.0962, 104812.00)),
+ },
+ 'married': {
+ 'weekly': ((163, 0.0400, 0.0), (225, 0.0450, 6.54), (267, 0.0525, 9.31), (412, 0.0590, 11.54), (1551, 0.0633, 20.04), (1862, 0.0657, 92.17), (2070, 0.0783, 112.58), (3032, 0.0833, 128.90), (4068, 0.0785, 209.00), (6215, 0.0707, 290.37), (7177, 0.0916, 442.17), (20722, 0.0735, 530.25), (41449, 0.0765, 1525.83), (42411, 0.9454, 3111.42), ('inf', 0.0962, 4020.46)),
+ 'bi-weekly': ((327, 0.0400, 0.0), (450, 0.0450, 13.08), (535, 0.0525, 18.62), (823, 0.0590, 23.08), (3102, 0.0633, 40.08), (3723, 0.0657, 184.35), (4140, 0.0783, 225.15), (6063, 0.0833, 257.81), (8137, 0.0785, 418.00), (12431, 0.0707, 580.73), (14354, 0.0916, 884.35), (41444, 0.0735, 1060.50), (82898, 0.0765, 3051.65), (84821, 0.9454, 6222.85), ('inf', 0.0962, 8040.92)),
+ 'semi-monthly': ((354, 0.0400, 0.0), (488, 0.0450, 14.17), (579, 0.0525, 20.17), (892, 0.0590, 25.00), (3360, 0.0633, 43.42), (4033, 0.0657, 199.71), (4485, 0.0783, 243.92), (6569, 0.0833, 279.29), (8815, 0.0785, 452.83), (13476, 0.0707, 629.13), (15550, 0.0916, 958.04), (44898, 0.0735, 1148.88), (89806, 0.0765, 3305.96), (91890, 0.9454, 6741.42), ('inf', 0.0962, 8711.00)),
+ 'monthly': ((708, 0.0400, 0.0), (975, 0.0450, 28.33), (1158, 0.0525, 40.33), (1783, 0.0590, 50.00), (6721, 0.0633, 86.83), (8067, 0.0657, 399.42), (8971, 0.0783, 487.83), (13138, 0.0833, 558.58), (17629, 0.0785, 905.67), (26933, 0.0707, 1258.25), (31100, 0.0916, 1916.08), (89796, 0.0735, 2297.75), (179613, 0.0765, 6611.92), (183779, 0.9454, 13482.83), ('inf', 0.0962, 17422.00)),
+ 'annually': ((8500, 0.0400, 0.0), (11700, 0.0450, 340.00), (13900, 0.0525, 484.00), (21400, 0.0590, 600.00), (80650, 0.0633, 1042.00), (96800, 0.0657, 4793.00), (107650, 0.0783, 5854.00), (157650, 0.0833, 6703.00), (211550, 0.0785, 10868.00), (323200, 0.0707, 15099.00), (373200, 0.0916, 22993.00), (1077550, 0.0735, 27573.00), (2155350, 0.0765, 79343.00), (2205350, 0.9454, 161794.00), ('inf', 0.0962, 209064.00)),
+ }
+ }
+
+
+
+
+
+
+ US NY New York Over 10 Exemption Rate
+ us_ny_sit_over_10_exemption_rate
+
+
+
+
+ {
+ 'weekly': (142.30, 152.90, 19.25),
+ 'bi-weekly': (284.60, 305.80, 38.50),
+ 'semi-monthly': (308.35, 331.25, 41.65),
+ 'monthly': (616.70, 662.50, 83.30),
+ 'annual': (7400, 7950, 1000),
+ }
+
+
+
+
+ {
+ 'weekly': (142.30, 152.90, 19.25),
+ 'bi-weekly': (284.60, 305.80, 38.50),
+ 'semi-monthly': (308.35, 331.25, 41.65),
+ 'monthly': (616.70, 662.50, 83.30),
+ 'annual': (7400, 7950, 1000),
+ }
+
+
+
+
+
+
+ US NY New York Deduction Exemption Rate
+ us_ny_sit_deduction_exemption_rate
+
+
+
+
+ {
+ 'single': {
+ 'weekly': (142.30, 161.55, 180.80, 200.05, 219.30, 238.55, 257.80, 277.05, 296.30, 315.55, 334.80),
+ 'bi-weekly': (284.60, 323.10, 361.60, 400.10, 438.60, 477.10, 515.60, 544.10, 592.60, 631.10, 669.60),
+ 'semi-monthly': (308.35, 350.0, 391.65, 433.30, 474.95, 516.60, 558.25, 599.90, 641.55, 683.20, 724.85),
+ 'monthly': (616.70, 700, 783.30, 866.60, 949.90, 1033.20, 1116.50, 1199.80, 1283.10, 1366.40, 1449.70),
+ 'annually': (7400, 8400, 9400, 10400, 11400, 12400, 13400, 14400, 15400, 16400, 17400),
+ },
+ 'married': {
+ 'weekly': (152.90, 172.15, 191.40, 210.65, 229.90, 249.15, 268.40, 287.65, 306.90, 326.15, 345.40),
+ 'bi-weekly': (305.80, 344.30, 382.80, 421.30, 459.80, 498.30, 536.80, 575.30, 613.80, 652.30, 690.80),
+ 'semi-monthly': (331.25, 372.90, 414.55, 456.20, 497.85, 539.50, 581.15, 622.80, 664.45, 706.10, 747.75),
+ 'monthly': (662.50, 745.80, 829.10, 912.40, 995.70, 1079.00, 1162.30, 1245.60, 1328.90, 1412.20, 1495.50),
+ 'annually': (7950, 8950, 9950, 10950, 11950, 12950, 13950, 14950, 15950, 16950, 17950),
+ },
+ }
+
+
+
+
+ {
+ 'single': {
+ 'weekly': (142.30, 161.55, 180.80, 200.05, 219.30, 238.55, 257.80, 277.05, 296.30, 315.55, 334.80),
+ 'bi-weekly': (284.60, 323.10, 361.60, 400.10, 438.60, 477.10, 515.60, 544.10, 592.60, 631.10, 669.60),
+ 'semi-monthly': (308.35, 350.0, 391.65, 433.30, 474.95, 516.60, 558.25, 599.90, 641.55, 683.20, 724.85),
+ 'monthly': (616.70, 700, 783.30, 866.60, 949.90, 1033.20, 1116.50, 1199.80, 1283.10, 1366.40, 1449.70),
+ 'annually': (7400, 8400, 9400, 10400, 11400, 12400, 13400, 14400, 15400, 16400, 17400),
+ },
+ 'married': {
+ 'weekly': (152.90, 172.15, 191.40, 210.65, 229.90, 249.15, 268.40, 287.65, 306.90, 326.15, 345.40),
+ 'bi-weekly': (305.80, 344.30, 382.80, 421.30, 459.80, 498.30, 536.80, 575.30, 613.80, 652.30, 690.80),
+ 'semi-monthly': (331.25, 372.90, 414.55, 456.20, 497.85, 539.50, 581.15, 622.80, 664.45, 706.10, 747.75),
+ 'monthly': (662.50, 745.80, 829.10, 912.40, 995.70, 1079.00, 1162.30, 1245.60, 1328.90, 1412.20, 1495.50),
+ 'annually': (7950, 8950, 9950, 10950, 11950, 12950, 13950, 14950, 15950, 16950, 17950),
+ },
+ }
+
+
+
+
+
+
+
+ US New York - Department of Taxation and Finance - Unemployment Tax
+
+
+
+ US New York - Department of Taxation and Finance - Re-employment Service Fund
+
+
+
+ US New York - Department of Taxation and Finance - Metropolitan Commuter Transportation Mobility Tax
+
+
+
+ US New York - Department of Taxation and Finance - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US NY New York State Unemployment
+ ER_US_NY_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ny_suta_wage_base', rate='us_ny_suta_rate', state_code='NY')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ny_suta_wage_base', rate='us_ny_suta_rate', state_code='NY')
+
+
+
+
+
+
+
+
+ ER: US NY New York State Re-employment Service Fund
+ ER_US_NY_SUTA_RSF
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ny_suta_wage_base', rate='us_ny_suta_rsf_rate', state_code='NY')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ny_suta_wage_base', rate='us_ny_suta_rsf_rate', state_code='NY')
+
+
+
+
+
+
+
+
+ ER: US NY New York State Metropolitan Commuter Transportation Mobility Tax
+ ER_US_NY_SUTA_MCTMT
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ny_suta_wage_base', rate='us_ny_suta_mctmt_rate', state_code='NY')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ny_suta_wage_base', rate='us_ny_suta_mctmt_rate', state_code='NY')
+
+
+
+
+
+
+
+
+ EE: US NY New York State Income Tax Withholding
+ EE_US_NY_SIT
+ python
+ result, _ = ny_new_york_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = ny_new_york_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index a45a9613..08207043 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -35,6 +35,7 @@ from .state.nc_northcarolina import nc_northcarolina_state_income_withholding
from .state.ne_nebraska import ne_nebraska_state_income_withholding
from .state.nj_newjersey import nj_newjersey_state_income_withholding
from .state.nm_new_mexico import nm_new_mexico_state_income_withholding
+from .state.ny_new_york import ny_new_york_state_income_withholding
from .state.oh_ohio import oh_ohio_state_income_withholding
from .state.sc_south_carolina import sc_south_carolina_state_income_withholding
from .state.va_virginia import va_virginia_state_income_withholding
@@ -94,6 +95,7 @@ class HRPayslip(models.Model):
'ne_nebraska_state_income_withholding': ne_nebraska_state_income_withholding,
'nj_newjersey_state_income_withholding': nj_newjersey_state_income_withholding,
'nm_new_mexico_state_income_withholding': nm_new_mexico_state_income_withholding,
+ 'ny_new_york_state_income_withholding': ny_new_york_state_income_withholding,
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
'sc_south_carolina_state_income_withholding': sc_south_carolina_state_income_withholding,
'va_virginia_state_income_withholding': va_virginia_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/ny_new_york.py b/l10n_us_hr_payroll/models/state/ny_new_york.py
new file mode 100644
index 00000000..1a710b32
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/ny_new_york.py
@@ -0,0 +1,54 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def ny_new_york_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'NY'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ filing_status = payslip.contract_id.us_payroll_config_value('ny_it2104_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ schedule_pay = payslip.contract_id.schedule_pay
+ additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ tax_table = payslip.rule_parameter('us_ny_sit_tax_rate')[filing_status].get(schedule_pay)
+ allowances = payslip.contract_id.us_payroll_config_value('ny_it2104_sit_allowances')
+ over_10_deduction = payslip.rule_parameter('us_ny_sit_over_10_exemption_rate')[schedule_pay]
+ deduction_exemption = payslip.rule_parameter('us_ny_sit_deduction_exemption_rate')[filing_status].get(schedule_pay)
+
+ if allowances > 10:
+ if filing_status == 'single':
+ wage -= over_10_deduction[0] + over_10_deduction[2] * allowances
+ elif filing_status == 'married':
+ wage -= over_10_deduction[1] + over_10_deduction[2] * allowances
+
+ else:
+ if filing_status == 'single':
+ wage -= deduction_exemption[allowances]
+ elif filing_status == 'married':
+ wage -= deduction_exemption[allowances]
+ last = 0.0
+ withholding = 0.0
+ for row in tax_table:
+ amt, rate, flat_fee = row
+ if wage <= float(amt):
+ withholding = ((wage - last) * rate) + flat_fee
+ break
+ last = amt
+
+ withholding = max(withholding, 0.0)
+ withholding += additional
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index 3677d3e2..1e03673e 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -205,6 +205,13 @@ class HRContractUSPayrollConfig(models.Model):
('E', 'E')
], string='New Jersey Wage Chart Letter', help='NJ-W4. 3.')
+ ny_it2104_sit_filing_status = fields.Selection([
+ ('', 'Exempt'),
+ ('single', 'Single'),
+ ('married', 'Married'),
+ ], string='New York NY IT-2104 Filing Status', help='NY IT-2104')
+ ny_it2104_sit_allowances = fields.Integer(string="New York IT-2104 Allowances", help="NY IT-2104 1. 2.")
+
# Ohio will use generic SIT exempt and additional fields
oh_it4_sit_exemptions = fields.Integer(string='Ohio IT-4 Exemptions',
help='Line 4')
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 06c618b6..6a153fbf 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -76,6 +76,9 @@ from . import test_us_nj_newjersey_payslip_2020
from . import test_us_nm_new_mexico_payslip_2020
+from . import test_us_ny_new_york_payslip_2019
+from . import test_us_ny_new_york_payslip_2020
+
from . import test_us_oh_ohio_payslip_2019
from . import test_us_oh_ohio_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_ny_new_york_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_ny_new_york_payslip_2019.py
new file mode 100644
index 00000000..d3e146de
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_ny_new_york_payslip_2019.py
@@ -0,0 +1,106 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .common import TestUsPayslip, process_payslip
+
+
+class TestUsNYPayslip(TestUsPayslip):
+ ###
+ # Taxes and Rates
+ ###
+ NY_UNEMP_MAX_WAGE = 14000
+ NY_UNEMP = 3.295
+ NY_RSF = 0.075
+ NY_MCTMT = 0.0
+
+ def test_single_example1(self):
+ salary = 400
+ schedule_pay = 'weekly'
+ allowances = 3
+ additional_withholding = 0
+ filing_status = 'single'
+ additional = 0.0
+ wh = -8.20
+
+ employee = self._createEmployee()
+
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('NY'),
+ ny_it2104_sit_filing_status=filing_status,
+ state_income_tax_additional_withholding=additional,
+ ny_it2104_sit_allowances=allowances,
+ schedule_pay=schedule_pay)
+
+ self.assertEqual(contract.schedule_pay, 'weekly')
+ self._log('2018 New York tax first payslip:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+
+ payslip.compute_sheet()
+
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['NY_UNEMP'], cats['NY_UNEMP_WAGES'] * self.NY_UNEMP)
+ self.assertPayrollEqual(cats['NY_RSF'], cats['NY_UNEMP_WAGES'] * self.NY_RSF)
+ self.assertPayrollEqual(cats['NY_MCTMT'], cats['NY_UNEMP_WAGES'] * self.NY_MCTMT)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh)
+
+ process_payslip(payslip)
+
+ def test_married_example2(self):
+ salary = 5000
+ schedule_pay = 'semi-monthly'
+ allowances = 3
+ additional = 0
+ filing_status = 'married'
+ wh = -284.19
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('NY'),
+ ny_it2104_sit_filing_status=filing_status,
+ state_income_tax_additional_withholding=additional,
+ ny_it2104_sit_allowances=allowances,
+ schedule_pay=schedule_pay)
+
+ self._log('2019 New York tax first payslip:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+
+ payslip.compute_sheet()
+
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['NY_UNEMP'], cats['NY_UNEMP_WAGES'] * self.NY_UNEMP)
+ self.assertPayrollEqual(cats['NY_RSF'], cats['NY_UNEMP_WAGES'] * self.NY_RSF)
+ self.assertPayrollEqual(cats['NY_MCTMT'], cats['NY_UNEMP_WAGES'] * self.NY_MCTMT)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh)
+
+ process_payslip(payslip)
+
+ def test_single_example3(self):
+ salary = 50000
+ schedule_pay = 'monthly'
+ allowances = 3
+ additional = 0
+ filing_status = 'single'
+ wh = -3575.63
+
+ employee = self._createEmployee()
+
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('NY'),
+ ny_it2104_sit_filing_status=filing_status,
+ state_income_tax_additional_withholding=additional,
+ ny_it2104_sit_allowances=allowances,
+ schedule_pay=schedule_pay)
+
+ self._log('2019 New York tax first payslip:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+
+ payslip.compute_sheet()
+
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh)
+
diff --git a/l10n_us_hr_payroll/tests/test_us_ny_new_york_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_ny_new_york_payslip_2020.py
new file mode 100644
index 00000000..29fbc0cb
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_ny_new_york_payslip_2020.py
@@ -0,0 +1,38 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsNYPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ NY_UNEMP_MAX_WAGE = 14000.0
+ NY_UNEMP = 3.295
+ NY_RSF = 0.075
+ NY_MCTMT = 0.0
+
+ def _test_sit(self, wage, filing_status, additional_withholding, allowances, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('NY'),
+ ny_it2104_sit_filing_status=filing_status,
+ state_income_tax_additional_withholding=additional_withholding,
+ ny_it2104_sit_allowances=allowances,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ combined_er_rate = self.NY_UNEMP + self.NY_RSF + self.NY_MCTMT
+ self._test_er_suta('NY', combined_er_rate, date(2020, 1, 1), wage_base=self.NY_UNEMP_MAX_WAGE, relaxed=True)
+ self._test_sit(400.0, 'single', 0.0, 3, 'weekly', date(2020, 1, 1), 8.20)
+ self._test_sit(50000.0, 'single', 0.0, 3, 'monthly', date(2020, 1, 1), 3575.63)
+ self._test_sit(50000.0, 'married', 0.0, 3, 'monthly', date(2020, 1, 1), 3619.82)
+ self._test_sit(50000.0, 'married', 10.0, 3, 'monthly', date(2020, 1, 1), 3629.83)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index 9c95f730..9abb2c5f 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -188,6 +188,12 @@
Form NM W-4 - State Income Tax
+
+ Form NY IT-2104 - State Income Tax
+
+
+
+
Form IT-4 - State Income Tax
From 0b3ba3d3b6fed33d2d263df22b8960d5b628e73f Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Tue, 28 Apr 2020 15:01:09 -0400
Subject: [PATCH 06/20] [IMP] l10n_us_hr_payroll: For North Dakota 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
.../data/state/nd_north_dakota.xml | 110 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/nd_north_dakota.py | 43 +++++++
.../models/us_payroll_config.py | 6 +
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../test_us_nd_north_dakota_payslip_2020.py | 35 ++++++
.../views/us_payroll_config_views.xml | 5 +
8 files changed, 204 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/nd_north_dakota.xml
create mode 100644 l10n_us_hr_payroll/models/state/nd_north_dakota.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_nd_north_dakota_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index f49d1257..62667473 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -47,6 +47,7 @@ United States of America - Payroll Rules.
'data/state/ms_mississippi.xml',
'data/state/mt_montana.xml',
'data/state/nc_northcarolina.xml',
+ 'data/state/nd_north_dakota.xml',
'data/state/ne_nebraska.xml',
'data/state/nh_new_hampshire.xml',
'data/state/nj_newjersey.xml',
diff --git a/l10n_us_hr_payroll/data/state/nd_north_dakota.xml b/l10n_us_hr_payroll/data/state/nd_north_dakota.xml
new file mode 100644
index 00000000..6ab1c168
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/nd_north_dakota.xml
@@ -0,0 +1,110 @@
+
+
+
+
+ US ND North Dakota SUTA Wage Base
+ us_nd_suta_wage_base
+
+
+
+
+ 37900.0
+
+
+
+
+
+
+
+ US ND North Dakota SUTA Rate
+ us_nd_suta_rate
+
+
+
+
+ 1.02
+
+
+
+
+
+
+ US ND North Dakota SIT Tax Rate
+ us_nd_sit_tax_rate
+
+
+
+
+ {
+ 'single': (
+ ( 6200, 0.00, 0.00),
+ ( 46325, 0.00, 1.10),
+ ( 103350, 441.38, 2.04),
+ ( 208850, 1604.69, 2.27),
+ ( 446800, 3999.54, 2.64),
+ ( 'inf',10281.42, 2.90),
+ ),
+ 'married': (
+ ( 12400, 0.00, 0.00),
+ ( 45925, 0.00, 1.10),
+ ( 93375, 368.78, 2.04),
+ ( 135750, 1336.76, 2.27),
+ ( 232700, 2298.67, 2.64),
+ ( 'inf', 4858.15, 2.90),
+ ),
+ 'head_household': (
+ ( 9325, 0.00, 0.00),
+ ( 63075, 0.00, 1.10),
+ ( 148125, 591.25, 2.04),
+ ( 234025, 2326.27, 2.27),
+ ( 449925, 4276.20, 2.64),
+ ( 'inf', 9975.96, 2.90),
+ ),
+ }
+
+
+
+
+
+
+
+
+ US North Dakota - Office of State Tax Commissioner - Unemployment Tax
+
+
+
+ US North Dakota - Taxpayer Access Point - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US ND North Dakota State Unemployment
+ ER_US_ND_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nd_suta_wage_base', rate='us_nd_suta_rate', state_code='ND')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nd_suta_wage_base', rate='us_nd_suta_rate', state_code='ND')
+
+
+
+
+
+
+
+
+ EE: US ND North Dakota State Income Tax Withholding
+ EE_US_ND_SIT
+ python
+ result, _ = nd_north_dakota_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = nd_north_dakota_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index 08207043..7eaed9bf 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -32,6 +32,7 @@ from .state.mo_missouri import mo_missouri_state_income_withholding
from .state.ms_mississippi import ms_mississippi_state_income_withholding
from .state.mt_montana import mt_montana_state_income_withholding
from .state.nc_northcarolina import nc_northcarolina_state_income_withholding
+from .state.nd_north_dakota import nd_north_dakota_state_income_withholding
from .state.ne_nebraska import ne_nebraska_state_income_withholding
from .state.nj_newjersey import nj_newjersey_state_income_withholding
from .state.nm_new_mexico import nm_new_mexico_state_income_withholding
@@ -92,6 +93,7 @@ class HRPayslip(models.Model):
'ms_mississippi_state_income_withholding': ms_mississippi_state_income_withholding,
'mt_montana_state_income_withholding': mt_montana_state_income_withholding,
'nc_northcarolina_state_income_withholding': nc_northcarolina_state_income_withholding,
+ 'nd_north_dakota_state_income_withholding': nd_north_dakota_state_income_withholding,
'ne_nebraska_state_income_withholding': ne_nebraska_state_income_withholding,
'nj_newjersey_state_income_withholding': nj_newjersey_state_income_withholding,
'nm_new_mexico_state_income_withholding': nm_new_mexico_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/nd_north_dakota.py b/l10n_us_hr_payroll/models/state/nd_north_dakota.py
new file mode 100644
index 00000000..81136d6e
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/nd_north_dakota.py
@@ -0,0 +1,43 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def nd_north_dakota_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+ WAGE = GROSS + DED_FIT_EXEMPT
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'ND'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ filing_status = payslip.contract_id.us_payroll_config_value('nd_w4_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ pay_periods = payslip.dict.get_pay_periods_in_year()
+ additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ tax_rate = payslip.rule_parameter('us_nd_sit_tax_rate')[filing_status]
+
+ taxable_income = wage * pay_periods
+ withholding = 0.0
+ last = 0.0
+ for row in tax_rate:
+ amt, flat_fee, rate = row
+ if taxable_income < float(amt):
+ withholding = ((taxable_income - last) * (rate / 100)) + flat_fee
+ break
+ last = amt
+
+ withholding = round(withholding / pay_periods)
+ withholding = max(withholding, 0.0)
+ withholding += additional
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index 1e03673e..2ff8e211 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -182,6 +182,12 @@ class HRContractUSPayrollConfig(models.Model):
], string='North Carolina NC-4 Filing Status', help='NC-4')
nc_nc4_sit_allowances = fields.Integer(string='North Carolina NC-4 Allowances', help='NC-4 1.')
+ nd_w4_sit_filing_status = fields.Selection([
+ ('single', 'Single'),
+ ('married', 'Married'),
+ ('head_household', 'Head of Household')
+ ], string='North Dakota ND W-4 Filing Status', help='ND W-4')
+
ne_w4n_sit_filing_status = fields.Selection([
('single', 'Single'),
('married', 'Married'),
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 6a153fbf..9b6763a3 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -67,6 +67,8 @@ from . import test_us_mt_montana_payslip_2020
from . import test_us_nc_northcarolina_payslip_2019
from . import test_us_nc_northcarolina_payslip_2020
+from . import test_us_nd_north_dakota_payslip_2020
+
from . import test_us_ne_nebraska_payslip_2020
from . import test_us_nh_new_hampshire_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_nd_north_dakota_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_nd_north_dakota_payslip_2020.py
new file mode 100644
index 00000000..3bde5bee
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_nd_north_dakota_payslip_2020.py
@@ -0,0 +1,35 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsNDPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ ND_UNEMP_MAX_WAGE = 37900.0
+ ND_UNEMP = 1.02
+ # Calculation based on this file page.47 https://www.nd.gov/tax/data/upfiles/media/rates-and-instructions.pdf?20200110115917
+
+ def _test_sit(self, wage, filing_status, additional_withholding, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('ND'),
+ nd_w4_sit_filing_status=filing_status,
+ state_income_tax_additional_withholding=additional_withholding,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('ND', self.ND_UNEMP, date(2020, 1, 1), wage_base=self.ND_UNEMP_MAX_WAGE)
+ self._test_sit(700.0, 'single', 0.0, 'weekly', date(2020, 1, 1), 6.0)
+ self._test_sit(2500.0, 'married', 0.0, 'bi-weekly', date(2020, 1, 1), 29.0)
+ self._test_sit(25000.0, 'head_household', 0.0, 'monthly', date(2020, 1, 1), 501.0)
+ self._test_sit(25000.0, 'head_household', 10.0, 'monthly', date(2020, 1, 1), 511.0)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index 9abb2c5f..77c2856c 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -167,6 +167,11 @@
+
+ Form ND W-4 - State Income Tax
+
+
+
Form NC-4 - State Income Tax
From e151fc8548beba42d4d62eb812ed8c61b1cb16f2 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Tue, 28 Apr 2020 15:04:49 -0400
Subject: [PATCH 07/20] [IMP] l10n_us_hr_payroll: For Maine 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/state/me_maine.xml | 125 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
l10n_us_hr_payroll/models/state/me_maine.py | 64 +++++++++
.../models/us_payroll_config.py | 7 +
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../tests/test_us_me_maine_payslip_2020.py | 38 ++++++
.../views/us_payroll_config_views.xml | 7 +
8 files changed, 246 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/me_maine.xml
create mode 100644 l10n_us_hr_payroll/models/state/me_maine.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_me_maine_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 62667473..2c76ca97 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -41,6 +41,7 @@ United States of America - Payroll Rules.
'data/state/il_illinois.xml',
'data/state/in_indiana.xml',
'data/state/la_louisiana.xml',
+ 'data/state/me_maine.xml',
'data/state/mi_michigan.xml',
'data/state/mn_minnesota.xml',
'data/state/mo_missouri.xml',
diff --git a/l10n_us_hr_payroll/data/state/me_maine.xml b/l10n_us_hr_payroll/data/state/me_maine.xml
new file mode 100644
index 00000000..290781f9
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/me_maine.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ US ME Maine SUTA Wage Base
+ us_me_suta_wage_base
+
+
+
+
+ 12000.0
+
+
+
+
+
+
+
+ US ME Maine SUTA Rate
+ us_me_suta_rate
+
+
+
+
+ 1.92
+
+
+
+
+
+
+ US ME Maine SIT Tax Rate
+ us_me_sit_tax_rate
+
+
+
+
+ {
+ 'single': (
+ ( 22200, 0, 5.80),
+ ( 52600, 1288, 6.75),
+ ( 'inf', 3340, 7.15),
+ ),
+ 'married': (
+ ( 44450, 0, 0.00),
+ ( 105200, 2578, 6.75),
+ ( 'inf', 6679, 7.15),
+ ),
+ }
+
+
+
+
+
+
+ US ME Maine Standard Deduction Rate
+ us_me_sit_standard_deduction_rate
+
+
+
+
+ {
+ 'single': (( 82900, 9550), (157900, 75000)),
+ 'married': ((165800, 21950), (315800, 150000)),
+ }
+
+
+
+
+
+
+ US ME Maine Personal Exemption Rate
+ us_me_sit_personal_exemption_rate
+
+
+
+
+ 4300
+
+
+
+
+
+
+
+
+ US Maine - Department Of Labor | ReEmploy - Unemployment Tax
+
+
+
+ US Maine - Department Of Revenue Services - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US ME Maine State Unemployment
+ ER_US_ME_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_me_suta_wage_base', rate='us_me_suta_rate', state_code='ME')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_me_suta_wage_base', rate='us_me_suta_rate', state_code='ME')
+
+
+
+
+
+
+
+
+ EE: US ME Maine State Income Tax Withholding
+ EE_US_ME_SIT
+ python
+ result, _ = me_maine_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = me_maine_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index 7eaed9bf..47156de9 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -26,6 +26,7 @@ from .state.id_idaho import id_idaho_state_income_withholding
from .state.il_illinois import il_illinois_state_income_withholding
from .state.in_indiana import in_indiana_state_income_withholding
from .state.la_louisiana import la_louisiana_state_income_withholding
+from .state.me_maine import me_maine_state_income_withholding
from .state.mi_michigan import mi_michigan_state_income_withholding
from .state.mn_minnesota import mn_minnesota_state_income_withholding
from .state.mo_missouri import mo_missouri_state_income_withholding
@@ -87,6 +88,7 @@ class HRPayslip(models.Model):
'il_illinois_state_income_withholding': il_illinois_state_income_withholding,
'in_indiana_state_income_withholding': in_indiana_state_income_withholding,
'la_louisiana_state_income_withholding': la_louisiana_state_income_withholding,
+ 'me_maine_state_income_withholding': me_maine_state_income_withholding,
'mi_michigan_state_income_withholding': mi_michigan_state_income_withholding,
'mn_minnesota_state_income_withholding': mn_minnesota_state_income_withholding,
'mo_missouri_state_income_withholding': mo_missouri_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/me_maine.py b/l10n_us_hr_payroll/models/state/me_maine.py
new file mode 100644
index 00000000..d2f4d36b
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/me_maine.py
@@ -0,0 +1,64 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def me_maine_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+ WAGE = GROSS + DED_FIT_EXEMPT
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'ME'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ filing_status = payslip.contract_id.us_payroll_config_value('me_w4me_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ exempt = payslip.contract_id.us_payroll_config_value('state_income_tax_exempt')
+ if exempt:
+ return 0.0, 0.0
+
+ pay_periods = payslip.dict.get_pay_periods_in_year()
+ additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ allowances = payslip.contract_id.us_payroll_config_value('me_w4me_sit_allowances')
+ tax_rate = payslip.rule_parameter('us_me_sit_tax_rate')[filing_status]
+ personal_exemption = payslip.rule_parameter('us_me_sit_personal_exemption_rate')
+ standard_deduction = payslip.rule_parameter('us_me_sit_standard_deduction_rate')[filing_status]
+
+ taxable_income = wage * pay_periods
+ exemption_amt = allowances * personal_exemption
+ last = 0.0
+ standard_deduction_amt = 0.0
+ for row in standard_deduction:
+ amt, flat_amt = row
+ if taxable_income < 82900:
+ standard_deduction_amt = flat_amt
+ break
+ elif taxable_income < amt:
+ standard_deduction_amt = last * (amt - taxable_income) / flat_amt
+ break
+ last = flat_amt
+
+ annual_income = taxable_income - (exemption_amt + standard_deduction_amt)
+ withholding = 0.0
+ for row in tax_rate:
+ amt, flat_fee, rate = row
+ if annual_income < float(amt):
+ withholding = ((annual_income - last) * (rate / 100)) + flat_fee
+ break
+ last = amt
+
+ if withholding < 0.0:
+ withholding = 0.0
+ withholding = round(withholding / pay_periods)
+ withholding += additional
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index 2ff8e211..152ea877 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -134,6 +134,13 @@ class HRContractUSPayrollConfig(models.Model):
la_l4_sit_exemptions = fields.Integer(string='Louisiana LA L-4 Number of Exemptions', help='LA L-4 6.')
la_l4_sit_dependents = fields.Integer(string='Louisiana LA L-4 Number of Dependents', help='LA L-4 7.')
+ me_w4me_sit_filing_status = fields.Selection([
+ ('', 'Exempt'),
+ ('single', 'Single'),
+ ('married', 'Married'),
+ ], string='Maine W-4ME Filing Status', help='ME W-4ME 3.')
+ me_w4me_sit_allowances = fields.Integer(string='Maine Allowances', help='W-4ME 4.')
+
mi_w4_sit_exemptions = fields.Integer(string='Michigan MI W-4 Exemptions', help='MI-W4 6.')
mn_w4mn_sit_filing_status = fields.Selection([
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 9b6763a3..32ad72b9 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -49,6 +49,8 @@ from . import test_us_in_indiana_payslip_2020
from . import test_us_la_louisiana_payslip_2019
from . import test_us_la_louisiana_payslip_2020
+from . import test_us_me_maine_payslip_2020
+
from . import test_us_mi_michigan_payslip_2019
from . import test_us_mi_michigan_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_me_maine_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_me_maine_payslip_2020.py
new file mode 100644
index 00000000..b5f0ca87
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_me_maine_payslip_2020.py
@@ -0,0 +1,38 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsMEPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ ME_UNEMP_MAX_WAGE = 12000.0
+ ME_UNEMP = 1.92
+ # Calculation based on this file page.6 and 7 https://www.maine.gov/revenue/forms/with/2020/20_WH_Tab&Instructions.pdf
+
+ def _test_sit(self, wage, filing_status, additional_withholding, exempt, allowances, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('ME'),
+ me_w4me_sit_filing_status=filing_status,
+ state_income_tax_additional_withholding=additional_withholding,
+ state_income_tax_exempt=exempt,
+ me_w4me_sit_allowances=allowances,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('ME', self.ME_UNEMP, date(2020, 1, 1), wage_base=self.ME_UNEMP_MAX_WAGE)
+ self._test_sit(300.0, 'single', 0.0, False, 2, 'weekly', date(2020, 1, 1), 0.0)
+ self._test_sit(800.0, 'single', 0.0, False, 2, 'weekly', date(2020, 1, 1), 26.00)
+ self._test_sit(4500.0, 'married', 0.0, False, 2, 'weekly', date(2020, 1, 1), 277.00)
+ self._test_sit(4500.0, 'married', 0.0, True, 2, 'weekly', date(2020, 1, 1), 0.00)
+ self._test_sit(4500.0, 'married', 10.0, False, 2, 'weekly', date(2020, 1, 1), 287.00)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index 77c2856c..dfdc6094 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -131,6 +131,13 @@
+
+ Form W-4ME - State Income Tax
+
+
+
+
+
Form MI-W4 - State Income Tax
From 03892ea82f1873e5d3fad79c51cdc065169ade89 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Fri, 1 May 2020 18:01:33 -0400
Subject: [PATCH 08/20] [IMP] l10n_us_hr_payroll: For Nevada 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/state/nv_nevada.xml | 53 +++++++++++++++++++
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../tests/test_us_nv_nevada_payslip_2020.py | 16 ++++++
.../views/us_payroll_config_views.xml | 3 ++
5 files changed, 75 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/nv_nevada.xml
create mode 100755 l10n_us_hr_payroll/tests/test_us_nv_nevada_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 2c76ca97..76b404b8 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -53,6 +53,7 @@ United States of America - Payroll Rules.
'data/state/nh_new_hampshire.xml',
'data/state/nj_newjersey.xml',
'data/state/nm_new_mexico.xml',
+ 'data/state/nv_nevada.xml',
'data/state/ny_new_york.xml',
'data/state/oh_ohio.xml',
'data/state/pa_pennsylvania.xml',
diff --git a/l10n_us_hr_payroll/data/state/nv_nevada.xml b/l10n_us_hr_payroll/data/state/nv_nevada.xml
new file mode 100644
index 00000000..46e3c2d5
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/nv_nevada.xml
@@ -0,0 +1,53 @@
+
+
+
+
+ US NV Nevada SUTA Wage Base
+ us_nv_suta_wage_base
+
+
+
+
+ 32500.00
+
+
+
+
+
+
+
+ US NV Nevada SUTA Rate
+ us_nv_suta_rate
+
+
+
+
+ 2.95
+
+
+
+
+
+
+
+ US Nevada - Department of Employment, Training, and Rehabilitation, Employment Security Division - Unemployment Tax
+
+
+
+
+
+
+
+
+
+ ER: US NV Nevada State Unemployment (RT-6)
+ ER_US_NV_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nv_suta_wage_base', rate='us_nv_suta_rate', state_code='NV')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nv_suta_wage_base', rate='us_nv_suta_rate', state_code='NV')
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 32ad72b9..72a7b5d5 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -80,6 +80,8 @@ from . import test_us_nj_newjersey_payslip_2020
from . import test_us_nm_new_mexico_payslip_2020
+from . import test_us_nv_nevada_payslip_2020
+
from . import test_us_ny_new_york_payslip_2019
from . import test_us_ny_new_york_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_nv_nevada_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_nv_nevada_payslip_2020.py
new file mode 100755
index 00000000..52c2114b
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_nv_nevada_payslip_2020.py
@@ -0,0 +1,16 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date
+from .common import TestUsPayslip
+
+
+class TestUsNVPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ NV_UNEMP_MAX_WAGE = 32500.0
+ NV_UNEMP = 2.95
+
+ def test_2020_taxes(self):
+ # Only has state unemployment
+ self._test_er_suta('NV', self.NV_UNEMP, date(2020, 1, 1), wage_base=self.NV_UNEMP_MAX_WAGE)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index dfdc6094..fdd49599 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -200,6 +200,9 @@
Form NM W-4 - State Income Tax
+
+ No additional fields.
+
Form NY IT-2104 - State Income Tax
From 9441ac01b43a3f3d273438bad49adb99dd72588d Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Fri, 15 May 2020 09:59:18 -0400
Subject: [PATCH 09/20] [IMP] l10n_us_hr_payroll: For Kansas 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/state/ks_kansas.xml | 133 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
l10n_us_hr_payroll/models/state/ks_kansas.py | 44 ++++++
.../models/us_payroll_config.py | 7 +
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../tests/test_us_ks_kansas_payslip_2020.py | 35 +++++
.../views/us_payroll_config_views.xml | 7 +
8 files changed, 231 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/ks_kansas.xml
create mode 100644 l10n_us_hr_payroll/models/state/ks_kansas.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_ks_kansas_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 76b404b8..27d836ba 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -40,6 +40,7 @@ United States of America - Payroll Rules.
'data/state/id_idaho.xml',
'data/state/il_illinois.xml',
'data/state/in_indiana.xml',
+ 'data/state/ks_kansas.xml',
'data/state/la_louisiana.xml',
'data/state/me_maine.xml',
'data/state/mi_michigan.xml',
diff --git a/l10n_us_hr_payroll/data/state/ks_kansas.xml b/l10n_us_hr_payroll/data/state/ks_kansas.xml
new file mode 100644
index 00000000..539d9490
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/ks_kansas.xml
@@ -0,0 +1,133 @@
+
+
+
+
+ US KS Kasas SUTA Wage Base
+ us_ks_suta_wage_base
+
+
+
+
+ 14000.0
+
+
+
+
+
+
+
+ US KS Kasas SUTA Rate
+ us_ks_suta_rate
+
+
+
+
+ 2.7
+
+
+
+
+
+
+ US KS Kansas Allowances Rate
+ us_ks_sit_allowances_rate
+
+
+
+
+ {
+ 'weekly' : 43.27,
+ 'bi-weekly' : 86.54,
+ 'semi-monthly': 93.75,
+ 'monthly' : 187.50,
+ 'quarterly' : 562.50,
+ 'semi-annual': 1125.00,
+ 'annually': 2250.00,
+ }
+
+
+
+
+
+
+ US KS Kasas SIT Tax Rate
+ us_ks_sit_tax_rate
+
+
+
+
+ {
+ 'single': {
+ 'weekly': ((58, 0.00, 0.00), (346, 3.10, 0.00), (635, 5.25, 8.94), ('inf', 5.70, 24.09)),
+ 'bi-weekly': ((115, 0.00, 0.00), (692, 3.10, 0.00), (1269, 5.25, 17.88), ('inf', 5.70, 48.17)),
+ 'semi-monthly': ((125, 0.00, 0.00), (750, 3.10, 0.00), (1375, 5.25, 19.38), ('inf', 5.70, 52.19)),
+ 'monthly': ((250, 0.00, 0.00), (1500, 3.10, 0.00), (2750, 5.25, 38.75), ('inf', 5.70, 104.38)),
+ 'quarterly': ((750, 0.00, 0.00), (4500, 3.10, 0.00), (8250, 5.25, 116.25), ('inf', 5.70, 313.13)),
+ 'semi-annual': ((1500, 0.00, 0.00), (9000, 3.10, 0.00), (16500, 5.25, 232.50), ('inf', 5.70, 626.25)),
+ 'annually': ((3000, 0.00, 0.00), (18000, 3.10, 0.00), (33000, 5.25, 465.00), ('inf', 5.70, 1252.50)),
+ },
+ 'married': {
+ 'weekly': ((144, 0.00, 0.00), (721, 3.10, 0.00), (1298, 5.25, 17.88), ('inf', 5.70, 48.17)),
+ 'bi-weekly': ((288, 0.00, 0.00), (1442, 3.10, 0.00), (2596, 5.25, 35.77), ('inf', 5.70, 96.35)),
+ 'semi-monthly': ((313, 0.00, 0.00), (1563, 3.10, 0.00), (2813, 5.25, 38.75), ('inf', 5.70, 104.38)),
+ 'monthly': ((625, 0.00, 0.00), (3125, 3.10, 0.00), (5625, 5.25, 77.50), ('inf', 5.70, 208.75)),
+ 'quarterly': ((1875, 0.00, 0.00), (9375, 3.10, 0.00), (16875, 5.25, 232.50), ('inf', 5.70, 626.25)),
+ 'semi-annual': ((3750, 0.00, 0.00), (18750, 3.10, 0.00), (33750, 5.25, 465.00), ('inf', 5.70, 1252.50)),
+ 'annually': ((7500, 0.00, 0.00), (37500, 3.10, 0.00), (67500, 5.25, 930.00), ('inf', 5.70, 2505.00)),
+ },
+ 'head_household': {
+ 'weekly': ((58, 0.00, 0.00), (346, 3.10, 0.00), (635, 5.25, 8.94), ('inf', 5.70, 24.09)),
+ 'bi-weekly': ((115, 0.00, 0.00), (692, 3.10, 0.00), (1269, 5.25, 17.88), ('inf', 5.70, 48.17)),
+ 'semi-monthly': ((125, 0.00, 0.00), (750, 3.10, 0.00), (1375, 5.25, 19.38), ('inf', 5.70, 52.19)),
+ 'monthly': ((250, 0.00, 0.00), (1500, 3.10, 0.00), (2750, 5.25, 38.75), ('inf', 5.70, 104.38)),
+ 'quarterly': ((750, 0.00, 0.00), (4500, 3.10, 0.00), (8250, 5.25, 116.25), ('inf', 5.70, 313.13)),
+ 'semi-annual': ((1500, 0.00, 0.00), (9000, 3.10, 0.00), (16500, 5.25, 232.50), ('inf', 5.70, 626.25)),
+ 'annually': ((3000, 0.00, 0.00), (18000, 3.10, 0.00), (33000, 5.25, 465.00), ('inf', 5.70, 1252.50)),
+ },
+ }
+
+
+
+
+
+
+
+ US Kansas - Department of Labor - Unemployment Tax
+
+
+
+ US Kansas - Department of Revenue - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US KS Kasas State Unemployment
+ ER_US_KS_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ks_suta_wage_base', rate='us_ks_suta_rate', state_code='KS')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ks_suta_wage_base', rate='us_ks_suta_rate', state_code='KS')
+
+
+
+
+
+
+
+
+ EE: US KS Kasas State Income Tax Withholding
+ EE_US_KS_SIT
+ python
+ result, _ = ks_kansas_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = ks_kansas_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index 47156de9..aff10e65 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -25,6 +25,7 @@ from .state.ia_iowa import ia_iowa_state_income_withholding
from .state.id_idaho import id_idaho_state_income_withholding
from .state.il_illinois import il_illinois_state_income_withholding
from .state.in_indiana import in_indiana_state_income_withholding
+from .state.ks_kansas import ks_kansas_state_income_withholding
from .state.la_louisiana import la_louisiana_state_income_withholding
from .state.me_maine import me_maine_state_income_withholding
from .state.mi_michigan import mi_michigan_state_income_withholding
@@ -87,6 +88,7 @@ class HRPayslip(models.Model):
'id_idaho_state_income_withholding': id_idaho_state_income_withholding,
'il_illinois_state_income_withholding': il_illinois_state_income_withholding,
'in_indiana_state_income_withholding': in_indiana_state_income_withholding,
+ 'ks_kansas_state_income_withholding': ks_kansas_state_income_withholding,
'la_louisiana_state_income_withholding': la_louisiana_state_income_withholding,
'me_maine_state_income_withholding': me_maine_state_income_withholding,
'mi_michigan_state_income_withholding': mi_michigan_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/ks_kansas.py b/l10n_us_hr_payroll/models/state/ks_kansas.py
new file mode 100644
index 00000000..1e7398d0
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/ks_kansas.py
@@ -0,0 +1,44 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def ks_kansas_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'KS'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ filing_status = payslip.contract_id.us_payroll_config_value('ks_k4_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ schedule_pay = payslip.contract_id.schedule_pay
+ additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ allowances = payslip.contract_id.us_payroll_config_value('ks_k4_sit_allowances')
+ allowances_amt = payslip.rule_parameter('us_ks_sit_allowances_rate')[schedule_pay]
+ tax_table = payslip.rule_parameter('us_ks_sit_tax_rate')[filing_status].get(schedule_pay)
+
+ taxable_income = wage - (allowances * allowances_amt)
+ withholding = 0.0
+ last = 0.0
+ for row in tax_table:
+ amt, rate, flat_fee = row
+ if wage <= float(amt):
+ withholding = ((taxable_income - last) * (rate / 100)) + flat_fee
+ break
+ last = amt
+
+ withholding = max(withholding, 0.0)
+ withholding += additional
+ withholding = round(withholding)
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index 152ea877..e4552626 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -127,6 +127,13 @@ class HRContractUSPayrollConfig(models.Model):
in_w4_sit_personal_exemption = fields.Integer(string='Indiana In-W-4 Number of Personal Exemption', help='IN-W-4 5.')
in_w4_sit_dependent_exemption = fields.Integer(string='Indiana In-W-4 Number of Dependent Exemption', help='IN-W-4 6.')
+ ks_k4_sit_filing_status = fields.Selection([
+ ('single', 'Single'),
+ ('married', 'Married'),
+ ('head of household', 'Head of Household'),
+ ], string='Kansas K-4 Filing Status', help='KS K-4 3.')
+ ks_k4_sit_allowances = fields.Integer(string='Kansas KS K-4 Number of Allowances', help='KS K-4 Step 4.')
+
la_l4_sit_filing_status = fields.Selection([
('single', 'Single'),
('married', 'Married'),
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 72a7b5d5..24359a1e 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -46,6 +46,8 @@ from . import test_us_il_illinois_payslip_2020
from . import test_us_in_indiana_payslip_2020
+from . import test_us_ks_kansas_payslip_2020
+
from . import test_us_la_louisiana_payslip_2019
from . import test_us_la_louisiana_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_ks_kansas_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_ks_kansas_payslip_2020.py
new file mode 100755
index 00000000..61416613
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_ks_kansas_payslip_2020.py
@@ -0,0 +1,35 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsKSPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ KS_UNEMP_MAX_WAGE = 14000.0
+ KS_UNEMP = 2.7
+ # Calculation based on example https://revenue.ky.gov/Forms/42A003(T)%20(12-2019)%202020%20Tax%20Tables.pdf
+
+ def _test_sit(self, wage, filing_status, allowances, additional_withholding, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('KS'),
+ ks_k4_sit_filing_status=filing_status,
+ ks_k4_sit_allowances=allowances,
+ state_income_tax_additional_withholding=additional_withholding,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('KS', self.KS_UNEMP, date(2020, 1, 1), wage_base=self.KS_UNEMP_MAX_WAGE)
+ self._test_sit(625, 'married', 2, 0, 'semi-monthly', date(2020, 1, 1), 4.00)
+ # self._test_sit(1500, 'single', 0, 0, 'bi-weekly', date(2020, 1, 1), 69.90)
+ # self._test_sit(1500, 'single', 0, 0, 'bi-weekly', date(2020, 1, 1), 79.90)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index fdd49599..56ef6921 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -125,6 +125,13 @@
+
+ Form KS K-4 - State Income Tax
+
+
+
+
+
Form LA L-4 - State Income Tax
From 8f42717f3daa0e29d6cdcd982ad61c7ddfbf1c1f Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Fri, 15 May 2020 10:01:03 -0400
Subject: [PATCH 10/20] [IMP] l10n_us_hr_payroll: For Kentucky 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/state/ky_kentucky.xml | 97 +++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/ky_kentucky.py | 32 ++++++
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../tests/test_us_ky_kentucky_payslip_2020.py | 33 +++++++
.../views/us_payroll_config_views.xml | 4 +
7 files changed, 171 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/ky_kentucky.xml
create mode 100644 l10n_us_hr_payroll/models/state/ky_kentucky.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_ky_kentucky_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 27d836ba..fcbe1dad 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -41,6 +41,7 @@ United States of America - Payroll Rules.
'data/state/il_illinois.xml',
'data/state/in_indiana.xml',
'data/state/ks_kansas.xml',
+ 'data/state/ky_kentucky.xml',
'data/state/la_louisiana.xml',
'data/state/me_maine.xml',
'data/state/mi_michigan.xml',
diff --git a/l10n_us_hr_payroll/data/state/ky_kentucky.xml b/l10n_us_hr_payroll/data/state/ky_kentucky.xml
new file mode 100644
index 00000000..cab38f00
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/ky_kentucky.xml
@@ -0,0 +1,97 @@
+
+
+
+
+ US KY Kentucky SUTA Wage Base
+ us_ky_suta_wage_base
+
+
+
+
+ 10800.0
+
+
+
+
+
+
+
+ US KY Kentucky SUTA Rate
+ us_ky_suta_rate
+
+
+
+
+ 2.4
+
+
+
+
+
+
+ US KY Kentucky Standard Deduction Rate
+ us_ky_sit_standard_deduction_rate
+
+
+
+
+ 2650
+
+
+
+
+
+
+ US KY Kentucky SIT Tax Rate
+ us_ky_sit_tax_rate
+
+
+
+
+ 5.0
+
+
+
+
+
+
+
+ US Kentucky - Office of Unemployment Insurance - Unemployment Tax
+
+
+
+ US Kentucky - Department of Revenue - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US KY Kentucky State Unemployment
+ ER_US_KY_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ky_suta_wage_base', rate='us_ky_suta_rate', state_code='KY')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ky_suta_wage_base', rate='us_ky_suta_rate', state_code='KY')
+
+
+
+
+
+
+
+
+ EE: US KY Kentucky State Income Tax Withholding
+ EE_US_KY_SIT
+ python
+ result, _ = ky_kentucky_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = ky_kentucky_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index aff10e65..9b68835a 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -26,6 +26,7 @@ from .state.id_idaho import id_idaho_state_income_withholding
from .state.il_illinois import il_illinois_state_income_withholding
from .state.in_indiana import in_indiana_state_income_withholding
from .state.ks_kansas import ks_kansas_state_income_withholding
+from .state.ky_kentucky import ky_kentucky_state_income_withholding
from .state.la_louisiana import la_louisiana_state_income_withholding
from .state.me_maine import me_maine_state_income_withholding
from .state.mi_michigan import mi_michigan_state_income_withholding
@@ -89,6 +90,7 @@ class HRPayslip(models.Model):
'il_illinois_state_income_withholding': il_illinois_state_income_withholding,
'in_indiana_state_income_withholding': in_indiana_state_income_withholding,
'ks_kansas_state_income_withholding': ks_kansas_state_income_withholding,
+ 'ky_kentucky_state_income_withholding':ky_kentucky_state_income_withholding,
'la_louisiana_state_income_withholding': la_louisiana_state_income_withholding,
'me_maine_state_income_withholding': me_maine_state_income_withholding,
'mi_michigan_state_income_withholding': mi_michigan_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/ky_kentucky.py b/l10n_us_hr_payroll/models/state/ky_kentucky.py
new file mode 100644
index 00000000..ab580880
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/ky_kentucky.py
@@ -0,0 +1,32 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def ky_kentucky_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'KY'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ pay_periods = payslip.dict.get_pay_periods_in_year()
+ additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ tax_rate = payslip.rule_parameter('us_ky_sit_tax_rate')
+ standard_deduction = payslip.rule_parameter('us_ky_sit_standard_deduction_rate')
+
+ taxable_income = (wage * pay_periods) - standard_deduction
+ withholding = taxable_income * (tax_rate / 100)
+
+ withholding = max(withholding, 0.0)
+ withholding /= pay_periods
+ withholding += additional
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 24359a1e..43afe830 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -46,6 +46,8 @@ from . import test_us_il_illinois_payslip_2020
from . import test_us_in_indiana_payslip_2020
+from . import test_us_ky_kentucky_payslip_2020
+
from . import test_us_ks_kansas_payslip_2020
from . import test_us_la_louisiana_payslip_2019
diff --git a/l10n_us_hr_payroll/tests/test_us_ky_kentucky_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_ky_kentucky_payslip_2020.py
new file mode 100755
index 00000000..c1102efc
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_ky_kentucky_payslip_2020.py
@@ -0,0 +1,33 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsKYPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ KY_UNEMP_MAX_WAGE = 10800.0
+ KY_UNEMP = 2.4
+ # Calculation based on example https://revenue.ky.gov/Forms/42A003(T)%20(12-2019)%202020%20Tax%20Tables.pdf
+
+ def _test_sit(self, wage, additional_withholding, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('KY'),
+ state_income_tax_additional_withholding=additional_withholding,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('KY', self.KY_UNEMP, date(2020, 1, 1), wage_base=self.KY_UNEMP_MAX_WAGE)
+ self._test_sit(3020, 0.0, 'monthly', date(2020, 1, 1), 139.96)
+ self._test_sit(1500, 0.0, 'bi-weekly', date(2020, 1, 1), 69.90)
+ self._test_sit(1500, 10.0, 'bi-weekly', date(2020, 1, 1), 79.90)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index 56ef6921..e844905d 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -132,6 +132,10 @@
+
+ No additional fields.
+
+
Form LA L-4 - State Income Tax
From 0f004c6f1562a1fff6856fc7ba766f21ec948dfe Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Fri, 15 May 2020 13:00:43 -0400
Subject: [PATCH 11/20] [FIX]l10n_us_hr_payroll: Spell mistake on Kansas state
payroll.
---
l10n_us_hr_payroll/data/state/ks_kansas.xml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/l10n_us_hr_payroll/data/state/ks_kansas.xml b/l10n_us_hr_payroll/data/state/ks_kansas.xml
index 539d9490..ea4d5672 100644
--- a/l10n_us_hr_payroll/data/state/ks_kansas.xml
+++ b/l10n_us_hr_payroll/data/state/ks_kansas.xml
@@ -2,7 +2,7 @@
- US KS Kasas SUTA Wage Base
+ US KS Kansas SUTA Wage Base
us_ks_suta_wage_base
@@ -16,7 +16,7 @@
- US KS Kasas SUTA Rate
+ US KS Kansas SUTA Rate
us_ks_suta_rate
@@ -50,7 +50,7 @@
- US KS Kasas SIT Tax Rate
+ US KS Kansas SIT Tax Rate
us_ks_sit_tax_rate
@@ -106,7 +106,7 @@
- ER: US KS Kasas State Unemployment
+ ER: US KS Kansas State Unemployment
ER_US_KS_SUTA
python
result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ks_suta_wage_base', rate='us_ks_suta_rate', state_code='KS')
@@ -120,7 +120,7 @@
- EE: US KS Kasas State Income Tax Withholding
+ EE: US KS Kansas State Income Tax Withholding
EE_US_KS_SIT
python
result, _ = ks_kansas_state_income_withholding(payslip, categories, worked_days, inputs)
From a7fc00b0f37f48cf7ee2705062a8f379788d2ece Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Mon, 18 May 2020 11:23:03 -0400
Subject: [PATCH 12/20] [IMP] l10n_us_hr_payroll: For Oklahoma 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/state/ok_oklahoma.xml | 133 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/ok_oklahoma.py | 47 +++++++
.../models/us_payroll_config.py | 7 +
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../tests/test_us_ok_oklahoma_payslip_2020.py | 37 +++++
.../views/us_payroll_config_views.xml | 7 +
8 files changed, 236 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/ok_oklahoma.xml
create mode 100644 l10n_us_hr_payroll/models/state/ok_oklahoma.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_ok_oklahoma_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index fcbe1dad..d18c9903 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -58,6 +58,7 @@ United States of America - Payroll Rules.
'data/state/nv_nevada.xml',
'data/state/ny_new_york.xml',
'data/state/oh_ohio.xml',
+ 'data/state/ok_oklahoma.xml',
'data/state/pa_pennsylvania.xml',
'data/state/sc_south_carolina.xml',
'data/state/tx_texas.xml',
diff --git a/l10n_us_hr_payroll/data/state/ok_oklahoma.xml b/l10n_us_hr_payroll/data/state/ok_oklahoma.xml
new file mode 100644
index 00000000..f4ec8269
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/ok_oklahoma.xml
@@ -0,0 +1,133 @@
+
+
+
+
+ US OK Oklahoma SUTA Wage Base
+ us_ok_suta_wage_base
+
+
+
+
+ 18700.0
+
+
+
+
+
+
+
+ US OK Oklahoma SUTA Rate
+ us_ok_suta_rate
+
+
+
+
+ 1.5
+
+
+
+
+
+
+ US OK Oklahoma Allowances Rate
+ us_ok_sit_allowances_rate
+
+
+
+
+ {
+ 'weekly' : 19.23,
+ 'bi-weekly' : 38.46,
+ 'semi-monthly': 41.67,
+ 'monthly' : 83.33,
+ 'quarterly' : 250.00,
+ 'semi-annual': 500.00,
+ 'annually': 1000.00,
+ }
+
+
+
+
+
+
+ US OK Oklahoma SIT Tax Rate
+ us_ok_sit_tax_rate
+
+
+
+
+ {
+ 'single': {
+ 'weekly': ((122, 0.00, 0.00), (141, 0.50, 0.00), (170, 1.00, 0.10), (194, 2.00, 0.38), (216, 3.00, 0.87), (261, 4.00, 1.53), ('inf', 5.00, 3.30)),
+ 'bi-weekly': ((244, 0.00, 0.00), (283, 0.50, 0.00), (340, 1.00, 0.19), (388, 2.00, 0.77), (433, 3.00, 1.73), (521, 4.00, 3.06), ('inf', 5.00, 6.60)),
+ 'semi-monthly': ((265, 0.00, 0.00), (306, 0.50, 0.00), (369, 1.00, 0.21), (421, 2.00, 0.83), (469, 3.00, 1.88), (565, 4.00, 3.31), ('inf', 5.00, 7.15)),
+ 'monthly': ((529, 0.00, 0.00), (613, 0.50, 0.00), (738, 1.00, 0.42), (842, 2.00, 1.67), (938, 3.00, 3.75), (1129, 4.00, 6.63), ('inf', 5.00, 14.29)),
+ 'quarterly': ((1588, 0.00, 0.00), (1838, 0.50, 0.00), (2213, 1.00, 1.25), (2525, 2.00, 5.00), (2813, 3.00, 11.25), (3388, 4.00, 19.88), ('inf', 5.00, 42.88)),
+ 'semi-annual': ((3175, 0.00, 0.00), (3675, 0.50, 0.00), (4425, 1.00, 2.50), (5050, 2.00, 10.00), (5625, 3.00, 22.50), (6775, 4.00, 39.75), ('inf', 5.00, 85.75)),
+ 'annually': ((6350, 0.00, 0.00), (7350, 0.50, 0.00), (8850, 1.00, 5.00), (10100, 2.00, 20.00), (11250, 3.00, 45.00), (13550, 4.00, 79.50), ('inf', 5.00, 171.50)),
+ },
+ 'married': {
+ 'weekly': ((244, 0.00, 0.00), (283, 0.50, 0.00), (340, 1.00, 0.19), (388, 2.00, 0.77), (433, 3.00, 1.73), (479, 4.00, 3.06), ('inf', 5.00, 4.90)),
+ 'bi-weekly': ((488, 0.00, 0.00), (565, 0.50, 0.00), (681, 1.00, 0.38), (777, 2.00, 1.54), (865, 3.00, 3.46), (958, 4.00, 6.12), ('inf', 5.00, 9.81)),
+ 'semi-monthly': ((529, 0.00, 0.00), (613, 0.50, 0.00), (738, 1.00, 0.42), (842, 2.00, 1.67), (938, 3.00, 3.75), (1038, 4.00, 6.63), ('inf', 5.00, 10.63)),
+ 'monthly': ((1058, 0.00, 0.00), (1225, 0.50, 0.00), (1475, 1.00, 0.83), (1683, 2.00, 3.33), (1875, 3.00, 7.50), (2075, 4.00, 13.25), ('inf', 5.00, 21.25)),
+ 'quarterly': ((3175, 0.00, 0.00), (3675, 0.50, 0.00), (4425, 1.00, 2.50), (5050, 2.00, 10.00), (5625, 3.00, 22.50), (6225, 4.00, 39.75), ('inf', 5.00, 63.75)),
+ 'semi-annual': ((6350, 0.00, 0.00), (7350, 0.50, 0.00), (8850, 1.00, 5.00), (10100, 2.00, 20.00), (11250, 3.00, 45.00), (12450, 4.00, 79.50), ('inf', 5.00, 127.50)),
+ 'annually': ((12700, 0.00, 0.00), (14700, 0.50, 0.00), (17700, 1.00, 10.00), (20200, 2.00, 40.00), (22500, 3.00, 90.00), (24900, 4.00, 159.00), ('inf', 5.00, 255.00)),
+ },
+ 'head_household': {
+ 'weekly': ((122, 0.00, 0.00), (141, 0.50, 0.00), (170, 1.00, 0.10), (194, 2.00, 0.38), (216, 3.00, 0.87), (261, 4.00, 1.53), ('inf', 5.00, 3.30)),
+ 'bi-weekly': ((244, 0.00, 0.00), (283, 0.50, 0.00), (340, 1.00, 0.19), (388, 2.00, 0.77), (433, 3.00, 1.73), (521, 4.00, 3.06), ('inf', 5.00, 6.60)),
+ 'semi-monthly': ((265, 0.00, 0.00), (306, 0.50, 0.00), (369, 1.00, 0.21), (421, 2.00, 0.83), (469, 3.00, 1.88), (565, 4.00, 3.31), ('inf', 5.00, 7.15)),
+ 'monthly': ((529, 0.00, 0.00), (613, 0.50, 0.00), (738, 1.00, 0.42), (842, 2.00, 1.67), (938, 3.00, 3.75), (1129, 4.00, 6.63), ('inf', 5.00, 14.29)),
+ 'quarterly': ((1588, 0.00, 0.00), (1838, 0.50, 0.00), (2213, 1.00, 1.25), (2525, 2.00, 5.00), (2813, 3.00, 11.25), (3388, 4.00, 19.88), ('inf', 5.00, 42.88)),
+ 'semi-annual': ((3175, 0.00, 0.00), (3675, 0.50, 0.00), (4425, 1.00, 2.50), (5050, 2.00, 10.00), (5625, 3.00, 22.50), (6775, 4.00, 39.75), ('inf', 5.00, 85.75)),
+ 'annually': ((6350, 0.00, 0.00), (7350, 0.50, 0.00), (8850, 1.00, 5.00), (10100, 2.00, 20.00), (11250, 3.00, 45.00), (13550, 4.00, 79.50), ('inf', 5.00, 171.50)),
+ },
+ }
+
+
+
+
+
+
+
+ US Oklahoma - Employment Security Commission - Unemployment Tax
+
+
+
+ US Oklahoma - Tax Commission - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US OK Oklahoma State Unemployment
+ ER_US_OK_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ok_suta_wage_base', rate='us_ok_suta_rate', state_code='OK')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ok_suta_wage_base', rate='us_ok_suta_rate', state_code='OK')
+
+
+
+
+
+
+
+
+ EE: US OK Oklahoma State Income Tax Withholding
+ EE_US_OK_SIT
+ python
+ result, _ = ok_oklahoma_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = ok_oklahoma_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index 9b68835a..13e92312 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -41,6 +41,7 @@ from .state.nj_newjersey import nj_newjersey_state_income_withholding
from .state.nm_new_mexico import nm_new_mexico_state_income_withholding
from .state.ny_new_york import ny_new_york_state_income_withholding
from .state.oh_ohio import oh_ohio_state_income_withholding
+from .state.ok_oklahoma import ok_oklahoma_state_income_withholding
from .state.sc_south_carolina import sc_south_carolina_state_income_withholding
from .state.va_virginia import va_virginia_state_income_withholding
from .state.wa_washington import wa_washington_fml_er, \
@@ -105,6 +106,7 @@ class HRPayslip(models.Model):
'nm_new_mexico_state_income_withholding': nm_new_mexico_state_income_withholding,
'ny_new_york_state_income_withholding': ny_new_york_state_income_withholding,
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
+ 'ok_oklahoma_state_income_withholding': ok_oklahoma_state_income_withholding,
'sc_south_carolina_state_income_withholding': sc_south_carolina_state_income_withholding,
'va_virginia_state_income_withholding': va_virginia_state_income_withholding,
'wa_washington_fml_er': wa_washington_fml_er,
diff --git a/l10n_us_hr_payroll/models/state/ok_oklahoma.py b/l10n_us_hr_payroll/models/state/ok_oklahoma.py
new file mode 100644
index 00000000..bc0ecc24
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/ok_oklahoma.py
@@ -0,0 +1,47 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def ok_oklahoma_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'OK'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ if payslip.contract_id.us_payroll_config_value('state_income_tax_exempt'):
+ return 0.0, 0.0
+
+ filing_status = payslip.contract_id.us_payroll_config_value('ok_w4_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ schedule_pay = payslip.contract_id.schedule_pay
+ additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ allowances = payslip.contract_id.us_payroll_config_value('ok_w4_sit_allowances')
+ allowances_amt = payslip.rule_parameter('us_ok_sit_allowances_rate')[schedule_pay]
+ tax_table = payslip.rule_parameter('us_ok_sit_tax_rate')[filing_status].get(schedule_pay)
+
+ taxable_income = wage - (allowances * allowances_amt)
+ withholding = 0.0
+ last = 0.0
+ for row in tax_table:
+ amt, rate, flat_fee = row
+ if wage <= float(amt):
+ withholding = ((taxable_income - last) * (rate / 100)) + flat_fee
+ break
+ last = amt
+
+ withholding = max(withholding, 0.0)
+ withholding += additional
+ withholding = round(withholding)
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index e4552626..d50f4040 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -235,6 +235,13 @@ class HRContractUSPayrollConfig(models.Model):
# Ohio will use generic SIT exempt and additional fields
oh_it4_sit_exemptions = fields.Integer(string='Ohio IT-4 Exemptions',
help='Line 4')
+
+ ok_w4_sit_filing_status = fields.Selection([
+ ('single', 'Single'),
+ ('married', 'Married'),
+ ('head_household', 'Head of Household')
+ ], string='Oklahoma OK-W-4 Filing Status', help='OK-W-4')
+ ok_w4_sit_allowances = fields.Integer(string='Oklahoma OK-W-4 Allowances', help='OK-W-4 1.2.3.')
sc_w4_sit_allowances = fields.Integer(string='South Carolina SC W-4 Allowances', help='SC W-4 5.')
va_va4_sit_exemptions = fields.Integer(string='Virginia VA-4(P) Personal Exemptions',
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 43afe830..cc2bfff6 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -92,6 +92,8 @@ from . import test_us_ny_new_york_payslip_2020
from . import test_us_oh_ohio_payslip_2019
from . import test_us_oh_ohio_payslip_2020
+from . import test_us_ok_oklahoma_payslip_2020
+
from . import test_us_pa_pennsylvania_payslip_2019
from . import test_us_pa_pennsylvania_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_ok_oklahoma_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_ok_oklahoma_payslip_2020.py
new file mode 100755
index 00000000..03297065
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_ok_oklahoma_payslip_2020.py
@@ -0,0 +1,37 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsOKPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ OK_UNEMP_MAX_WAGE = 18700.0
+ OK_UNEMP = 1.5
+ # Calculation based on example https://www.ok.gov/tax/documents/2020WHTables.pdf
+
+ def _test_sit(self, wage, filing_status, allowances, additional_withholding, exempt, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('OK'),
+ ok_w4_sit_filing_status=filing_status,
+ ok_w4_sit_allowances=allowances,
+ state_income_tax_additional_withholding=additional_withholding,
+ state_income_tax_exempt=exempt,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('OK', self.OK_UNEMP, date(2020, 1, 1), wage_base=self.OK_UNEMP_MAX_WAGE)
+ self._test_sit(1825, 'married', 2, 0, False, 'semi-monthly', date(2020, 1, 1), 46.00)
+ self._test_sit(1825, 'married', 2, 0, True, 'monthly', date(2020, 1, 1), 0.00)
+ self._test_sit(1000, 'single', 1, 0, False, 'weekly', date(2020, 1, 1), 39.00)
+ self._test_sit(1000, 'single', 1, 10, False, 'weekly', date(2020, 1, 1), 49.00)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index e844905d..eae427c3 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -226,6 +226,13 @@
+
+ Form OK-W-4 - State Income Tax
+
+
+
+
+
From e868c703fcb29ba5cea91eec6223296b429978f5 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Mon, 18 May 2020 11:26:43 -0400
Subject: [PATCH 13/20] [IMP] l10n_us_hr_payroll: Port `l10n_us_wy_hr_payroll`
WY Wyoming including migration.
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/state/wy_wyoming.xml | 61 +++++++++++++++++++
l10n_us_hr_payroll/tests/__init__.py | 3 +
.../tests/test_us_wy_wyoming_payslip_2019.py | 58 ++++++++++++++++++
.../tests/test_us_wy_wyoming_payslip_2020.py | 13 ++++
.../views/us_payroll_config_views.xml | 3 +
6 files changed, 139 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/wy_wyoming.xml
create mode 100644 l10n_us_hr_payroll/tests/test_us_wy_wyoming_payslip_2019.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_wy_wyoming_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index d18c9903..8a60b569 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -64,6 +64,7 @@ United States of America - Payroll Rules.
'data/state/tx_texas.xml',
'data/state/va_virginia.xml',
'data/state/wa_washington.xml',
+ 'data/state/wy_wyoming.xml',
'views/hr_contract_views.xml',
'views/us_payroll_config_views.xml',
],
diff --git a/l10n_us_hr_payroll/data/state/wy_wyoming.xml b/l10n_us_hr_payroll/data/state/wy_wyoming.xml
new file mode 100644
index 00000000..cfcfcd3c
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/wy_wyoming.xml
@@ -0,0 +1,61 @@
+
+
+
+
+ US WY Wyoming SUTA Wage Base
+ us_wy_suta_wage_base
+
+
+
+
+ 25400.00
+
+
+
+
+ 26400.00
+
+
+
+
+
+
+
+ US WY Wyoming SUTA Rate
+ us_wy_suta_rate
+
+
+
+
+ 2.10
+
+
+
+
+ 2.10
+
+
+
+
+
+
+
+ US Wyoming - Department of Workforce Services (WDWS) - Unemployment Tax
+
+
+
+
+
+
+
+ ER: US WY Wyoming State Unemployment
+ ER_US_WY_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_wy_suta_wage_base', rate='us_wy_suta_rate', state_code='WY')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_wy_suta_wage_base', rate='us_wy_suta_rate', state_code='WY')
+
+
+
+
+
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index cc2bfff6..85218b71 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -108,3 +108,6 @@ from . import test_us_va_virginia_payslip_2020
from . import test_us_wa_washington_payslip_2019
from . import test_us_wa_washington_payslip_2020
+
+from . import test_us_wy_wyoming_payslip_2019
+from . import test_us_wy_wyoming_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_wy_wyoming_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_wy_wyoming_payslip_2019.py
new file mode 100644
index 00000000..a8fa3df8
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_wy_wyoming_payslip_2019.py
@@ -0,0 +1,58 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date
+from .common import TestUsPayslip, process_payslip
+
+
+class TestUsWYPayslip(TestUsPayslip):
+
+ # TAXES AND RATES
+ WY_UNEMP_MAX_WAGE = 25400
+ WY_UNEMP = -2.10 / 100.0
+
+ def test_2019_taxes(self):
+ salary = 15000.00
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('WY'))
+
+ self._log('2019 Wyoming tax first payslip:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['ER_US_SUTA'], salary * self.WY_UNEMP)
+
+ process_payslip(payslip)
+
+ # Make a new payslip, this one will have maximums
+
+ remaining_wy_unemp_wages = self.WY_UNEMP_MAX_WAGE - salary if (self.WY_UNEMP_MAX_WAGE - 2*salary < salary) \
+ else salary
+
+ self._log('2019 Wyoming tax second payslip:')
+ payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_wy_unemp_wages * self.WY_UNEMP)
+
+ def test_2019_taxes_with_external(self):
+ # Wage is the cap itself, 25400
+ # so salary is equal to self.WY_UNEMP
+ salary = 25400
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('WY'))
+
+ self._log('2019 Wyoming External tax first payslip:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['ER_US_SUTA'], salary * self.WY_UNEMP)
diff --git a/l10n_us_hr_payroll/tests/test_us_wy_wyoming_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_wy_wyoming_payslip_2020.py
new file mode 100644
index 00000000..51a89a74
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_wy_wyoming_payslip_2020.py
@@ -0,0 +1,13 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date
+from .common import TestUsPayslip
+
+
+class TestUsWYPayslip(TestUsPayslip):
+ # TAXES AND RATES
+ WY_UNEMP_MAX_WAGE = 26400.00
+ WY_UNEMP = 2.10
+
+ def test_2020_taxes(self):
+ self._test_er_suta('WY', self.WY_UNEMP, date(2020, 1, 1), wage_base=self.WY_UNEMP_MAX_WAGE)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index eae427c3..192120cd 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -256,6 +256,9 @@
No additional fields.
Ensure that your Employee and Employer workers' comp code fields are filled in for WA LNI withholding.
+
+ No additional fields.
+
From 92df007ad0c0b0307c5a29492fdaef170a4ee9cf Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Wed, 20 May 2020 17:11:18 -0400
Subject: [PATCH 14/20] [IMP] l10n_us_hr_payroll: For Vermont 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/state/vt_vermont.xml | 121 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
l10n_us_hr_payroll/models/state/vt_vermont.py | 46 +++++++
.../models/us_payroll_config.py | 7 +
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../tests/test_us_vt_vermont_payslip_2020.py | 37 ++++++
.../views/us_payroll_config_views.xml | 7 +
8 files changed, 223 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/vt_vermont.xml
create mode 100644 l10n_us_hr_payroll/models/state/vt_vermont.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_vt_vermont_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 8a60b569..617ec04b 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -62,6 +62,7 @@ United States of America - Payroll Rules.
'data/state/pa_pennsylvania.xml',
'data/state/sc_south_carolina.xml',
'data/state/tx_texas.xml',
+ 'data/state/vt_vermont.xml',
'data/state/va_virginia.xml',
'data/state/wa_washington.xml',
'data/state/wy_wyoming.xml',
diff --git a/l10n_us_hr_payroll/data/state/vt_vermont.xml b/l10n_us_hr_payroll/data/state/vt_vermont.xml
new file mode 100644
index 00000000..6223b420
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/vt_vermont.xml
@@ -0,0 +1,121 @@
+
+
+
+
+ US VT Vermont SUTA Wage Base
+ us_vt_suta_wage_base
+
+
+
+
+ 16000.0
+
+
+
+
+
+
+
+ US VT Vermont SUTA Rate
+ us_vt_suta_rate
+
+
+
+
+ 1.0
+
+
+
+
+
+
+ US VT Vermont Allowances Rate
+ us_vt_sit_allowances_rate
+
+
+
+
+ {
+ 'weekly' : 83.65,
+ 'bi-weekly' : 167.31,
+ 'semi-monthly': 181.25,
+ 'monthly' : 362.50,
+ 'quarterly' : 1087.50,
+ 'annually': 4350.00,
+ }
+
+
+
+
+
+
+ US VT Vermont SIT Tax Rate
+ us_vt_sit_tax_rate
+
+
+
+
+ {
+ 'single': {
+ 'weekly': ((60, 0.00, 0.00), (836, 0.00, 3.35), (1941, 26.00, 6.60), (3983, 98.93, 7.60), ('inf', 254.12, 8.75)),
+ 'bi-weekly': ((120, 0.00, 0.00), (1672, 0.00, 3.35), (3882, 51.99, 6.60), (7966, 197.85, 7.60), ('inf', 508.24, 8.75)),
+ 'semi-monthly': ((130, 0.00, 0.00), (1811, 0.00, 3.35), (4205, 56.31, 6.60), (8630, 214.32, 7.60), ('inf', 550.62, 8.75)),
+ 'monthly': ((260, 0.00, 0.00), (3623, 0.00, 3.35), (8410, 112.66, 6.60), (17260, 428.60, 7.60), ('inf', 1101.20, 8.75)),
+ 'quarterly': ((781, 0.00, 0.00), (10869, 0.00, 3.35), (25231, 337.95, 6.60), (51781, 1285.84, 7.60), ('inf', 3303.64, 8.75)),
+ 'annually': ((3125, 0.00, 0.00), (43475, 0.00, 3.35), (100925, 1351.73, 6.60), (207125, 5143.43, 7.60), ('inf', 13214.63, 8.75)),
+ },
+ 'married': {
+ 'weekly': ((180, 0.00, 0.00), (1477, 0.00, 3.35), (3315, 43.45, 6.60), (4956, 164.76, 7.60), ('inf', 289.47, 8.75)),
+ 'bi-weekly': ((361, 0.00, 0.00), (2955, 0.00, 3.35), (6630, 86.90, 6.60), (9913, 329.45, 7.60), ('inf', 578.96, 8.75)),
+ 'semi-monthly': ((391, 0.00, 0.00), (3201, 0.00, 3.35), (7182, 94.14, 6.60), (10739, 356.88, 7.60), ('inf', 627.21, 8.75)),
+ 'monthly': ((781, 0.00, 0.00), (6402, 0.00, 3.35), (14365, 188.30, 6.60), (21477, 713.86, 7.60), ('inf', 1254.37, 8.75)),
+ 'quarterly': ((2344, 0.00, 0.00), (19206, 0.00, 3.35), (43094, 564.88, 6.60), (64431, 2141.49, 7.60), ('inf', 3763.10, 8.75)),
+ 'annually': ((9375, 0.00, 0.00), (76825, 0.00, 3.35), (172375, 2259.58, 6.60), (257725, 8565.88, 7.60), ('inf', 15052.48, 8.75)),
+ },
+ }
+
+
+
+
+
+
+
+ US Vermont - Employment Security Commission - Unemployment Tax
+
+
+
+ US Vermont - Tax Commission - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US VT Vermont State Unemployment
+ ER_US_VT_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_vt_suta_wage_base', rate='us_vt_suta_rate', state_code='VT')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_vt_suta_wage_base', rate='us_vt_suta_rate', state_code='VT')
+
+
+
+
+
+
+
+
+ EE: US VT Vermont State Income Tax Withholding
+ EE_US_VT_SIT
+ python
+ result, _ = vt_vermont_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = vt_vermont_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index 13e92312..76bc6637 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -43,6 +43,7 @@ from .state.ny_new_york import ny_new_york_state_income_withholding
from .state.oh_ohio import oh_ohio_state_income_withholding
from .state.ok_oklahoma import ok_oklahoma_state_income_withholding
from .state.sc_south_carolina import sc_south_carolina_state_income_withholding
+from .state.vt_vermont import vt_vermont_state_income_withholding
from .state.va_virginia import va_virginia_state_income_withholding
from .state.wa_washington import wa_washington_fml_er, \
wa_washington_fml_ee
@@ -108,6 +109,7 @@ class HRPayslip(models.Model):
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
'ok_oklahoma_state_income_withholding': ok_oklahoma_state_income_withholding,
'sc_south_carolina_state_income_withholding': sc_south_carolina_state_income_withholding,
+ 'vt_vermont_state_income_withholding': vt_vermont_state_income_withholding,
'va_virginia_state_income_withholding': va_virginia_state_income_withholding,
'wa_washington_fml_er': wa_washington_fml_er,
'wa_washington_fml_ee': wa_washington_fml_ee,
diff --git a/l10n_us_hr_payroll/models/state/vt_vermont.py b/l10n_us_hr_payroll/models/state/vt_vermont.py
new file mode 100644
index 00000000..463e007c
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/vt_vermont.py
@@ -0,0 +1,46 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def vt_vermont_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'VT'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ if payslip.contract_id.us_payroll_config_value('state_income_tax_exempt'):
+ return 0.0, 0.0
+
+ filing_status = payslip.contract_id.us_payroll_config_value('vt_w4vt_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ schedule_pay = payslip.contract_id.schedule_pay
+ additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ allowances = payslip.contract_id.us_payroll_config_value('vt_w4vt_sit_allowances')
+ allowance_amt = payslip.rule_parameter('us_vt_sit_allowances_rate')[schedule_pay]
+ tax_table = payslip.rule_parameter('us_vt_sit_tax_rate')[filing_status].get(schedule_pay)
+
+ taxable_income = wage - (allowances * allowance_amt)
+ withholding = 0.0
+ last = 0.0
+ for row in tax_table:
+ amt, flat_fee, rate = row
+ if wage <= float(amt):
+ withholding = ((taxable_income - last) * (rate / 100)) + flat_fee
+ break
+ last = amt
+
+ withholding = max(withholding, 0.0)
+ withholding += additional
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index d50f4040..de2e82df 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -244,6 +244,13 @@ class HRContractUSPayrollConfig(models.Model):
ok_w4_sit_allowances = fields.Integer(string='Oklahoma OK-W-4 Allowances', help='OK-W-4 1.2.3.')
sc_w4_sit_allowances = fields.Integer(string='South Carolina SC W-4 Allowances', help='SC W-4 5.')
+ vt_w4vt_sit_filing_status = fields.Selection([
+ ('single', 'Single'),
+ ('married', 'Married'),
+ ('head_household', 'Head of Household')
+ ], string='Vermont VT W-4VT Filing Status', help='VT W-4VT')
+ vt_w4vt_sit_allowances = fields.Integer(string='Vermont VT W-4VT Allowances', help='VT W-4VT 1.')
+
va_va4_sit_exemptions = fields.Integer(string='Virginia VA-4(P) Personal Exemptions',
help='VA-4(P) 1(a)')
va_va4_sit_other_exemptions = fields.Integer(string='Virginia VA-4(P) Age & Blindness Exemptions',
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 85218b71..1948f1e3 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -103,6 +103,8 @@ from . import test_us_sc_south_carolina_payslip_2020
from . import test_us_tx_texas_payslip_2019
from . import test_us_tx_texas_payslip_2020
+from . import test_us_vt_vermont_payslip_2020
+
from . import test_us_va_virginia_payslip_2019
from . import test_us_va_virginia_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_vt_vermont_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_vt_vermont_payslip_2020.py
new file mode 100755
index 00000000..c26d8f52
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_vt_vermont_payslip_2020.py
@@ -0,0 +1,37 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsVTPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ VT_UNEMP_MAX_WAGE = 16000.0
+ VT_UNEMP = 1.0
+ # Calculation based on example https://tax.vermont.gov/sites/tax/files/documents/WithholdingInstructions.pdf
+
+ def _test_sit(self, wage, filing_status, allowances, additional_withholding, exempt, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('VT'),
+ vt_w4vt_sit_filing_status=filing_status,
+ vt_w4vt_sit_allowances=allowances,
+ state_income_tax_additional_withholding=additional_withholding,
+ state_income_tax_exempt=exempt,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('VT', self.VT_UNEMP, date(2020, 1, 1), wage_base=self.VT_UNEMP_MAX_WAGE)
+ self._test_sit(1800, 'married', 2, 0, False, 'weekly', date(2020, 1, 1), 53.73)
+ self._test_sit(1800, 'married', 2, 10, False, 'weekly', date(2020, 1, 1), 63.73)
+ self._test_sit(1000, 'single', 1, 0, True, 'weekly', date(2020, 1, 1), 0.00)
+ self._test_sit(8000, 'single', 1, 10, False, 'bi-weekly', date(2020, 1, 1), 506.58)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index 192120cd..21d3b5d0 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -245,6 +245,13 @@
No additional fields.
+
+ Form VT W-4VT - State Income Tax
+
+
+
+
+
Form VA-4/VA-4P - State Income Tax
From d903820f11884e336124f3b00e3ee4ba0c98bcad Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Wed, 20 May 2020 17:12:55 -0400
Subject: [PATCH 15/20] [IMP] l10n_us_hr_payroll: For Utah 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/state/ut_utah.xml | 157 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
l10n_us_hr_payroll/models/state/ut_utah.py | 39 +++++
.../models/us_payroll_config.py | 6 +
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../tests/test_us_us_utah_payslip_2020.py | 37 +++++
.../views/us_payroll_config_views.xml | 5 +
8 files changed, 249 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/ut_utah.xml
create mode 100644 l10n_us_hr_payroll/models/state/ut_utah.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_us_utah_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 617ec04b..9194230c 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -62,6 +62,7 @@ United States of America - Payroll Rules.
'data/state/pa_pennsylvania.xml',
'data/state/sc_south_carolina.xml',
'data/state/tx_texas.xml',
+ 'data/state/ut_utah.xml',
'data/state/vt_vermont.xml',
'data/state/va_virginia.xml',
'data/state/wa_washington.xml',
diff --git a/l10n_us_hr_payroll/data/state/ut_utah.xml b/l10n_us_hr_payroll/data/state/ut_utah.xml
new file mode 100644
index 00000000..f3622248
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/ut_utah.xml
@@ -0,0 +1,157 @@
+
+
+
+
+ US UT Utah SUTA Wage Base
+ us_ut_suta_wage_base
+
+
+
+
+ 36600.0
+
+
+
+
+
+
+
+ US UT Utah SUTA Rate
+ us_ut_suta_rate
+
+
+
+
+ 1.5
+
+
+
+
+
+
+ US UT Utah TAX Rate
+ us_ut_tax_rate
+
+
+
+
+ 0.0495
+
+
+
+
+
+
+ US UT Utah Allowances Rate
+ us_ut_sit_allowances_rate
+
+
+
+
+ {
+ 'single': {
+ 'weekly' : 7,
+ 'bi-weekly' : 14,
+ 'semi-monthly': 15,
+ 'monthly' : 30,
+ 'quarterly' : 90,
+ 'semi-annual': 180,
+ 'annually': 360,
+ },
+ 'married': {
+ 'weekly' : 14,
+ 'bi-weekly' : 28,
+ 'semi-monthly': 30,
+ 'monthly' : 60,
+ 'quarterly' : 180,
+ 'semi-annual': 360,
+ 'annually': 720,
+ },
+ }
+
+
+
+
+
+
+ US UT Utah SIT Tax Rate
+ us_ut_sit_tax_rate
+
+
+
+
+ {
+ 'single': {
+ 'weekly': ((137, 1.3)),
+ 'bi-weekly': ((274, 1.3)),
+ 'semi-monthly': ((297, 1.3)),
+ 'monthly': ((594, 1.3)),
+ 'quarterly': ((1782, 1.3)),
+ 'semi-annual': ((3564, 1.3)),
+ 'annually': ((7128, 1.3)),
+ },
+ 'married': {
+ 'weekly': ((274, 1.3)),
+ 'bi-weekly': (548, 1.3),
+ 'semi-monthly': ((594, 1.3)),
+ 'monthly': ((1188, 1.3)),
+ 'quarterly': ((3564, 1.3)),
+ 'semi-annual': ((7128, 1.3)),
+ 'annually': ((14256, 1.3)),
+ },
+ 'head_household': {
+ 'weekly': ((137, 1.3)),
+ 'bi-weekly': ((274, 1.3)),
+ 'semi-monthly': ((297, 1.3)),
+ 'monthly': ((594, 1.3)),
+ 'quarterly': ((1782, 1.3)),
+ 'semi-annual': ((3564, 1.3)),
+ 'annually': ((7128, 1.3)),
+ },
+ }
+
+
+
+
+
+
+
+ US Utah - Employment Security Commission - Unemployment Tax
+
+
+
+ US Utah - Tax Commission - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US UT Utah State Unemployment
+ ER_US_UT_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ut_suta_wage_base', rate='us_ut_suta_rate', state_code='UT')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ut_suta_wage_base', rate='us_ut_suta_rate', state_code='UT')
+
+
+
+
+
+
+
+
+ EE: US UT Utah State Income Tax Withholding
+ EE_US_UT_SIT
+ python
+ result, _ = ut_utah_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = ut_utah_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index 76bc6637..e8f10cd0 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -43,6 +43,7 @@ from .state.ny_new_york import ny_new_york_state_income_withholding
from .state.oh_ohio import oh_ohio_state_income_withholding
from .state.ok_oklahoma import ok_oklahoma_state_income_withholding
from .state.sc_south_carolina import sc_south_carolina_state_income_withholding
+from .state.ut_utah import ut_utah_state_income_withholding
from .state.vt_vermont import vt_vermont_state_income_withholding
from .state.va_virginia import va_virginia_state_income_withholding
from .state.wa_washington import wa_washington_fml_er, \
@@ -109,6 +110,7 @@ class HRPayslip(models.Model):
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
'ok_oklahoma_state_income_withholding': ok_oklahoma_state_income_withholding,
'sc_south_carolina_state_income_withholding': sc_south_carolina_state_income_withholding,
+ 'ut_utah_state_income_withholding': ut_utah_state_income_withholding,
'vt_vermont_state_income_withholding': vt_vermont_state_income_withholding,
'va_virginia_state_income_withholding': va_virginia_state_income_withholding,
'wa_washington_fml_er': wa_washington_fml_er,
diff --git a/l10n_us_hr_payroll/models/state/ut_utah.py b/l10n_us_hr_payroll/models/state/ut_utah.py
new file mode 100644
index 00000000..9e6b26f9
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/ut_utah.py
@@ -0,0 +1,39 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def ut_utah_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'UT'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ filing_status = payslip.contract_id.us_payroll_config_value('ut_w4_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ schedule_pay = payslip.contract_id.schedule_pay
+ additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ tax_rate = payslip.rule_parameter('us_ut_tax_rate')
+ allowances = payslip.rule_parameter('us_ut_sit_allowances_rate')[filing_status].get(schedule_pay)
+ tax_table = payslip.rule_parameter('us_ut_sit_tax_rate')[filing_status].get(schedule_pay)
+
+ taxable_income = wage * tax_rate
+ withholding = 0.0
+ amt, rate = tax_table
+ withholding = taxable_income - (allowances - ((wage - amt) * (rate / 100)))
+
+ withholding = max(withholding, 0.0)
+ withholding += additional
+ withholding = round(withholding)
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index de2e82df..12f6177e 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -244,6 +244,12 @@ class HRContractUSPayrollConfig(models.Model):
ok_w4_sit_allowances = fields.Integer(string='Oklahoma OK-W-4 Allowances', help='OK-W-4 1.2.3.')
sc_w4_sit_allowances = fields.Integer(string='South Carolina SC W-4 Allowances', help='SC W-4 5.')
+ ut_w4_sit_filing_status = fields.Selection([
+ ('single', 'Single'),
+ ('married', 'Married'),
+ ('head_household', 'Head of Household')
+ ], string='Utah UT W-4 Filing Status', help='UT W-4 C.')
+
vt_w4vt_sit_filing_status = fields.Selection([
('single', 'Single'),
('married', 'Married'),
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 1948f1e3..aee2a839 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -103,6 +103,8 @@ from . import test_us_sc_south_carolina_payslip_2020
from . import test_us_tx_texas_payslip_2019
from . import test_us_tx_texas_payslip_2020
+from . import test_us_us_utah_payslip_2020
+
from . import test_us_vt_vermont_payslip_2020
from . import test_us_va_virginia_payslip_2019
diff --git a/l10n_us_hr_payroll/tests/test_us_us_utah_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_us_utah_payslip_2020.py
new file mode 100755
index 00000000..0518fb79
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_us_utah_payslip_2020.py
@@ -0,0 +1,37 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsUTPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ UT_UNEMP_MAX_WAGE = 36600.0
+ UT_UNEMP = 1.5
+ # Calculation based on example https://src.bna.com/MSO
+
+ def _test_sit(self, wage, filing_status, additional_withholding, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('UT'),
+ ut_w4_sit_filing_status=filing_status,
+ state_income_tax_additional_withholding=additional_withholding,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('UT', self.UT_UNEMP, date(2020, 1, 1), wage_base=self.UT_UNEMP_MAX_WAGE)
+ self._test_sit(400, 'single', 0, 'weekly', date(2020, 1, 1), 16.00)
+ self._test_sit(1000, 'single', 0, 'bi-weekly', date(2020, 1, 1), 45.00)
+ self._test_sit(855, 'married', 0, 'semi-monthly', date(2020, 1, 1), 16.00)
+ self._test_sit(2500, 'married', 0, 'monthly', date(2020, 1, 1), 81.00)
+ self._test_sit(8000, 'single', 0, 'quarterly', date(2020, 1, 1), 387.00)
+ self._test_sit(8000, 'single', 10, 'quarterly', date(2020, 1, 1), 397.00)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index 21d3b5d0..a012ff3d 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -245,6 +245,11 @@
No additional fields.
+
+ Form UT W-4 - State Income Tax
+
+
+
Form VT W-4VT - State Income Tax
From 4e03be0c9f456a1ec34bbf4dfffac8b446706f92 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Wed, 20 May 2020 17:14:27 -0400
Subject: [PATCH 16/20] [IMP] l10n_us_hr_payroll: For Tennessee 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
.../data/state/tn_tennessee.xml | 51 +++++++++++++++++++
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../test_us_tn_tennessee_payslip_2020.py | 13 +++++
.../views/us_payroll_config_views.xml | 3 ++
5 files changed, 70 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/tn_tennessee.xml
create mode 100644 l10n_us_hr_payroll/tests/test_us_tn_tennessee_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 9194230c..06600f37 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -61,6 +61,7 @@ United States of America - Payroll Rules.
'data/state/ok_oklahoma.xml',
'data/state/pa_pennsylvania.xml',
'data/state/sc_south_carolina.xml',
+ 'data/state/tn_tennessee.xml',
'data/state/tx_texas.xml',
'data/state/ut_utah.xml',
'data/state/vt_vermont.xml',
diff --git a/l10n_us_hr_payroll/data/state/tn_tennessee.xml b/l10n_us_hr_payroll/data/state/tn_tennessee.xml
new file mode 100644
index 00000000..31465dee
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/tn_tennessee.xml
@@ -0,0 +1,51 @@
+
+
+
+
+ US TN Tennessee SUTA Wage Base
+ us_tn_suta_wage_base
+
+
+
+
+ 7000.00
+
+
+
+
+
+
+
+ US TN Tennessee SUTA Rate
+ us_tn_suta_rate
+
+
+
+
+ 2.7
+
+
+
+
+
+
+
+ US Tennessee - Department of Revenue - Unemployment Tax
+
+
+
+
+
+
+
+ ER: US TN Tennessee State Unemployment
+ ER_US_TN_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_tn_suta_wage_base', rate='us_tn_suta_rate', state_code='TN')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_tn_suta_wage_base', rate='us_tn_suta_rate', state_code='TN')
+
+
+
+
+
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index aee2a839..6c84a352 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -100,6 +100,8 @@ from . import test_us_pa_pennsylvania_payslip_2020
from . import test_us_sc_south_carolina_payslip_2019
from . import test_us_sc_south_carolina_payslip_2020
+from . import test_us_tn_tennessee_payslip_2020
+
from . import test_us_tx_texas_payslip_2019
from . import test_us_tx_texas_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_tn_tennessee_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_tn_tennessee_payslip_2020.py
new file mode 100644
index 00000000..54acfa9a
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_tn_tennessee_payslip_2020.py
@@ -0,0 +1,13 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date
+from .common import TestUsPayslip
+
+
+class TestUsTNPayslip(TestUsPayslip):
+ # TAXES AND RATES
+ TN_UNEMP_MAX_WAGE = 7000.00
+ TN_UNEMP = 2.7
+
+ def test_2020_taxes(self):
+ self._test_er_suta('TN', self.TN_UNEMP, date(2020, 1, 1), wage_base=self.TN_UNEMP_MAX_WAGE)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index a012ff3d..f9043feb 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -242,6 +242,9 @@
+
+ No additional fields.
+
No additional fields.
From d3555d7e704534f4a6d2f826fda45ee20b86fa79 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Wed, 20 May 2020 17:15:33 -0400
Subject: [PATCH 17/20] [IMP] l10n_us_hr_payroll: For South Dakota 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
.../data/state/sd_south_dakota.xml | 51 +++++++++++++++++++
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../test_us_sd_south_dakota_payslip_2020.py | 13 +++++
.../views/us_payroll_config_views.xml | 3 ++
5 files changed, 70 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/sd_south_dakota.xml
create mode 100644 l10n_us_hr_payroll/tests/test_us_sd_south_dakota_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 06600f37..2bfe77fc 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -61,6 +61,7 @@ United States of America - Payroll Rules.
'data/state/ok_oklahoma.xml',
'data/state/pa_pennsylvania.xml',
'data/state/sc_south_carolina.xml',
+ 'data/state/sd_south_dakota.xml',
'data/state/tn_tennessee.xml',
'data/state/tx_texas.xml',
'data/state/ut_utah.xml',
diff --git a/l10n_us_hr_payroll/data/state/sd_south_dakota.xml b/l10n_us_hr_payroll/data/state/sd_south_dakota.xml
new file mode 100644
index 00000000..95165ae5
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/sd_south_dakota.xml
@@ -0,0 +1,51 @@
+
+
+
+
+ US SD South Dakota SUTA Wage Base
+ us_sd_suta_wage_base
+
+
+
+
+ 15000.00
+
+
+
+
+
+
+
+ US SD South Dakota SUTA Rate
+ us_sd_suta_rate
+
+
+
+
+ 1.75
+
+
+
+
+
+
+
+ US South Dakota - Department of Labor - Unemployment Tax
+
+
+
+
+
+
+
+ ER: US SD South Dakota State Unemployment
+ ER_US_SD_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_sd_suta_wage_base', rate='us_sd_suta_rate', state_code='SD')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_sd_suta_wage_base', rate='us_sd_suta_rate', state_code='SD')
+
+
+
+
+
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 6c84a352..a7957e5e 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -100,6 +100,8 @@ from . import test_us_pa_pennsylvania_payslip_2020
from . import test_us_sc_south_carolina_payslip_2019
from . import test_us_sc_south_carolina_payslip_2020
+from . import test_us_sd_south_dakota_payslip_2020
+
from . import test_us_tn_tennessee_payslip_2020
from . import test_us_tx_texas_payslip_2019
diff --git a/l10n_us_hr_payroll/tests/test_us_sd_south_dakota_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_sd_south_dakota_payslip_2020.py
new file mode 100644
index 00000000..bdbb7858
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_sd_south_dakota_payslip_2020.py
@@ -0,0 +1,13 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date
+from .common import TestUsPayslip
+
+
+class TestUsSDPayslip(TestUsPayslip):
+ # TAXES AND RATES
+ SD_UNEMP_MAX_WAGE = 15000.00
+ SD_UNEMP = 1.75
+
+ def test_2020_taxes(self):
+ self._test_er_suta('SD', self.SD_UNEMP, date(2020, 1, 1), wage_base=self.SD_UNEMP_MAX_WAGE)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index f9043feb..ca572a0c 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -242,6 +242,9 @@
+
+ No additional fields.
+
No additional fields.
From f9a7107740a874aa35def75917e4ea44d1a35b01 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Thu, 28 May 2020 10:26:14 -0400
Subject: [PATCH 18/20] [IMP] l10n_us_hr_payroll: For Wisconsin 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
.../data/state/wi_wisconsin.xml | 100 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/wi_wisconsin.py | 47 ++++++++
.../models/us_payroll_config.py | 6 ++
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../test_us_wi_wisconsin_payslip_2020.py | 37 +++++++
.../views/us_payroll_config_views.xml | 7 ++
8 files changed, 202 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/wi_wisconsin.xml
create mode 100644 l10n_us_hr_payroll/models/state/wi_wisconsin.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_wi_wisconsin_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 2bfe77fc..a9420613 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -68,6 +68,7 @@ United States of America - Payroll Rules.
'data/state/vt_vermont.xml',
'data/state/va_virginia.xml',
'data/state/wa_washington.xml',
+ 'data/state/wi_wisconsin.xml',
'data/state/wy_wyoming.xml',
'views/hr_contract_views.xml',
'views/us_payroll_config_views.xml',
diff --git a/l10n_us_hr_payroll/data/state/wi_wisconsin.xml b/l10n_us_hr_payroll/data/state/wi_wisconsin.xml
new file mode 100644
index 00000000..baff6b3a
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/wi_wisconsin.xml
@@ -0,0 +1,100 @@
+
+
+
+
+ US WI Wisconsin SUTA Wage Base
+ us_wi_suta_wage_base
+
+
+
+
+ 14000.00
+
+
+
+
+
+
+
+ US WI Wisconsin SUTA Rate
+ us_wi_suta_rate
+
+
+
+
+ 3.05
+
+
+
+
+
+
+ US WI Wisconsin Exemption Rate
+ us_wi_sit_exemption_rate
+
+
+
+
+ 22
+
+
+
+
+
+
+ US WI Wisconsin SIT Tax Rate
+ us_wi_sit_tax_rate
+
+
+
+
+ {
+ 'single': ((5730, 0.0000, 0.0), (15200, 4.0000, 0.0), (16486, 4.4800, 378.80), (26227, 6.5408, 436.41), (62950, 7.0224, 1073.55), (240190, 6.2700, 3652.39), ('inf', 7.6500, 14765.34)),
+ 'married': ((7870, 0.0000, 0.0), (18780, 4.0000, 0.0), (21400, 5.8400, 436.40), (28308, 7.0080, 589.41), (60750, 7.5240, 1073.52), (240190, 6.2700, 3514.46), ('inf', 7.6500, 14765.35)),
+ }
+
+
+
+
+
+
+
+ US Wisconsin - Department of Workforce Development - Unemployment Tax
+
+
+
+ US Wisconsin - Department of Revenue - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US WI Wisconsin State Unemployment
+ ER_US_WI_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_wi_suta_wage_base', rate='us_wi_suta_rate', state_code='WI')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_wi_suta_wage_base', rate='us_wi_suta_rate', state_code='WI')
+
+
+
+
+
+
+
+
+ EE: US WI Wisconsin State Income Tax Withholding
+ EE_US_WI_SIT
+ python
+ result, _ = wi_wisconsin_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = wi_wisconsin_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index e8f10cd0..2eff7feb 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -48,6 +48,7 @@ from .state.vt_vermont import vt_vermont_state_income_withholding
from .state.va_virginia import va_virginia_state_income_withholding
from .state.wa_washington import wa_washington_fml_er, \
wa_washington_fml_ee
+from .state.wi_wisconsin import wi_wisconsin_state_income_withholding
class HRPayslip(models.Model):
@@ -115,6 +116,7 @@ class HRPayslip(models.Model):
'va_virginia_state_income_withholding': va_virginia_state_income_withholding,
'wa_washington_fml_er': wa_washington_fml_er,
'wa_washington_fml_ee': wa_washington_fml_ee,
+ 'wi_wisconsin_state_income_withholding': wi_wisconsin_state_income_withholding,
})
return res
diff --git a/l10n_us_hr_payroll/models/state/wi_wisconsin.py b/l10n_us_hr_payroll/models/state/wi_wisconsin.py
new file mode 100644
index 00000000..c1d53bbb
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/wi_wisconsin.py
@@ -0,0 +1,47 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def wi_wisconsin_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'WI'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ if payslip.contract_id.us_payroll_config_value('state_income_tax_exempt'):
+ return 0.0, 0.0
+
+ filing_status = payslip.contract_id.us_payroll_config_value('wi_wt4_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ pay_periods = payslip.dict.get_pay_periods_in_year()
+ additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ exemptions = payslip.contract_id.us_payroll_config_value('wi_wt4_sit_exemptions')
+ exemption_amt = payslip.rule_parameter('us_wi_sit_exemption_rate')
+ tax_table = payslip.rule_parameter('us_wi_sit_tax_rate')[filing_status]
+
+ taxable_income = wage * pay_periods
+ withholding = 0.0
+ last = 0.0
+ for row in tax_table:
+ amt, rate, flat_fee = row
+ if taxable_income <= float(amt):
+ withholding = (((taxable_income - last) * (rate / 100)) + flat_fee) - (exemptions * exemption_amt)
+ break
+ last = amt
+
+ withholding = max(withholding, 0.0)
+ withholding /= pay_periods
+ withholding += additional
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index 12f6177e..edb813b9 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -261,3 +261,9 @@ class HRContractUSPayrollConfig(models.Model):
help='VA-4(P) 1(a)')
va_va4_sit_other_exemptions = fields.Integer(string='Virginia VA-4(P) Age & Blindness Exemptions',
help='VA-4(P) 1(b)')
+
+ wi_wt4_sit_filing_status = fields.Selection([
+ ('single', 'Single'),
+ ('married', 'Married'),
+ ], string='Wisconsin WT-4 Filing Status', help='WI WT-4')
+ wi_wt4_sit_exemptions = fields.Integer(string='Wisconsin Exemptions', help='WI WT-4 1.(d)')
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index a7957e5e..d75e6da7 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -117,5 +117,7 @@ from . import test_us_va_virginia_payslip_2020
from . import test_us_wa_washington_payslip_2019
from . import test_us_wa_washington_payslip_2020
+from . import test_us_wi_wisconsin_payslip_2020
+
from . import test_us_wy_wyoming_payslip_2019
from . import test_us_wy_wyoming_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_wi_wisconsin_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_wi_wisconsin_payslip_2020.py
new file mode 100755
index 00000000..8241e4c1
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_wi_wisconsin_payslip_2020.py
@@ -0,0 +1,37 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsWIPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ WI_UNEMP_MAX_WAGE = 14000.0
+ WI_UNEMP = 3.05
+ # Calculation based on example https://www.revenue.wi.gov/DOR%20Publications/pb166.pdf
+
+ def _test_sit(self, wage, filing_status, exemption, additional_withholding, exempt, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('WI'),
+ wi_wt4_sit_filing_status=filing_status,
+ wi_wt4_sit_exemptions=exemption,
+ state_income_tax_additional_withholding=additional_withholding,
+ state_income_tax_exempt=exempt,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('WI', self.WI_UNEMP, date(2020, 1, 1), wage_base=self.WI_UNEMP_MAX_WAGE)
+ self._test_sit(300, 'single', 1, 0, False,'weekly', date(2020, 1, 1), 7.21)
+ self._test_sit(700, 'married', 3, 0, False, 'bi-weekly', date(2020, 1, 1), 13.35)
+ self._test_sit(1300, 'single', 1, 10, True, 'bi-weekly', date(2020, 1, 1), 0.00)
+ self._test_sit(700, 'married', 3, 10, False, 'bi-weekly', date(2020, 1, 1), 23.35)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index ca572a0c..9312360d 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -274,6 +274,13 @@
No additional fields.
Ensure that your Employee and Employer workers' comp code fields are filled in for WA LNI withholding.
+
+ Form WT-4 - State Income Tax
+
+
+
+
+
No additional fields.
From f4916a0af5668385d1c4fe186446989870280c03 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Thu, 28 May 2020 15:08:30 -0400
Subject: [PATCH 19/20] [IMP] l10n_us_hr_payroll: For West Virginia 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
.../data/state/wv_west_virginia.xml | 125 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/wv_west_virginia.py | 44 ++++++
.../models/us_payroll_config.py | 9 +-
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../test_us_wv_west_virginia_payslip_2020.py | 36 +++++
.../views/us_payroll_config_views.xml | 6 +
8 files changed, 224 insertions(+), 1 deletion(-)
create mode 100644 l10n_us_hr_payroll/data/state/wv_west_virginia.xml
create mode 100644 l10n_us_hr_payroll/models/state/wv_west_virginia.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_wv_west_virginia_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index a9420613..962a9609 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -69,6 +69,7 @@ United States of America - Payroll Rules.
'data/state/va_virginia.xml',
'data/state/wa_washington.xml',
'data/state/wi_wisconsin.xml',
+ 'data/state/wv_west_virginia.xml',
'data/state/wy_wyoming.xml',
'views/hr_contract_views.xml',
'views/us_payroll_config_views.xml',
diff --git a/l10n_us_hr_payroll/data/state/wv_west_virginia.xml b/l10n_us_hr_payroll/data/state/wv_west_virginia.xml
new file mode 100644
index 00000000..c91b03b8
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/wv_west_virginia.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ US WV West Virginia SUTA Wage Base
+ us_wv_suta_wage_base
+
+
+
+
+ 12000.0
+
+
+
+
+
+
+
+ US WV West Virginia SUTA Rate
+ us_wv_suta_rate
+
+
+
+
+ 2.7
+
+
+
+
+
+
+ US WV West Virginia Exemption Rate
+ us_wv_sit_exemption_rate
+
+
+
+
+ {
+ 'weekly' : 38.46,
+ 'bi-weekly' : 76.92,
+ 'semi-monthly': 83.33,
+ 'monthly' : 166.67,
+ 'annually': 2000.00,
+ }
+
+
+
+
+
+
+ US WV West Virginia SIT Tax Rate
+ us_wv_sit_tax_rate
+
+
+
+
+ {
+ 'single': {
+ 'weekly':((192, 0.00, 3.0), (481, 5.76, 4.0), (769, 17.32, 4.5), (1154, 30.28, 6.0), ('inf', 53.38, 6.5)),
+ 'bi-weekly':((385, 0.00, 3.0), (962, 11.55, 4.0), (1538, 34.63, 4.5), (2308, 60.55, 6.0), ('inf', 106.75, 6.5)),
+ 'semi-monthly':((417, 0.00, 3.0), (1042, 12.51, 4.0), (1667, 37.51, 4.5), (2500, 65.64, 6.0), ('inf', 115.62, 6.5)),
+ 'monthly':((833, 0.00, 3.0), (2083, 24.99, 4.0), (3333, 74.99, 4.5), (5000, 131.24, 6.0), ('inf', 231.26, 6.5)),
+ 'annually':((10000, 0.00, 3.0), (25000, 300.00, 4.0), (40000, 900.00, 4.5), (60000, 1575.00, 6.0), ('inf', 2775.00, 6.5)),
+ },
+ 'married': {
+ 'weekly':((115, 0.00, 3.0), (288, 3.45, 4.0), (462, 10.37, 4.5), (692, 18.20, 6.0), ('inf', 32.00, 6.5)),
+ 'bi-weekly':((231, 0.00, 3.0), (577, 6.93, 4.0), (923, 20.77, 4.5), (1385, 36.34, 6.0), ('inf', 64.06, 6.5)),
+ 'semi-monthly':((250, 0.00, 3.0), (625, 7.50, 4.0), (1000, 22.50, 4.5), (1500, 39.38, 6.0), ('inf', 69.38, 6.5)),
+ 'monthly':((500, 0.00, 3.0), (1250, 15.00, 4.0), (2000, 45.00, 4.5), (3000, 78.75, 6.0), ('inf', 138.75, 6.5)),
+ 'annually':((6000, 0.00, 3.0), (15000, 180.00, 4.0), (24000, 540.00, 4.5), (36000, 945.00, 6.0), ('inf', 1665.00, 6.5)),
+ },
+ 'head_household': {
+ 'weekly':((192, 0.00, 3.0), (481, 5.76, 4.0), (769, 17.32, 4.5), (1154, 30.28, 6.0), ('inf', 53.38, 6.5)),
+ 'bi-weekly':((385, 0.00, 3.0), (962, 11.55, 4.0), (1538, 34.63, 4.5), (2308, 60.55, 6.0), ('inf', 106.75, 6.5)),
+ 'semi-monthly':((417, 0.00, 3.0), (1042, 12.51, 4.0), (1667, 37.51, 4.5), (2500, 65.64, 6.0), ('inf', 115.62, 6.5)),
+ 'monthly':((833, 0.00, 3.0), (2083, 24.99, 4.0), (3333, 74.99, 4.5), (5000, 131.24, 6.0), ('inf', 231.26, 6.5)),
+ 'annually':((10000, 0.00, 3.0), (25000, 300.00, 4.0), (40000, 900.00, 4.5), (60000, 1575.00, 6.0), ('inf', 2775.00, 6.5)),
+ },
+ }
+
+
+
+
+
+
+
+ US West Virginia - WorkForce - Unemployment Tax
+
+
+
+ US West Virginia - Department of Revenue - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US WV West Virginia State Unemployment
+ ER_US_WV_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_wv_suta_wage_base', rate='us_wv_suta_rate', state_code='WV')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_wv_suta_wage_base', rate='us_wv_suta_rate', state_code='WV')
+
+
+
+
+
+
+
+
+ EE: US WV West Virginia State Income Tax Withholding
+ EE_US_WV_SIT
+ python
+ result, _ = wv_west_virginia_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = wv_west_virginia_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index 2eff7feb..24025a39 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -49,6 +49,7 @@ from .state.va_virginia import va_virginia_state_income_withholding
from .state.wa_washington import wa_washington_fml_er, \
wa_washington_fml_ee
from .state.wi_wisconsin import wi_wisconsin_state_income_withholding
+from .state.wv_west_virginia import wv_west_virginia_state_income_withholding
class HRPayslip(models.Model):
@@ -117,6 +118,7 @@ class HRPayslip(models.Model):
'wa_washington_fml_er': wa_washington_fml_er,
'wa_washington_fml_ee': wa_washington_fml_ee,
'wi_wisconsin_state_income_withholding': wi_wisconsin_state_income_withholding,
+ 'wv_west_virginia_state_income_withholding': wv_west_virginia_state_income_withholding,
})
return res
diff --git a/l10n_us_hr_payroll/models/state/wv_west_virginia.py b/l10n_us_hr_payroll/models/state/wv_west_virginia.py
new file mode 100644
index 00000000..34031eb0
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/wv_west_virginia.py
@@ -0,0 +1,44 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def wv_west_virginia_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'WV'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ filing_status = payslip.contract_id.us_payroll_config_value('wv_it104_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ schedule_pay = payslip.contract_id.schedule_pay
+ additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ exemptions = payslip.contract_id.us_payroll_config_value('wv_it104_sit_exemptions')
+ exemption_amt = payslip.rule_parameter('us_wv_sit_exemption_rate')[schedule_pay]
+ tax_table = payslip.rule_parameter('us_wv_sit_tax_rate')[filing_status].get(schedule_pay)
+
+ taxable_income = wage - (exemptions * exemption_amt)
+ withholding = 0.0
+ last = 0.0
+ for row in tax_table:
+ amt, flat_fee, rate = row
+ if taxable_income <= float(amt):
+ withholding = ((taxable_income - last) * (rate / 100)) + flat_fee
+ break
+ last = amt
+
+ withholding = max(withholding, 0.0)
+ withholding += additional
+ withholding = round(withholding)
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index edb813b9..6bb6f8dd 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -266,4 +266,11 @@ class HRContractUSPayrollConfig(models.Model):
('single', 'Single'),
('married', 'Married'),
], string='Wisconsin WT-4 Filing Status', help='WI WT-4')
- wi_wt4_sit_exemptions = fields.Integer(string='Wisconsin Exemptions', help='WI WT-4 1.(d)')
\ No newline at end of file
+ wi_wt4_sit_exemptions = fields.Integer(string='Wisconsin Exemptions', help='WI WT-4 1.(d)')
+
+ wv_it104_sit_filing_status = fields.Selection([
+ ('single', 'Single'),
+ ('married', 'Married'),
+ ('head_household', 'Head of Household')
+ ], string='West Virginia WV/IT-104 Filing Status', help='WV WV/IT-104')
+ wv_it104_sit_exemptions = fields.Integer(string='West Virginia Exemptions', help='WV WV/IT-104 4.')
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index d75e6da7..77c30221 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -117,6 +117,8 @@ from . import test_us_va_virginia_payslip_2020
from . import test_us_wa_washington_payslip_2019
from . import test_us_wa_washington_payslip_2020
+from . import test_us_wv_west_virginia_payslip_2020
+
from . import test_us_wi_wisconsin_payslip_2020
from . import test_us_wy_wyoming_payslip_2019
diff --git a/l10n_us_hr_payroll/tests/test_us_wv_west_virginia_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_wv_west_virginia_payslip_2020.py
new file mode 100755
index 00000000..acef111e
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_wv_west_virginia_payslip_2020.py
@@ -0,0 +1,36 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsWVPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ WV_UNEMP_MAX_WAGE = 12000.0
+ WV_UNEMP = 2.7
+ # Calculation based on example https://tax.wv.gov/Documents/TaxForms/it100.1a.pdf
+
+ def _test_sit(self, wage, filing_status, exemption, additional_withholding, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('WV'),
+ wv_it104_sit_filing_status=filing_status,
+ wv_it104_sit_exemptions=exemption,
+ state_income_tax_additional_withholding=additional_withholding,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('WV', self.WV_UNEMP, date(2020, 1, 1), wage_base=self.WV_UNEMP_MAX_WAGE)
+ self._test_sit(1250, 'married', 2, 0, 'semi-monthly', date(2020, 1, 1), 44.00)
+ self._test_sit(1300, 'single', 1, 0, 'bi-weekly', date(2020, 1, 1), 46.00)
+ self._test_sit(1300, 'single', 1, 10, 'bi-weekly', date(2020, 1, 1), 56.00)
+ self._test_sit(15000, 'single', 2, 0, 'monthly', date(2020, 1, 1), 860.00)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index 9312360d..4d2c6d98 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -274,6 +274,12 @@
No additional fields.
Ensure that your Employee and Employer workers' comp code fields are filled in for WA LNI withholding.
+
+ Form WV/IT-104 - State Income Tax
+
+
+
+
Form WT-4 - State Income Tax
From ff094dba6489d90045df9d1ab117aec337a607d3 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Tue, 2 Jun 2020 15:31:01 -0400
Subject: [PATCH 20/20] [IMP] l10n_us_hr_payroll: For Rhode Island 13.0
---
l10n_us_hr_payroll/__manifest__.py | 1 +
.../data/state/ri_rhode_island.xml | 113 ++++++++++++++++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/ri_rhode_island.py | 48 ++++++++
.../models/us_payroll_config.py | 3 +
l10n_us_hr_payroll/tests/__init__.py | 2 +
.../test_us_ri_rhode_island_payslip_2020.py | 37 ++++++
.../views/us_payroll_config_views.xml | 6 +
8 files changed, 212 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/ri_rhode_island.xml
create mode 100644 l10n_us_hr_payroll/models/state/ri_rhode_island.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_ri_rhode_island_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 962a9609..758287af 100644
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -60,6 +60,7 @@ United States of America - Payroll Rules.
'data/state/oh_ohio.xml',
'data/state/ok_oklahoma.xml',
'data/state/pa_pennsylvania.xml',
+ 'data/state/ri_rhode_island.xml',
'data/state/sc_south_carolina.xml',
'data/state/sd_south_dakota.xml',
'data/state/tn_tennessee.xml',
diff --git a/l10n_us_hr_payroll/data/state/ri_rhode_island.xml b/l10n_us_hr_payroll/data/state/ri_rhode_island.xml
new file mode 100644
index 00000000..de004eca
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/ri_rhode_island.xml
@@ -0,0 +1,113 @@
+
+
+
+
+ US RI Rhode Island SUTA Wage Base
+ us_ri_suta_wage_base
+
+
+
+
+ 24000.0
+
+
+
+
+
+
+
+ US RI Rhode Island SUTA Rate
+ us_ri_suta_rate
+
+
+
+
+ 1.3
+
+
+
+
+
+
+ US RI Rhode Island Exemption Rate
+ us_ri_sit_exemption_rate
+
+
+
+
+ {
+ 'weekly' : (( 0.00, 19.23), ( 4451.92, 0.00)),
+ 'bi-weekly' : (( 0.00, 38.46), ( 8903.85, 0.00)),
+ 'semi-monthly': (( 0.00, 41.67), ( 9645.83, 0.00)),
+ 'monthly' : (( 0.00, 83.33), ( 19291.67, 0.00)),
+ 'quarterly' : (( 0.00, 250.00), ( 57875.00, 0.00)),
+ 'semi-annually': (( 0.00, 500.00), ( 115750.00, 0.00)),
+ 'annually': (( 0.00, 1000.0), ( 231500.00, 0000)),
+ }
+
+
+
+
+
+
+ US RI Rhode Island SIT Tax Rate
+ us_ri_sit_tax_rate
+
+
+
+
+ {
+ 'weekly': ((1255, 0.00, 3.75), (2853, 47.06, 4.75), ('inf', 122.97, 5.99)),
+ 'bi-weekly': ((2510, 0.00, 3.75), (5706, 94.13, 4.75), ('inf', 245.94, 5.99)),
+ 'semi-monthly': ((2719, 0.00, 3.75), (6181, 101.96, 4.75), ('inf', 266.41, 5.99)),
+ 'monthly': ((5438, 0.00, 3.75), (12363, 203.93, 4.75), ('inf', 532.87, 5.99)),
+ 'quarterly': ((16313, 0.00, 3.75), (37088, 611.74, 4.75), ('inf', 1598.55, 5.99)),
+ 'semi-annually': ((32625, 0.00, 3.75), (74175, 1223.44, 4.75), ('inf', 3197.07, 5.99)),
+ 'annually': ((65250, 0.00, 3.75), (148350, 2446.88, 4.75), ('inf', 6394.13, 5.99)),
+ }
+
+
+
+
+
+
+
+ US Rhode Island - Department of Labor and Training - Unemployment Tax
+
+
+
+ US Rhode Island - Division of Taxations - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US RI Rhode Island State Unemployment
+ ER_US_RI_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ri_suta_wage_base', rate='us_ri_suta_rate', state_code='RI')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ri_suta_wage_base', rate='us_ri_suta_rate', state_code='RI')
+
+
+
+
+
+
+
+
+ EE: US RI Rhode Island State Income Tax Withholding
+ EE_US_RI_SIT
+ python
+ result, _ = ri_rhode_island_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = ri_rhode_island_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index 24025a39..e5a728f2 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -42,6 +42,7 @@ from .state.nm_new_mexico import nm_new_mexico_state_income_withholding
from .state.ny_new_york import ny_new_york_state_income_withholding
from .state.oh_ohio import oh_ohio_state_income_withholding
from .state.ok_oklahoma import ok_oklahoma_state_income_withholding
+from .state.ri_rhode_island import ri_rhode_island_state_income_withholding
from .state.sc_south_carolina import sc_south_carolina_state_income_withholding
from .state.ut_utah import ut_utah_state_income_withholding
from .state.vt_vermont import vt_vermont_state_income_withholding
@@ -111,6 +112,7 @@ class HRPayslip(models.Model):
'ny_new_york_state_income_withholding': ny_new_york_state_income_withholding,
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
'ok_oklahoma_state_income_withholding': ok_oklahoma_state_income_withholding,
+ 'ri_rhode_island_state_income_withholding': ri_rhode_island_state_income_withholding,
'sc_south_carolina_state_income_withholding': sc_south_carolina_state_income_withholding,
'ut_utah_state_income_withholding': ut_utah_state_income_withholding,
'vt_vermont_state_income_withholding': vt_vermont_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/ri_rhode_island.py b/l10n_us_hr_payroll/models/state/ri_rhode_island.py
new file mode 100644
index 00000000..454bde47
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/ri_rhode_island.py
@@ -0,0 +1,48 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def ri_rhode_island_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'RI'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ if payslip.contract_id.us_payroll_config_value('state_income_tax_exempt'):
+ return 0.0, 0.0
+
+ schedule_pay = payslip.contract_id.schedule_pay
+ additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ allowances = payslip.contract_id.us_payroll_config_value('ri_w4_sit_allowances')
+ exemption_rate = payslip.rule_parameter('us_ri_sit_exemption_rate')[schedule_pay]
+ tax_table = payslip.rule_parameter('us_ri_sit_tax_rate')[schedule_pay]
+
+ exemption_amt = 0.0
+ for row in exemption_rate:
+ amt, flat_fee = row
+ if wage > amt:
+ exemption_amt = flat_fee
+
+ taxable_income = wage - (allowances * exemption_amt)
+ withholding = 0.0
+ last = 0.0
+ for row in tax_table:
+ amt, flat_fee, rate = row
+ if wage <= float(amt):
+ withholding = ((taxable_income - last) * (rate / 100)) + flat_fee
+ break
+ last = amt
+
+ withholding = max(withholding, 0.0)
+ withholding += additional
+ return wage, -((withholding / wage) * 100.0)
diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py
index 6bb6f8dd..baceae6c 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -242,6 +242,9 @@ class HRContractUSPayrollConfig(models.Model):
('head_household', 'Head of Household')
], string='Oklahoma OK-W-4 Filing Status', help='OK-W-4')
ok_w4_sit_allowances = fields.Integer(string='Oklahoma OK-W-4 Allowances', help='OK-W-4 1.2.3.')
+
+ ri_w4_sit_allowances = fields.Integer(string='Rhode Island RI W-4 Allowances', help='RI W-4 1.')
+
sc_w4_sit_allowances = fields.Integer(string='South Carolina SC W-4 Allowances', help='SC W-4 5.')
ut_w4_sit_filing_status = fields.Selection([
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 77c30221..f3baeecb 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -97,6 +97,8 @@ from . import test_us_ok_oklahoma_payslip_2020
from . import test_us_pa_pennsylvania_payslip_2019
from . import test_us_pa_pennsylvania_payslip_2020
+from . import test_us_ri_rhode_island_payslip_2020
+
from . import test_us_sc_south_carolina_payslip_2019
from . import test_us_sc_south_carolina_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_ri_rhode_island_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_ri_rhode_island_payslip_2020.py
new file mode 100755
index 00000000..6d4b35dd
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_ri_rhode_island_payslip_2020.py
@@ -0,0 +1,37 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from datetime import date, timedelta
+from .common import TestUsPayslip
+
+
+class TestUsRIPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ RI_UNEMP_MAX_WAGE = 24000.0
+ RI_UNEMP = 1.3
+ # Calculation based on example http://www.tax.ri.gov/forms/2020/Withholding/2020%20Withhholding%20Tax%20Booklet.pdf
+
+ def _test_sit(self, wage, allowances, additional_withholding, exempt, schedule_pay, date_start, expected_withholding):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('RI'),
+ ri_w4_sit_allowances=allowances,
+ state_income_tax_additional_withholding=additional_withholding,
+ state_income_tax_exempt=exempt,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self._log('Computed period tax: ' + str(expected_withholding))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('RI', self.RI_UNEMP, date(2020, 1, 1), wage_base=self.RI_UNEMP_MAX_WAGE)
+ self._test_sit(2195, 1, 0, False, 'weekly', date(2020, 1, 1), 90.80)
+ self._test_sit(1800, 2, 10, True, 'weekly', date(2020, 1, 1), 0.00)
+ self._test_sit(10000, 1, 0, False, 'bi-weekly', date(2020, 1, 1), 503.15)
+ self._test_sit(18000, 2, 0, False, 'monthly', date(2020, 1, 1), 860.54)
+ self._test_sit(18000, 2, 10, False, 'monthly', date(2020, 1, 1), 870.55)
diff --git a/l10n_us_hr_payroll/views/us_payroll_config_views.xml b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
index 4d2c6d98..eb01c155 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -237,6 +237,12 @@
+
+ Form RI W-4 - State Income Tax
+
+
+
+
Form SC W-4 - State Income Tax