From ef25f0c3ebe2a1985bed6d127157459884f19f6d Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Tue, 14 Apr 2020 12:44:08 -0400
Subject: [PATCH] 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.