From 18d1a25fcf5a69a71bd6c9499d823ff7d42026ad Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Tue, 14 Jan 2020 17:56:36 -0500
Subject: [PATCH 01/12] IMP `l10n_us_hr_payroll` Port `l10n_us_mo_hr_payroll`
MO Missouri including migration
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/final.xml | 3 +
l10n_us_hr_payroll/data/state/mo_missouri.xml | 141 +++++++++++++
l10n_us_hr_payroll/migrations/data.py | 15 ++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/mo_missouri.py | 52 +++++
.../models/us_payroll_config.py | 10 +-
l10n_us_hr_payroll/tests/__init__.py | 3 +
.../tests/test_us_mo_missouri_payslip_2019.py | 188 ++++++++++++++++++
.../tests/test_us_mo_missouri_payslip_2020.py | 105 ++++++++++
.../views/us_payroll_config_views.xml | 6 +
11 files changed, 525 insertions(+), 1 deletion(-)
create mode 100644 l10n_us_hr_payroll/data/state/mo_missouri.xml
create mode 100644 l10n_us_hr_payroll/models/state/mo_missouri.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2019.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 54791cef..9302a934 100755
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -30,6 +30,7 @@ USA Payroll Rules.
'data/federal/fed_941_fit_rules.xml',
'data/state/fl_florida.xml',
'data/state/ga_georgia.xml',
+ 'data/state/mo_missouri.xml',
'data/state/ms_mississippi.xml',
'data/state/mt_montana.xml',
'data/state/oh_ohio.xml',
diff --git a/l10n_us_hr_payroll/data/final.xml b/l10n_us_hr_payroll/data/final.xml
index 9bdeeef6..c571fea5 100644
--- a/l10n_us_hr_payroll/data/final.xml
+++ b/l10n_us_hr_payroll/data/final.xml
@@ -21,6 +21,9 @@
ref('hr_payroll_rule_er_us_ga_suta'),
ref('hr_payroll_rule_ee_us_ga_sit'),
+ ref('hr_payroll_rule_er_us_mo_suta'),
+ ref('hr_payroll_rule_ee_us_mo_sit'),
+
ref('hr_payroll_rule_er_us_ms_suta'),
ref('hr_payroll_rule_ee_us_ms_sit'),
diff --git a/l10n_us_hr_payroll/data/state/mo_missouri.xml b/l10n_us_hr_payroll/data/state/mo_missouri.xml
new file mode 100644
index 00000000..cd6ccc28
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/mo_missouri.xml
@@ -0,0 +1,141 @@
+
+
+
+
+
+ US MO Missouri SUTA Wage Base
+ us_mo_suta_wage_base
+ 12000.0
+
+
+
+ US MO Missouri SUTA Wage Base
+ us_mo_suta_wage_base
+ 11500.0
+
+
+
+
+
+
+
+ US MO Missouri SUTA Rate
+ us_mo_suta_rate
+ 2.376
+
+
+
+ US MO Missouri SUTA Rate
+ us_mo_suta_rate
+ 2.376
+
+
+
+
+
+
+ US MO Missouri SIT Rate Table
+ us_mo_sit_rate
+ [
+ (1053.0, 1.5),
+ (1053.0, 2.0),
+ (1053.0, 2.5),
+ (1053.0, 3.0),
+ (1053.0, 3.5),
+ (1053.0, 4.0),
+ (1053.0, 4.5),
+ (1053.0, 5.0),
+ ( 'inf', 5.4),
+ ]
+
+
+
+ US MO Missouri SIT Rate Table
+ us_mo_sit_rate
+ [
+ (1073.0, 1.5),
+ (1073.0, 2.0),
+ (1073.0, 2.5),
+ (1073.0, 3.0),
+ (1073.0, 3.5),
+ (1073.0, 4.0),
+ (1073.0, 4.5),
+ (1073.0, 5.0),
+ ( 'inf', 5.4),
+ ]
+
+
+
+
+
+
+ US MO Missouri SIT Deduction
+ us_mo_sit_deduction
+ {
+ 'single': 12400.0,
+ 'married': 24800.0,
+ 'head_of_household': 18650.0,
+ }
+
+
+
+ US MO Missouri SIT Deduction
+ us_mo_sit_deduction
+ {
+ 'single': 12400.0,
+ 'married': 24800.0,
+ 'head_of_household': 18650.0,
+ }
+
+
+
+
+
+
+ US Missouri - Department of Taxation - Unemployment Tax
+
+
+
+ US Missouri - Department of Taxation - Unemployment Tax
+
+
+
+
+ US Missouri - Department of Taxation - Income Tax
+
+
+
+ US Missouri - Department of Taxation - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US MO Missouri State Unemployment
+ ER_US_MO_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_mo_suta_wage_base', rate='us_mo_suta_rate', state_code='MO')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_mo_suta_wage_base', rate='us_mo_suta_rate', state_code='MO')
+
+
+
+
+
+
+
+ EE: US MO Missouri State Income Tax Withholding
+ EE_US_MO_SIT
+ python
+ result, _ = mo_missouri_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = mo_missouri_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/migrations/data.py b/l10n_us_hr_payroll/migrations/data.py
index d6dd22b0..420d864c 100644
--- a/l10n_us_hr_payroll/migrations/data.py
+++ b/l10n_us_hr_payroll/migrations/data.py
@@ -14,6 +14,9 @@ FIELDS_CONTRACT_TO_US_PAYROLL_FORMS_2020 = {
'ga_g4_additional_allowances': 'ga_g4_sit_additional_allowances',
'ga_g4_additional_wh': 'state_income_tax_additional_withholding',
+ 'mo_mow4_filing_status': 'mo_mow4_sit_filing_status',
+ 'mo_mow4_additional_withholding': 'state_income_tax_additional_withholding',
+
'ms_89_350_filing_status': 'ms_89_350_sit_filing_status',
'ms_89_350_exemption': 'ms_89_350_sit_exemption_value',
'ms_89_350_additional_withholding': 'state_income_tax_additional_withholding',
@@ -57,6 +60,11 @@ XMLIDS_TO_REMOVE_2020 = [
'l10n_us_ga_hr_payroll.hr_payroll_ga_income_withhold',
'l10n_us_ga_hr_payroll.hr_payroll_rules_ga_unemp_wages',
+ 'l10n_us_mo_hr_payroll.hr_payroll_mo_unemp_wages',
+ 'l10n_us_mo_hr_payroll.hr_payroll_mo_unemp',
+ 'l10n_us_mo_hr_payroll.hr_payroll_mo_income_withhold',
+ 'l10n_us_mo_hr_payroll.hr_payroll_rules_mo_unemp_wages_2018',
+
'l10n_us_ms_hr_payroll.hr_payroll_ms_unemp_wages',
'l10n_us_ms_hr_payroll.hr_payroll_ms_unemp',
'l10n_us_ms_hr_payroll.hr_payroll_ms_income_withhold',
@@ -126,6 +134,13 @@ XMLIDS_TO_RENAME_2020 = {
'l10n_us_ga_hr_payroll.hr_payroll_rules_ga_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_ga_suta',
'l10n_us_ga_hr_payroll.hr_payroll_rules_ga_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_ga_sit',
+ 'l10n_us_mo_hr_payroll.res_partner_modor_unemp': 'l10n_us_hr_payroll.res_partner_us_mo_dor',
+ 'l10n_us_mo_hr_payroll.res_partner_modor_withhold': 'l10n_us_hr_payroll.res_partner_us_mo_dor_sit',
+ 'l10n_us_mo_hr_payroll.contrib_register_modor_unemp': 'l10n_us_hr_payroll.contrib_register_us_mo_dor',
+ 'l10n_us_mo_hr_payroll.contrib_register_modor_withhold': 'l10n_us_hr_payroll.contrib_register_us_mo_dor_sit',
+ 'l10n_us_mo_hr_payroll.hr_payroll_rules_mo_unemp_2018': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_mo_suta',
+ 'l10n_us_mo_hr_payroll.hr_payroll_rules_mo_inc_withhold_2018': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_mo_sit',
+
'l10n_us_ms_hr_payroll.res_partner_msdor_unemp': 'l10n_us_hr_payroll.res_partner_us_ms_dor',
'l10n_us_ms_hr_payroll.res_partner_msdor_withhold': 'l10n_us_hr_payroll.res_partner_us_ms_dor_sit',
'l10n_us_ms_hr_payroll.contrib_register_msdor_unemp': 'l10n_us_hr_payroll.contrib_register_us_ms_dor',
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index cdcb7208..33e263fa 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -15,6 +15,7 @@ from .state.general import general_state_unemployment, \
general_state_income_withholding, \
is_us_state
from .state.ga_georgia import ga_georgia_state_income_withholding
+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.oh_ohio import oh_ohio_state_income_withholding
@@ -54,6 +55,7 @@ class HRPayslip(models.Model):
'general_state_income_withholding': general_state_income_withholding,
'is_us_state': is_us_state,
'ga_georgia_state_income_withholding': ga_georgia_state_income_withholding,
+ 'mo_missouri_state_income_withholding': mo_missouri_state_income_withholding,
'ms_mississippi_state_income_withholding': ms_mississippi_state_income_withholding,
'mt_montana_state_income_withholding': mt_montana_state_income_withholding,
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/mo_missouri.py b/l10n_us_hr_payroll/models/state/mo_missouri.py
new file mode 100644
index 00000000..7819fc7b
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/mo_missouri.py
@@ -0,0 +1,52 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies
+
+
+def mo_missouri_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 = 'MO'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ filing_status = payslip.dict.contract_id.us_payroll_config_value('mo_mow4_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ reduced_withholding = payslip.dict.contract_id.us_payroll_config_value('mo_mow4_sit_withholding')
+ if reduced_withholding:
+ return wage, -((reduced_withholding / wage) * 100.0)
+
+ pay_periods = payslip.dict.get_pay_periods_in_year()
+ additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ sit_table = payslip.dict.rule_parameter('us_mo_sit_rate')
+ deduction = payslip.dict.rule_parameter('us_mo_sit_deduction')[filing_status]
+ if wage == 0.0:
+ return 0.0, 0.0
+
+ gross_taxable_income = wage * pay_periods
+ gross_taxable_income -= deduction
+
+ remaining_taxable_income = gross_taxable_income
+ withholding = 0.0
+ for amt, rate in sit_table:
+ amt = float(amt)
+ rate = rate / 100.0
+ if (remaining_taxable_income - amt) > 0.0 or (remaining_taxable_income - amt) == 0.0:
+ withholding += rate * amt
+ else:
+ withholding += rate * remaining_taxable_income
+ break
+ remaining_taxable_income = remaining_taxable_income - amt
+
+ withholding /= pay_periods
+ 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 5ff26656..809fa233 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -64,6 +64,14 @@ class HRContractUSPayrollConfig(models.Model):
ga_g4_sit_additional_allowances = fields.Integer(string='Georgia G-4 Additional Allowances',
help='G-4 5.')
+ mo_mow4_sit_filing_status = fields.Selection([
+ ('', 'Exempt'),
+ ('single', 'Single or Married Spouse Works or Married Filing Separate'),
+ ('married', 'Married (Spouse does not work)'),
+ ('head_of_household', 'Head of Household'),
+ ], string='Missouri W-4 Filing Status', help='MO W-4 1.')
+ mo_mow4_sit_withholding = fields.Integer(string='Missouri MO W-4 Reduced Withholding', help='MO W-4 3.')
+
ms_89_350_sit_filing_status = fields.Selection([
('', 'Exempt'),
('single', 'Single'),
@@ -93,4 +101,4 @@ class HRContractUSPayrollConfig(models.Model):
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',
- help='VA-4(P) 1(b)')
+ help='VA-4(P) 1(b)')
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 3e4cb355..6275549a 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -10,6 +10,9 @@ from . import test_us_fl_florida_payslip_2020
from . import test_us_ga_georgia_payslip_2019
from . import test_us_ga_georgia_payslip_2020
+from . import test_us_mo_missouri_payslip_2019
+from . import test_us_mo_missouri_payslip_2020
+
from . import test_us_ms_mississippi_payslip_2019
from . import test_us_ms_mississippi_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2019.py
new file mode 100755
index 00000000..27a0ad93
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2019.py
@@ -0,0 +1,188 @@
+
+from datetime import date
+from .common import TestUsPayslip
+
+
+class TestUsMoPayslip(TestUsPayslip):
+ # Calculations from http://dor.mo.gov/forms/4282_2019.pdf
+ SALARY = 12000.0
+ MO_UNEMP = -2.376 / 100.0
+
+ TAX = [
+ (1053.0, 1.5),
+ (1053.0, 2.0),
+ (1053.0, 2.5),
+ (1053.0, 3.0),
+ (1053.0, 3.5),
+ (1053.0, 4.0),
+ (1053.0, 4.5),
+ (1053.0, 5.0),
+ (999999999.0, 5.4),
+ ]
+
+ def test_2019_taxes_single(self):
+ # Payroll Period Monthly
+ salary = self.SALARY
+ pp = 12.0
+ gross_salary = salary * pp
+ spouse_employed = False
+
+ # Single
+ standard_deduction = 12400.0
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MO'),
+ mo_mow4_sit_filing_status='single',
+ state_income_tax_additional_withholding=0.0,
+ schedule_pay='monthly')
+
+ self._log('2019 Missouri tax single 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.MO_UNEMP)
+
+ mo_taxable_income = gross_salary - standard_deduction
+ self._log('%s = %s - %s -' % (mo_taxable_income, gross_salary, standard_deduction))
+
+ remaining_taxable_income = mo_taxable_income
+ tax = 0.0
+ for amt, rate in self.TAX:
+ amt = float(amt)
+ rate = rate / 100.0
+ self._log(str(amt) + ' : ' + str(rate) + ' : ' + str(remaining_taxable_income))
+ if (remaining_taxable_income - amt) > 0.0 or (remaining_taxable_income - amt) == 0.0:
+ tax += rate * amt
+ else:
+ tax += rate * remaining_taxable_income
+ break
+ remaining_taxable_income = remaining_taxable_income - amt
+
+ tax = -tax
+ self._log('Computed annual tax: ' + str(tax))
+
+ tax = tax / pp
+ tax = round(tax)
+ self._log('Computed period tax: ' + str(tax))
+ self.assertPayrollEqual(cats['EE_US_SIT'], tax)
+
+ def test_2019_spouse_not_employed(self):
+ # Payroll Period Semi-monthly
+ salary = self.SALARY
+ pp = 24.0
+ gross_salary = salary * pp
+
+ # Married
+ standard_deduction = 24800.0
+
+ employee = self._createEmployee()
+
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MO'),
+ mo_mow4_sit_filing_status='married',
+ state_income_tax_additional_withholding=0.0,
+ schedule_pay='semi-monthly')
+
+ self._log('2019 Missouri tax first payslip:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+
+ payslip.compute_sheet()
+
+ cats = self._getCategories(payslip)
+
+ mo_taxable_income = gross_salary - standard_deduction
+ self._log(mo_taxable_income)
+
+ remaining_taxable_income = mo_taxable_income
+ tax = 0.0
+ for amt, rate in self.TAX:
+ amt = float(amt)
+ rate = rate / 100.0
+ self._log(str(amt) + ' : ' + str(rate) + ' : ' + str(remaining_taxable_income))
+ if (remaining_taxable_income - amt) > 0.0 or (remaining_taxable_income - amt) == 0.0:
+ tax += rate * amt
+ else:
+ tax += rate * remaining_taxable_income
+ break
+ remaining_taxable_income = remaining_taxable_income - amt
+
+ tax = -tax
+ self._log('Computed annual tax: ' + str(tax))
+
+ tax = tax / pp
+ tax = round(tax)
+ self._log('Computed period tax: ' + str(tax))
+ self.assertPayrollEqual(cats['EE_US_SIT'], tax)
+
+ def test_2019_head_of_household(self):
+ # Payroll Period Weekly
+ salary = self.SALARY
+
+ # Payroll Period Weekly
+ salary = self.SALARY
+ pp = 52.0
+ gross_salary = salary * pp
+
+ # Single HoH
+ standard_deduction = 18650.0
+
+ employee = self._createEmployee()
+
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MO'),
+ mo_mow4_sit_filing_status='head_of_household',
+ state_income_tax_additional_withholding=0.0,
+ schedule_pay='weekly')
+
+ self._log('2019 Missouri tax first payslip:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+
+ payslip.compute_sheet()
+
+ cats = self._getCategories(payslip)
+
+ mo_taxable_income = gross_salary - standard_deduction
+ self._log(mo_taxable_income)
+
+ remaining_taxable_income = mo_taxable_income
+ tax = 0.0
+ for amt, rate in self.TAX:
+ amt = float(amt)
+ rate = rate / 100.0
+ self._log(str(amt) + ' : ' + str(rate) + ' : ' + str(remaining_taxable_income))
+ if (remaining_taxable_income - amt) > 0.0 or (remaining_taxable_income - amt) == 0.0:
+ tax += rate * amt
+ else:
+ tax += rate * remaining_taxable_income
+ break
+ remaining_taxable_income = remaining_taxable_income - amt
+ tax = -tax
+ self._log('Computed annual tax: ' + str(tax))
+
+ tax = tax / pp
+ tax = round(tax)
+ self._log('Computed period tax: ' + str(tax))
+ self.assertPayrollEqual(cats['EE_US_SIT'], tax)
+
+ def test_2019_underflow(self):
+ # Payroll Period Weekly
+ salary = 200.0
+
+ employee = self._createEmployee()
+
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MO'))
+
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['EE_US_SIT'], 0.0)
diff --git a/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2020.py
new file mode 100755
index 00000000..164b0f0f
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2020.py
@@ -0,0 +1,105 @@
+
+from datetime import date
+from .common import TestUsPayslip
+
+
+class TestUsMoPayslip(TestUsPayslip):
+ # Calculations from http://dor.mo.gov/forms/4282_2020.pdf
+ MO_UNEMP_MAX_WAGE = 11500.0
+ MO_UNEMP = 2.376
+
+ TAX = [
+ (1073.0, 1.5),
+ (1073.0, 2.0),
+ (1073.0, 2.5),
+ (1073.0, 3.0),
+ (1073.0, 3.5),
+ (1073.0, 4.0),
+ (1073.0, 4.5),
+ (1073.0, 5.0),
+ ( 'inf', 5.4),
+ ]
+ STD_DED = {
+ '': 0.0, # Exempt
+ 'single': 12400.0,
+ 'married': 24800.0,
+ 'head_of_household': 18650.0,
+ }
+
+ def _test_sit(self, filing_status, schedule_pay):
+ wage = 5000.0
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('MO'),
+ mo_mow4_sit_filing_status=filing_status,
+ state_income_tax_additional_withholding=0.0,
+ schedule_pay=schedule_pay)
+
+ payslip = self._createPayslip(employee, '2020-01-01', '2020-01-31')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ pp = payslip.get_pay_periods_in_year()
+ gross_salary = wage * pp
+ standard_deduction = self.STD_DED[filing_status]
+
+ mo_taxable_income = gross_salary - standard_deduction
+ self._log('%s = %s - %s -' % (mo_taxable_income, gross_salary, standard_deduction))
+
+ remaining_taxable_income = mo_taxable_income
+ tax = 0.0
+ for amt, rate in self.TAX:
+ amt = float(amt)
+ rate = rate / 100.0
+ self._log(str(amt) + ' : ' + str(rate) + ' : ' + str(remaining_taxable_income))
+ if (remaining_taxable_income - amt) > 0.0 or (remaining_taxable_income - amt) == 0.0:
+ tax += rate * amt
+ else:
+ tax += rate * remaining_taxable_income
+ break
+ remaining_taxable_income = remaining_taxable_income - amt
+
+ tax = -tax
+ self._log('Computed annual tax: ' + str(tax))
+
+ tax = tax / pp
+ tax = round(tax)
+ self._log('Computed period tax: ' + str(tax))
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), tax if filing_status else 0.0)
+
+ contract.us_payroll_config_id.state_income_tax_additional_withholding = 100.0
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), (tax - 100.0) if filing_status else 0.0)
+
+ contract.us_payroll_config_id.mo_mow4_sit_withholding = 200.0
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+ self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -200.0 if filing_status else 0.0)
+
+ def test_2020_taxes_single(self):
+ self._test_er_suta('MO', self.MO_UNEMP, date(2020, 1, 1), wage_base=self.MO_UNEMP_MAX_WAGE)
+ self._test_sit('single', 'weekly')
+
+ def test_2020_spouse_not_employed(self):
+ self._test_sit('married', 'semi-monthly')
+
+ def test_2020_head_of_household(self):
+ self._test_sit('head_of_household', 'monthly')
+
+ def test_2020_underflow(self):
+ # Payroll Period Weekly
+ salary = 200.0
+
+ employee = self._createEmployee()
+
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MO'))
+
+ payslip = self._createPayslip(employee, '2020-01-01', '2020-01-31')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['EE_US_SIT'], 0.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 247309b5..e46f4a38 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -55,6 +55,12 @@
+
+ Form MO W-4 - State Income Tax
+
+
+
+
Form 89-350 - State Income Tax
From 647ff7e3fbb76931019f3fcd82165cb97107da5c Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Fri, 17 Jan 2020 13:57:45 -0500
Subject: [PATCH 02/12] IMP `l10n_us_hr_payroll` Port `l10n_us_nj_hr_payroll`
NJ New Jesrsey including migration
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/final.xml | 10 +
.../data/state/nj_newjersey.xml | 426 ++++++++++++++++++
l10n_us_hr_payroll/migrations/data.py | 48 ++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/nj_newjersey.py | 53 +++
.../models/us_payroll_config.py | 17 +
l10n_us_hr_payroll/tests/__init__.py | 3 +
l10n_us_hr_payroll/tests/common.py | 26 +-
.../test_us_nj_newjersey_payslip_2019.py | 128 ++++++
.../test_us_nj_newjersey_payslip_2020.py | 48 ++
.../views/us_payroll_config_views.xml | 7 +
12 files changed, 758 insertions(+), 11 deletions(-)
create mode 100644 l10n_us_hr_payroll/data/state/nj_newjersey.xml
create mode 100644 l10n_us_hr_payroll/models/state/nj_newjersey.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_nj_newjersey_payslip_2019.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_nj_newjersey_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 9302a934..fa50a6ff 100755
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -33,6 +33,7 @@ USA Payroll Rules.
'data/state/mo_missouri.xml',
'data/state/ms_mississippi.xml',
'data/state/mt_montana.xml',
+ 'data/state/nj_newjersey.xml',
'data/state/oh_ohio.xml',
'data/state/pa_pennsylvania.xml',
'data/state/tx_texas.xml',
diff --git a/l10n_us_hr_payroll/data/final.xml b/l10n_us_hr_payroll/data/final.xml
index c571fea5..ef0448af 100644
--- a/l10n_us_hr_payroll/data/final.xml
+++ b/l10n_us_hr_payroll/data/final.xml
@@ -31,6 +31,16 @@
ref('hr_payroll_rule_er_us_mt_suta_aft'),
ref('hr_payroll_rule_ee_us_mt_sit'),
+ ref('hr_payroll_rule_er_us_nj_suta'),
+ ref('hr_payroll_rule_ee_us_nj_suta'),
+ ref('hr_payroll_rule_er_us_nj_sdi'),
+ ref('hr_payroll_rule_ee_us_nj_sdi'),
+ ref('hr_payroll_rule_er_us_nj_wf'),
+ ref('hr_payroll_rule_ee_us_nj_wf'),
+ ref('hr_payroll_rule_er_us_nj_fli'),
+ ref('hr_payroll_rule_ee_us_nj_fli'),
+ ref('hr_payroll_rule_ee_us_nj_sit'),
+
ref('hr_payroll_rule_er_us_oh_suta'),
ref('hr_payroll_rule_ee_us_oh_sit'),
diff --git a/l10n_us_hr_payroll/data/state/nj_newjersey.xml b/l10n_us_hr_payroll/data/state/nj_newjersey.xml
new file mode 100644
index 00000000..a01ad739
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/nj_newjersey.xml
@@ -0,0 +1,426 @@
+
+
+
+
+
+ US NJ NewJersey SUTA Wage Base
+ us_nj_suta_wage_base
+ 34400.00
+
+
+
+ US NJ NewJersey SUTA Wage Base
+ us_nj_suta_wage_base
+ 35300.00
+
+
+
+
+
+
+
+
+ US NJ New Jersey Employer Unemployment SUTA Rate
+ us_nj_suta_rate
+ 2.6825
+
+
+
+ US NJ New Jersey Employer Unemployment SUTA Rate
+ us_nj_suta_rate
+ 2.6825
+
+
+
+
+
+
+ US NJ New Jersey Employee Unemployment SUTA Rate
+ us_nj_suta_ee_rate
+ 0.3825
+
+
+
+ US NJ New Jersey Employee Unemployment SUTA Rate
+ us_nj_suta_ee_rate
+ 0.3825
+
+
+
+
+
+
+
+ US NJ New Jersey Employer State Disability Insurance Rate
+ us_nj_sdi_rate
+ 0.5
+
+
+
+ US NJ New Jersey Employer State Disability Insurance Rate
+ us_nj_sdi_rate
+ 0.5
+
+
+
+
+
+
+ US NJ New Jersey Employee State Disability Insurance Rate
+ us_nj_sdi_ee_rate
+ 0.17
+
+
+
+ US NJ New Jersey Employee State Disability Insurance Rate
+ us_nj_sdi_ee_rate
+ 0.26
+
+
+
+
+
+
+
+ US NJ New Jersey Employer Workforce Development Rate
+ us_nj_wf_rate
+ 0.1175
+
+
+
+ US NJ New Jersey Employer Workforce Development Rate
+ us_nj_wf_rate
+ 0.1175
+
+
+
+
+
+
+ US NJ New Jersey Employee Workforce Development Rate
+ us_nj_wf_ee_rate
+ 0.0425
+
+
+
+ US NJ New Jersey Employee Workforce Development Rate
+ us_nj_wf_ee_rate
+ 0.0425
+
+
+
+
+
+
+
+ US NJ New Jersey Employer Family Leave Insurance Rate
+ us_nj_fli_rate
+ 0.0
+
+
+
+ US NJ New Jersey Employer Family Leave Insurance Rate
+ us_nj_fli_rate
+ 0.0
+
+
+
+
+
+
+ US NJ New Jersey Employee Family Leave Insurance Rate
+ us_nj_fli_ee_rate
+ 0.08
+
+
+
+ US NJ New Jersey Employee Family Leave Insurance Rate
+ us_nj_fli_ee_rate
+ 0.16
+
+
+
+
+
+
+
+ US NJ NewJersey SIT Rate Table
+ us_nj_sit_rate
+ {
+ 'A': {
+ 'weekly': ((385, 0.0, 1.50), (673, 5.77, 2.00), (769, 11.54, 3.90), (1442, 15.29, 6.10), (9615, 56.34, 7.00), (96154, 628.46, 9.90), ('inf', 9195.77, 11.80)),
+ 'bi-weekly': ((769, 0.00, 1.50), (1346, 12.00, 2.00), (1538, 23.00, 3.90), (2885, 31.00, 6.10), (19231, 113.00, 7.00), (192308, 1257.00, 9.90), ('inf',18392.00, 11.80)),
+ 'semi-monthly': ((833, 0.00, 1.50), (1458, 13.00, 2.00), (1667, 25.00, 3.90), (3125, 33.00, 6.10), (20833, 122.00, 7.00), (208333, 1362.00, 9.90), ('inf', 19924.00, 11.80)),
+ 'monthly': ((1667, 0.00, 1.50), (2917, 25.00, 2.00), (3333, 50.00, 3.90), (6250, 66.00, 6.10), (41667, 244.00, 7.00), (416667, 2723.00, 9.90), ('inf', 39848.00, 11.80)),
+ 'quarterly': ((5000, 0.00, 1.50), (8750, 75.00, 2.00), (10000, 150.00, 3.90), (18750, 198.75, 6.10), (125000, 732.50, 7.00), (1250000, 8170.00, 9.90), ('inf', 119545.00, 11.80)),
+ 'semi-annual': ((10000, 0.00, 1.50), (17500, 150.00, 2.00), (20000, 300.00, 3.90), (37500, 397.50, 6.10), (250000, 1465.00, 7.00), (2500000, 16340.00, 9.90), ('inf', 239090.00, 11.80)),
+ 'annual': ((20000, 0.0, 1.50), (35000, 300.00, 2.00), (40000, 600.00, 3.90), (75000, 795.00, 6.10), (500000, 2930.00, 7.00), (5000000, 32680.00, 9.90), ('inf', 478180.00, 11.80)),
+ },
+ 'B': {
+ 'weekly': ((385, 0.0, 1.50), (962, 5.77, 2.00), (1346, 17.31, 2.70), (1538, 27.69, 3.9), (2885, 35.19, 6.10), (9615, 117.31, 7.00), (96154, 588.46, 9.90), ('inf', 9155.77, 11.80)),
+ 'bi-weekly': ((769, 0.0, 1.50), (1923, 12.00, 2.00), (2692, 35.00, 2.70), (3076, 55.00, 3.9), (5769, 70.00, 6.10), (19231, 235.00, 700), (192308, 1177.00, 9.90), ('inf', 18312.00, 11.80)),
+ 'semi-monthly': ((833, 0.0, 1.50), (2083, 12.50, 2.00), (2917, 37.50, 2.70), (3333, 59.99, 3.9), (6250, 76.25, 6.10), (20833, 254.19, 7.00), (208333, 1275.00, 9.90), ('inf', 19838.00, 11.80)),
+ 'monthly': ((1667, 0.0, 1.50), (4167, 25.00, 2.00), (5833, 75.00, 2.70), (6667, 120.00, 3.9), (12500, 153.00, 6.10), (41667, 508.00, 7.00), (416667, 2550.00, 9.90), ('inf', 39675.00, 11.80)),
+ 'quarterly': ((5000, 0.0, 1.50), (12500, 75.00, 2.00), (17500, 225.00, 2.70), (20000, 360.00, 3.9), (37500, 397.50, 6.10), (125000, 1525.00, 7.00), (1250000, 7650.00, 9.90), ('inf', 119025.00, 11.80)),
+ 'semi-annual': ((10000, 0.0, 1.50), (25000, 150.00, 2.00), (35000, 450.00, 2.70), (40000, 720.00, 3.9), (75000, 915.00, 6.10), (250000, 3050.00, 7.00), (2500000, 15300.00, 9.90), ('inf', 238050.00, 11.80)),
+ 'annual': ((20000, 0.0, 1.50), (50000, 300.00, 2.00), (70000, 900.00, 2.70), (80000, 1440.00, 3.9), (150000, 1830.00, 6.10), (500000, 6100.00, 7.00), (5000000, 30600.00, 9.90), ('inf', 476100.00, 11.80)),
+ },
+ 'C': {
+ 'weekly': ((385, 0.0, 1.50), (769, 5.77, 2.30), (962, 14.62, 2.80), (1154, 20.00, 3.50), (2885, 26.73, 5.60), (9615, 123.65, 6.60), (96154, 567.88, 9.90), ('inf', 9135.19, 11.80)),
+ 'bi-weekly': ((769, 0.0, 1.50), (1538, 11.54, 2.30), (1923, 29.23, 2.80), (2308, 40.00, 3.50), (5769, 53.46, 5.60), (19231, 247.31, 6.60), (192308, 1135.77, 9.90), ('inf', 18270.38, 11.80)),
+ 'semi-monthly': ((833, 0.0, 1.50), (1667, 12.50, 2.30), (2083, 31.67, 2.80), (2500, 43.33, 3.50), (6250, 57.92, 5.60), (20833, 267.92, 6.60), (208333, 1230.42, 9.90), ('inf', 19792.92, 11.80)),
+ 'monthly': ((1667, 0.0, 1.50), (3333, 25.00, 2.30), (4167, 63.33, 2.80), (5000, 86.67, 3.50), (12500, 115.83, 5.60), (41667, 535.85, 6.60), (416667, 2460.83, 9.90), ('inf', 39585.83, 11.80)),
+ 'quarterly': ((5000, 0.0, 1.50), (10000, 75.00, 2.30), (12500, 190.00, 2.80), (15000, 260.00, 3.50), (37500, 347.50, 5.60), (125000, 1607.50, 6.60), (1250000, 7382.50, 9.90), ('inf', 118757.50, 11.80)),
+ 'semi-annual': ((10000, 0.0, 1.50), (20000, 150.00, 2.30), (25000, 380.00, 2.80), (30000, 520.00, 3.50), (75000, 695.00, 5.60), (250000, 3215.00, 6.60), (2500000, 14765.00, 9.90), ('inf', 237515.00, 11.80)),
+ 'annual': ((20000, 0.0, 1.50), (40000, 300.00, 2.30), (50000, 760.00, 2.80), (60000, 1040.00, 3.50), (150000, 1390.00, 5.60), (500000, 6430.00, 6.60), (5000000, 29530.00, 9.90), ('inf', 475030.00, 11.80)),
+ },
+ 'D': {
+ 'weekly': ((385, 0.0, 1.50), (769, 5.77, 2.70), (962, 16.15, 3.40), (1154, 22.69, 4.30), (2885, 30.96, 5.60), (9615, 127.88, 6.50), (96154, 565.38, 9.90), ('inf', 9132.69, 11.80)),
+ 'bi-weekly': ((769, 0.0, 1.50), (1538, 11.54, 2.70), (1923, 32.31, 3.40), (2308, 45.38, 4.30), (5769, 61.92, 5.60), (19231, 255.77, 6.50), (192308, 1130.77, 9.90), ('inf', 18265.38, 11.80)),
+ 'semi-monthly': ((833, 0.0, 1.50), (1667, 12.50, 2.70), (2083, 35.00, 3.40), (2500, 49.17, 4.30), (6250, 67.08, 5.60), (20833, 277.08, 6.50), (208333, 1225.00, 9.90), ('inf', 19787.50, 11.80)),
+ 'monthly': ((1667, 0.0, 1.50), (3333, 25.00, 2.70), (4167, 70.00, 3.40), (5000, 98.33, 4.00), (12500, 134.17, 5.60), (41667, 554.17, 6.50), (416667, 2450.00, 9.90), ('inf', 39575.00, 11.80)),
+ 'quarterly': ((5000, 0.0, 1.50), (10000, 75.00, 2.07), (12500, 210.00, 3.40), (15000, 295.00, 4.30), (37500, 402.50, 5.60), (125000, 1662.50, 6.50), (1250000, 7350.00, 9.90), ('inf', 118725.00, 11.80)),
+ 'semi-annual': ((10000, 0.0, 1.50), (20000, 150.00, 2.70), (25000, 420.00, 3.40), (30000, 590.00, 4.30), (75000, 805.00, 5.60), (250000, 3325.00, 6.50), (2500000, 14700.00, 9.90), ('inf', 237450.00, 11.80)),
+ 'annual': ((20000, 0.0, 1.50), (40000, 300.00, 2.70), (50000, 840.00, 3.40), (60000, 1180.00, 4.30), (150000, 1610.00, 5.60), (250000, 6650.00, 6.50), (2500000, 29400.00, 9.90), ('inf', 474900.00, 11.80)),
+ },
+ 'E': {
+ 'weekly': ((385, 0.0, 1.50), (673, 5.77, 2.00), (1923, 11.54, 5.80), (9615, 84.04, 6.50), (96154, 584.04, 9.90), ('inf', 9151.35, 11.80)),
+ 'bi-weekly': ((769, 0.0, 1.50), (1346, 12.00, 2.00), (3846, 23.00, 5.80), (19231, 168.00, 6.50), (192308, 1168.00, 9.90), ('inf', 18303.00, 11.80)),
+ 'semi-monthly': ((833, 0.0, 1.50), (1458, 13.00, 2.00), (4167, 25.00, 5.80), (20833, 182.00, 6.50), (208333, 1265.00, 9.90), ('inf', 19828.00, 11.80)),
+ 'monthly': ((1667, 0.0, 1.50), (2916, 25.00, 2.00), (8333, 50.00, 5.80), (41667, 364.00, 6.50), (416667, 2531.00, 9.90), ('inf', 39656, 11.80)),
+ 'quarterly': ((5000, 0.0, 1.50), (8750, 75.00, 2.00), (25000, 150.00, 5.80), (125000, 1092.50, 6.50), (1250000, 7592.50, 9.90), ('inf', 118967.50, 11.80)),
+ 'semi-annual': ((10000, 0.0, 1.50), (17500, 150.00, 2.00), (50000, 300.00, 5.80), (250000, 2185.00, 6.50), (2500000, 15185.00, 9.90), ('inf', 237935.00, 11.80)),
+ 'annual': ((20000, 0.0, 1.50), (35000, 300.00, 2.00), (100000, 600.00, 5.80), (500000, 4370.00, 6.50), (5000000, 30370.00, 9.90), ('inf', 475870.00, 11.80)),
+ },
+ }
+
+
+
+ US NJ NewJersey SIT Rate Table
+ us_nj_sit_rate
+ {
+ 'A': {
+ 'weekly': ((385, 0.0, 1.50), (673, 5.77, 2.00), (769, 11.54, 3.90), (1442, 15.29, 6.10), (9615, 56.34, 7.00), (96154, 628.46, 9.90), ('inf', 9195.77, 11.80)),
+ 'bi-weekly': ((769, 0.00, 1.50), (1346, 12.00, 2.00), (1538, 23.00, 3.90), (2885, 31.00, 6.10), (19231, 113.00, 7.00), (192308, 1257.00, 9.90), ('inf',18392.00, 11.80)),
+ 'semi-monthly': ((833, 0.00, 1.50), (1458, 13.00, 2.00), (1667, 25.00, 3.90), (3125, 33.00, 6.10), (20833, 122.00, 57.00), (208333, 1362.00, 9.90), ('inf', 19924.00, 11.80)),
+ 'monthly': ((1667, 0.00, 1.50), (2917, 25.00, 2.00), (3333, 50.00, 3.90), (6250, 66.00, 6.10), (41667, 244.00, 57.00), (416667, 2723.00, 9.90), ('inf', 39848.00, 11.80)),
+ 'quarterly': ((5000, 0.00, 1.50), (8750, 75.00, 2.00), (10000, 150.00, 3.90), (18750, 198.75, 6.10), (125000, 732.50, 57.00), (1250000, 8170.00, 9.90), ('inf', 119545.00, 11.80)),
+ 'semi-annual': ((10000, 0.00, 1.50), (17500, 150.00, 2.00), (20000, 300.00, 3.90), (37500, 397.50, 6.10), (250000, 1465.00, 57.00), (2500000, 16340.00, 9.90), ('inf', 239090.00, 11.80)),
+ 'annual': ((20000, 0.0, 1.50), (35000, 300.00, 2.00), (40000, 600.00, 3.90), (75000, 795.00, 6.10), (500000, 2930.00, 57.00), (5000000, 32680.00, 9.90), ('inf', 478180.00, 11.80)),
+ },
+ 'B': {
+ 'weekly': ((385, 0.0, 1.50), (962, 5.77, 2.00), (1346, 17.31, 2.70), (1538, 27.69, 3.9), (2885, 35.19, 6.10), (9615, 117.31, 7.00), (96154, 588.46, 9.90), ('inf', 9155.77, 11.80)),
+ 'bi-weekly': ((769, 0.0, 1.50), (1923, 12.00, 2.00), (2692, 35.00, 2.70), (3076, 55.00, 3.9), (5769, 70.00, 6.10), (19231, 235.00, 700), (192308, 1177.00, 9.90), ('inf', 18312.00, 11.80)),
+ 'semi-monthly': ((833, 0.0, 1.50), (2083, 12.50, 2.00), (2917, 37.50, 2.70), (3333, 59.99, 3.9), (6250, 76.25, 6.10), (20833, 254.19, 7.00), (208333, 1275.00, 9.90), ('inf', 19838.00, 11.80)),
+ 'monthly': ((1667, 0.0, 1.50), (4167, 25.00, 2.00), (5833, 75.00, 2.70), (6667, 120.00, 3.9), (12500, 153.00, 6.10), (41667, 508.00, 7.00), (416667, 2550.00, 9.90), ('inf', 39675.00, 11.80)),
+ 'quarterly': ((5000, 0.0, 1.50), (12500, 75.00, 2.00), (17500, 225.00, 2.70), (20000, 360.00, 3.9), (37500, 397.50, 6.10), (125000, 1525.00, 7.00), (1250000, 7650.00, 9.90), ('inf', 119025.00, 11.80)),
+ 'semi-annual': ((10000, 0.0, 1.50), (25000, 150.00, 2.00), (35000, 450.00, 2.70), (40000, 720.00, 3.9), (75000, 915.00, 6.10), (250000, 3050.00, 7.00), (2500000, 15300.00, 9.90), ('inf', 238050.00, 11.80)),
+ 'annual': ((20000, 0.0, 1.50), (50000, 300.00, 2.00), (70000, 900.00, 2.70), (80000, 1440.00, 3.9), (150000, 1830.00, 6.10), (500000, 6100.00, 7.00), (5000000, 30600.00, 9.90), ('inf', 476100.00, 11.80)),
+ },
+ 'C': {
+ 'weekly': ((385, 0.0, 1.50), (769, 5.77, 2.30), (962, 14.62, 2.80), (1154, 20.00, 3.50), (2885, 26.73, 5.60), (9615, 123.65, 6.60), (96154, 567.88, 9.90), ('inf', 9135.19, 11.80)),
+ 'bi-weekly': ((769, 0.0, 1.50), (1538, 11.54, 2.30), (1923, 29.23, 2.80), (2308, 40.00, 3.50), (5769, 53.46, 5.60), (19231, 247.31, 6.60), (192308, 1135.77, 9.90), ('inf', 18270.38, 11.80)),
+ 'semi-monthly': ((833, 0.0, 1.50), (1667, 12.50, 2.30), (2083, 31.67, 2.80), (2500, 43.33, 3.50), (6250, 57.92, 5.60), (20833, 267.92, 6.60), (208333, 1230.42, 9.90), ('inf', 19792.92, 11.80)),
+ 'monthly': ((1667, 0.0, 1.50), (3333, 25.00, 2.30), (4167, 63.33, 2.80), (5000, 86.67, 3.50), (12500, 115.83, 5.60), (41667, 535.85, 6.60), (416667, 2460.83, 9.90), ('inf', 39585.83, 11.80)),
+ 'quarterly': ((5000, 0.0, 1.50), (10000, 75.00, 2.30), (12500, 190.00, 2.80), (15000, 260.00, 3.50), (37500, 347.50, 5.60), (125000, 1607.50, 6.60), (1250000, 7382.50, 9.90), ('inf', 118757.50, 11.80)),
+ 'semi-annual': ((10000, 0.0, 1.50), (20000, 150.00, 2.30), (25000, 380.00, 2.80), (30000, 520.00, 3.50), (75000, 695.00, 5.60), (250000, 3215.00, 6.60), (2500000, 14765.00, 9.90), ('inf', 237515.00, 11.80)),
+ 'annual': ((20000, 0.0, 1.50), (40000, 300.00, 2.30), (50000, 760.00, 2.80), (60000, 1040.00, 3.50), (150000, 1390.00, 5.60), (500000, 6430.00, 6.60), (5000000, 29530.00, 9.90), ('inf', 475030.00, 11.80)),
+ },
+ 'D': {
+ 'weekly': ((385, 0.0, 1.50), (769, 5.77, 2.70), (962, 16.15, 3.40), (1154, 22.69, 4.30), (2885, 30.96, 5.60), (9615, 127.88, 6.50), (96154, 565.38, 9.90), ('inf', 9132.69, 11.80)),
+ 'bi-weekly': ((769, 0.0, 1.50), (1538, 11.54, 2.70), (1923, 32.31, 3.40), (2308, 45.38, 4.30), (5769, 61.92, 5.60), (19231, 255.77, 6.50), (192308, 1130.77, 9.90), ('inf', 18265.38, 11.80)),
+ 'semi-monthly': ((833, 0.0, 1.50), (1667, 12.50, 2.70), (2083, 35.00, 3.40), (2500, 49.17, 4.30), (6250, 67.08, 5.60), (20833, 277.08, 6.50), (208333, 1225.00, 9.90), ('inf', 19787.50, 11.80)),
+ 'monthly': ((1667, 0.0, 1.50), (3333, 25.00, 2.70), (4167, 70.00, 3.40), (5000, 98.33, 4.00), (12500, 134.17, 5.60), (41667, 554.17, 6.50), (416667, 2450.00, 9.90), ('inf', 39575.00, 11.80)),
+ 'quarterly': ((5000, 0.0, 1.50), (10000, 75.00, 2.07), (12500, 210.00, 3.40), (15000, 295.00, 4.30), (37500, 402.50, 5.60), (125000, 1662.50, 6.50), (1250000, 7350.00, 9.90), ('inf', 118725.00, 11.80)),
+ 'semi-annual': ((10000, 0.0, 1.50), (20000, 150.00, 2.70), (25000, 420.00, 3.40), (30000, 590.00, 4.30), (75000, 805.00, 5.60), (250000, 3325.00, 6.50), (2500000, 14700.00, 9.90), ('inf', 237450.00, 11.80)),
+ 'annual': ((20000, 0.0, 1.50), (40000, 300.00, 2.70), (50000, 840.00, 3.40), (60000, 1180.00, 4.30), (150000, 1610.00, 5.60), (250000, 6650.00, 6.50), (2500000, 29400.00, 9.90), ('inf', 474900.00, 11.80)),
+ },
+ 'E': {
+ 'weekly': ((385, 0.0, 1.50), (673, 5.77, 2.00), (1923, 11.54, 5.80), (9615, 84.04, 6.50), (96154, 584.04, 9.90), ('inf', 9151.35, 11.80)),
+ 'bi-weekly': ((769, 0.0, 1.50), (1346, 12.00, 2.00), (3846, 23.00, 5.80), (19231, 168.00, 6.50), (192308, 1168.00, 9.90), ('inf', 18303.00, 11.80)),
+ 'semi-monthly': ((833, 0.0, 1.50), (1458, 13.00, 2.00), (4167, 25.00, 5.80), (20833, 182.00, 6.50), (208333, 1265.00, 9.90), ('inf', 19828.00, 11.80)),
+ 'monthly': ((1667, 0.0, 1.50), (2916, 25.00, 2.00), (8333, 50.00, 5.80), (41667, 364.00, 6.50), (416667, 2531.00, 9.90), ('inf', 39656, 11.80)),
+ 'quarterly': ((5000, 0.0, 1.50), (8750, 75.00, 2.00), (25000, 150.00, 5.80), (125000, 1092.50, 6.50), (1250000, 7592.50, 9.90), ('inf', 118967.50, 11.80)),
+ 'semi-annual': ((10000, 0.0, 1.50), (17500, 150.00, 2.00), (50000, 300.00, 5.80), (250000, 2185.00, 6.50), (2500000, 15185.00, 9.90), ('inf', 237935.00, 11.80)),
+ 'annual': ((20000, 0.0, 1.50), (35000, 300.00, 2.00), (100000, 600.00, 5.80), (500000, 4370.00, 6.50), (5000000, 30370.00, 9.90), ('inf', 475870.00, 11.80)),
+ },
+ }
+
+
+
+
+
+
+ US NJ NewJersey SIT Allowance Rate
+ us_nj_sit_allowance_rate
+ {
+ 'weekly': 19.20,
+ 'bi-weekly': 38.40,
+ 'semi-monthly': 41.60,
+ 'monthly': 83.30,
+ 'quarterly': 250.00,
+ 'semi-annual': 500.00,
+ 'annual': 1000.00,
+ 'daily or miscellaneous': 2.70,
+ }
+
+
+
+ US NJ NewJersey SIT Allowance Rate
+ us_nj_sit_allowance_rate
+ {
+ 'weekly': 19.20,
+ 'bi-weekly': 38.40,
+ 'semi-monthly': 41.60,
+ 'monthly': 83.30,
+ 'quarterly': 250.00,
+ 'semi-annual': 500.00,
+ 'annual': 1000.00,
+ 'daily or miscellaneous': 2.70,
+ }
+
+
+
+
+
+
+ US New Jersey - Division of Taxation - Unemployment Tax
+
+
+
+ US New Jersey - Division of Taxation - Income Tax
+
+
+
+ US New Jersey - Division of Taxation - Unemployment Tax
+
+
+
+
+ US New Jersey - Division of Taxation - Income Tax
+
+
+
+
+
+
+
+
+ ER: US NJ New Jersey State Unemployment
+ ER_US_NJ_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_suta_rate', state_code='NJ')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_suta_rate', state_code='NJ')
+
+
+
+
+
+
+
+ EE: US NJ New Jersey State Unemployment
+ EE_US_NJ_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_suta_ee_rate', state_code='NJ')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_suta_ee_rate', state_code='NJ')
+
+
+
+
+
+
+
+
+ ER: US NJ New Jersey State Disability Insurance
+ ER_US_NJ_SDI
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_sdi_rate', state_code='NJ')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_sdi_rate', state_code='NJ')
+
+
+
+
+
+
+
+ EE: US NJ New Jersey State Disability Insurance
+ EE_US_NJ_SDI
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_sdi_ee_rate', state_code='NJ')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_sdi_ee_rate', state_code='NJ')
+
+
+
+
+
+
+
+
+ ER: US NJ New Jersey Workforce Development
+ ER_US_NJ_WF
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_wf_rate', state_code='NJ')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_wf_rate', state_code='NJ')
+
+
+
+
+
+
+
+ EE: US NJ New Jersey Workforce Development
+ EE_US_NJ_WF
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_wf_ee_rate', state_code='NJ')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_wf_ee_rate', state_code='NJ')
+
+
+
+
+
+
+
+
+ ER: US NJ New Jersey Family Leave Insurance
+ ER_US_NJ_FLI
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_fli_rate', state_code='NJ')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_fli_rate', state_code='NJ')
+
+
+
+
+
+
+
+ EE: US NJ New Jersey Family Leave Insurance
+ EE_US_NJ_FLI
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_fli_ee_rate', state_code='NJ')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nj_suta_wage_base', rate='us_nj_fli_ee_rate', state_code='NJ')
+
+
+
+
+
+
+
+ EE: US NJ New Jersey State Income Tax Withholding
+ EE_US_NJ_SIT
+ python
+ result, _ = nj_newjersey_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = nj_newjersey_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/migrations/data.py b/l10n_us_hr_payroll/migrations/data.py
index 420d864c..4f7bfeea 100644
--- a/l10n_us_hr_payroll/migrations/data.py
+++ b/l10n_us_hr_payroll/migrations/data.py
@@ -25,6 +25,11 @@ FIELDS_CONTRACT_TO_US_PAYROLL_FORMS_2020 = {
'mt_mw4_exemptions': 'mt_mw4_sit_exemptions',
'mt_mw4_exempt': 'mt_mw4_sit_exempt',
+ 'nj_njw4_filing_status': 'nj_njw4_sit_filing_status',
+ 'nj_njw4_allowances': 'nj_njw4_sit_allowances',
+ 'nj_njw4_rate_table': 'nj_njw4_sit_rate_table',
+ 'nj_additional_withholding': 'state_income_tax_additional_withholding',
+
'oh_additional_withholding': 'state_income_tax_additional_withholding',
'oh_income_allowances': 'oh_it4_sit_exemptions',
@@ -75,6 +80,33 @@ XMLIDS_TO_REMOVE_2020 = [
'l10n_us_mt_hr_payroll.hr_payroll_mt_income_withhold',
'l10n_us_mt_hr_payroll.hr_payroll_rules_mt_unemp_wages',
+ 'l10n_us_nj_hr_payroll.res_partner_njdor_unemp_company',
+ 'l10n_us_nj_hr_payroll.res_partner_njdor_sdi_employee',
+ 'l10n_us_nj_hr_payroll.res_partner_njdor_sdi_company',
+ 'l10n_us_nj_hr_payroll.res_partner_njdor_fli',
+ 'l10n_us_nj_hr_payroll.res_partner_njdor_wf',
+ 'l10n_us_nj_hr_payroll.contrib_register_njdor_unemp_company',
+ 'l10n_us_nj_hr_payroll.contrib_register_njdor_sdi_employee',
+ 'l10n_us_nj_hr_payroll.contrib_register_njdor_sdi_company',
+ 'l10n_us_nj_hr_payroll.contrib_register_njdor_fli',
+ 'l10n_us_nj_hr_payroll.contrib_register_njdor_wf',
+ 'l10n_us_nj_hr_payroll.hr_payroll_nj_unemp_wages',
+ 'l10n_us_nj_hr_payroll.hr_payroll_nj_sdi_wages',
+ 'l10n_us_nj_hr_payroll.hr_payroll_nj_fli_wages',
+ 'l10n_us_nj_hr_payroll.hr_payroll_nj_wf_wages',
+ 'l10n_us_nj_hr_payroll.hr_payroll_nj_unemp_employee',
+ 'l10n_us_nj_hr_payroll.hr_payroll_nj_unemp_company',
+ 'l10n_us_nj_hr_payroll.hr_payroll_nj_sdi_company',
+ 'l10n_us_nj_hr_payroll.hr_payroll_nj_sdi_employee',
+ 'l10n_us_nj_hr_payroll.hr_payroll_nj_fli',
+ 'l10n_us_nj_hr_payroll.hr_payroll_nj_wf',
+ 'l10n_us_nj_hr_payroll.hr_payroll_nj_wf_company',
+ 'l10n_us_nj_hr_payroll.hr_payroll_nj_income_withhold',
+ 'l10n_us_nj_hr_payroll.hr_payroll_rules_nj_unemp_wages_2018',
+ 'l10n_us_nj_hr_payroll.hr_payroll_rules_nj_sdi_wages_2018',
+ 'l10n_us_nj_hr_payroll.hr_payroll_rules_nj_fli_wages_2018',
+ 'l10n_us_nj_hr_payroll.hr_payroll_rules_nj_wf_wages_2018',
+
'l10n_us_oh_hr_payroll.hr_payroll_oh_unemp_wages',
'l10n_us_oh_hr_payroll.hr_payroll_oh_unemp',
'l10n_us_oh_hr_payroll.hr_payroll_oh_income_withhold',
@@ -155,6 +187,19 @@ XMLIDS_TO_RENAME_2020 = {
'l10n_us_mt_hr_payroll.hr_payroll_rules_mt_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_mt_suta',
'l10n_us_mt_hr_payroll.hr_payroll_rules_mt_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_mt_sit',
+ 'l10n_us_nj_hr_payroll.res_partner_njdor_unemp_employee': 'l10n_us_hr_payroll.res_partner_us_nj_dor',
+ 'l10n_us_nj_hr_payroll.res_partner_njdor_withhold': 'l10n_us_hr_payroll.res_partner_us_nj_dor_sit',
+ 'l10n_us_nj_hr_payroll.contrib_register_njdor_unemp_employee': 'l10n_us_hr_payroll.contrib_register_us_nj_dor',
+ 'l10n_us_nj_hr_payroll.contrib_register_njdor_withhold': 'l10n_us_hr_payroll.contrib_register_us_nj_dor_sit',
+ 'l10n_us_nj_hr_payroll.hr_payroll_rules_nj_unemp_employee_2018': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_nj_suta',
+ 'l10n_us_nj_hr_payroll.hr_payroll_rules_nj_unemp_company_2018': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_nj_suta',
+ 'l10n_us_nj_hr_payroll.hr_payroll_rules_nj_sdi_employee_2018': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_nj_sdi',
+ 'l10n_us_nj_hr_payroll.hr_payroll_rules_nj_sdi_company_2018': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_nj_sdi',
+ 'l10n_us_nj_hr_payroll.hr_payroll_rules_nj_fli_2018': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_nj_fli',
+ 'l10n_us_nj_hr_payroll.hr_payroll_rules_nj_wf_2018': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_nj_wf',
+ 'l10n_us_nj_hr_payroll.hr_payroll_rules_nj_wf_er': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_nj_wf',
+ 'l10n_us_nj_hr_payroll.hr_payroll_rules_nj_inc_withhold_2018': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_nj_sit',
+
'l10n_us_oh_hr_payroll.res_partner_ohdor_unemp': 'l10n_us_hr_payroll.res_partner_us_oh_dor',
'l10n_us_oh_hr_payroll.res_partner_ohdor_withhold': 'l10n_us_hr_payroll.res_partner_us_oh_dor_sit',
'l10n_us_oh_hr_payroll.res_partner_ohdor_unemp': 'l10n_us_hr_payroll.res_partner_us_oh_dor',
@@ -197,6 +242,9 @@ XMLIDS_COPY_ACCOUNTING_2020 = {
'l10n_us_hr_payroll.hr_payroll_rule_er_us_mt_suta': [
'l10n_us_hr_payroll.hr_payroll_rule_er_us_mt_suta_aft',
],
+ 'l10n_us_hr_payroll.hr_payroll_rule_er_us_nj_wf': [
+ 'l10n_us_hr_payroll.hr_payroll_rule_er_us_nj_fli',
+ ],
'l10n_us_hr_payroll.hr_payroll_rule_er_us_wa_lni': [
'l10n_us_hr_payroll.hr_payroll_rule_er_us_wa_fml',
],
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index 33e263fa..9f028169 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -18,6 +18,7 @@ from .state.ga_georgia import ga_georgia_state_income_withholding
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.nj_newjersey import nj_newjersey_state_income_withholding
from .state.oh_ohio import oh_ohio_state_income_withholding
from .state.va_virginia import va_virginia_state_income_withholding
from .state.wa_washington import wa_washington_fml_er, \
@@ -58,6 +59,7 @@ class HRPayslip(models.Model):
'mo_missouri_state_income_withholding': mo_missouri_state_income_withholding,
'ms_mississippi_state_income_withholding': ms_mississippi_state_income_withholding,
'mt_montana_state_income_withholding': mt_montana_state_income_withholding,
+ 'nj_newjersey_state_income_withholding': nj_newjersey_state_income_withholding,
'oh_ohio_state_income_withholding': oh_ohio_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/nj_newjersey.py b/l10n_us_hr_payroll/models/state/nj_newjersey.py
new file mode 100644
index 00000000..4c8870b8
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/nj_newjersey.py
@@ -0,0 +1,53 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies
+
+
+def nj_newjersey_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 = 'NJ'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ filing_status = payslip.dict.contract_id.us_payroll_config_value('nj_njw4_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = categories.GROSS + categories.DED_FIT_EXEMPT
+
+ allowances = payslip.dict.contract_id.us_payroll_config_value('nj_njw4_sit_allowances')
+ sit_rate_table_key = payslip.dict.contract_id.us_payroll_config_value('nj_njw4_sit_rate_table')
+ if not sit_rate_table_key and filing_status in ('single', 'married_joint'):
+ sit_rate_table_key = 'A'
+ elif not sit_rate_table_key:
+ sit_rate_table_key = 'B'
+ schedule_pay = payslip.dict.contract_id.schedule_pay
+ additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ sit_table = payslip.dict.rule_parameter('us_nj_sit_rate')[sit_rate_table_key].get(schedule_pay)
+ allowance_value = payslip.dict.rule_parameter('us_nj_sit_allowance_rate')[schedule_pay]
+ if not allowances:
+ return 0.0, 0.0
+
+ if wage == 0.0:
+ return 0.0, 0.0
+
+ gross_taxable_income = wage - (allowance_value * allowances)
+ withholding = 0.0
+ prior_wage_base = 0.0
+ for row in sit_table:
+ wage_base, base_amt, rate = row
+ wage_base = float(wage_base)
+ rate = rate / 100.0
+ if gross_taxable_income <= wage_base:
+ withholding = base_amt + ((gross_taxable_income - prior_wage_base) * rate)
+ break
+ prior_wage_base = wage_base
+
+ 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 809fa233..09ed845b 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -94,6 +94,23 @@ class HRContractUSPayrollConfig(models.Model):
('montana_for_marriage', 'Montana for Marriage'),
], string='Montana MW-4 Exempt from Withholding', help='MW-4 Section 2')
+ nj_njw4_sit_filing_status = fields.Selection([
+ ('', 'Exempt'),
+ ('single', 'Single'),
+ ('married_separate', 'Married/Civil Union partner Separate'),
+ ('married_joint', 'Married/Civil Union Couple Joint'),
+ ('widower', 'Widower/Surviving Civil Union Partner'),
+ ('head_household', 'Head of Household')
+ ], string='New Jersey NJ-W4 Filing Status', help='NJ-W4 2.')
+ nj_njw4_sit_allowances = fields.Integer(string='New Jersey NJ-W4 Allowances', help='NJ-W4 4.')
+ nj_njw4_sit_rate_table = fields.Selection([
+ ('A', 'A'),
+ ('B', 'B'),
+ ('C', 'C'),
+ ('D', 'D'),
+ ('E', 'E')
+ ], string='New Jersey Wage Chart Letter', help='NJ-W4. 3.')
+
# 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 6275549a..f0e84ff2 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -19,6 +19,9 @@ from . import test_us_ms_mississippi_payslip_2020
from . import test_us_mt_montana_payslip_2019
from . import test_us_mt_montana_payslip_2020
+from . import test_us_nj_newjersey_payslip_2019
+from . import test_us_nj_newjersey_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/common.py b/l10n_us_hr_payroll/tests/common.py
index 338e1d44..5540f5de 100755
--- a/l10n_us_hr_payroll/tests/common.py
+++ b/l10n_us_hr_payroll/tests/common.py
@@ -177,7 +177,11 @@ class TestUsPayslip(common.TransactionCase):
cache[code] = us_state
return us_state
- def _test_suta(self, category, state_code, rate, date, wage_base=None, **extra_contract):
+ def _test_suta(self, category, state_code, rate, date, wage_base=None, relaxed=False, **extra_contract):
+ if relaxed:
+ _assert = self.assertPayrollAlmostEqual
+ else:
+ _assert = self.assertPayrollEqual
if wage_base:
# Slightly larger than 1/2 the wage_base
wage = round(wage_base / 2.0) + 100.0
@@ -200,18 +204,18 @@ class TestUsPayslip(common.TransactionCase):
contract.us_payroll_config_id.fed_940_type = USHRContract.FUTA_TYPE_EXEMPT
payslip.compute_sheet()
cats = self._getCategories(payslip)
- self.assertPayrollEqual(cats.get(category, 0.0), 0.0)
+ _assert(cats.get(category, 0.0), 0.0)
contract.us_payroll_config_id.fed_940_type = USHRContract.FUTA_TYPE_BASIC
payslip.compute_sheet()
cats = self._getCategories(payslip)
- self.assertPayrollEqual(cats.get(category, 0.0), 0.0)
+ _assert(cats.get(category, 0.0), 0.0)
# Test Normal
contract.us_payroll_config_id.fed_940_type = USHRContract.FUTA_TYPE_NORMAL
payslip.compute_sheet()
cats = self._getCategories(payslip)
- self.assertPayrollEqual(cats.get(category, 0.0), wage * rate)
+ _assert(cats.get(category, 0.0), wage * rate)
process_payslip(payslip)
# Second Payslip
@@ -222,7 +226,7 @@ class TestUsPayslip(common.TransactionCase):
if wage_base:
remaining_unemp_wages = wage_base - wage
self.assertTrue((remaining_unemp_wages * rate) <= 0.01) # less than 0.01 because rate is negative
- self.assertPayrollEqual(cats.get(category, 0.0), remaining_unemp_wages * rate)
+ _assert(cats.get(category, 0.0), remaining_unemp_wages * rate)
# As if they were paid once already, so the first "two payslips" would remove all of the tax obligation
# 1 wage - Payslip (confirmed)
@@ -231,12 +235,12 @@ class TestUsPayslip(common.TransactionCase):
contract.external_wages = wage
payslip.compute_sheet()
cats = self._getCategories(payslip)
- self.assertPayrollEqual(cats.get(category, 0.0), 0.0)
+ _assert(cats.get(category, 0.0), 0.0)
else:
- self.assertPayrollEqual(cats.get(category, 0.0), wage * rate)
+ _assert(cats.get(category, 0.0), wage * rate)
- def _test_er_suta(self, state_code, rate, date, wage_base=None, **extra_contract):
- self._test_suta('ER_US_SUTA', state_code, rate, date, wage_base=wage_base, **extra_contract)
+ def _test_er_suta(self, state_code, rate, date, wage_base=None, relaxed=False, **extra_contract):
+ self._test_suta('ER_US_SUTA', state_code, rate, date, wage_base=wage_base, relaxed=relaxed, **extra_contract)
- def _test_ee_suta(self, state_code, rate, date, wage_base=None, **extra_contract):
- self._test_suta('EE_US_SUTA', state_code, rate, date, wage_base=wage_base, **extra_contract)
+ def _test_ee_suta(self, state_code, rate, date, wage_base=None, relaxed=False, **extra_contract):
+ self._test_suta('EE_US_SUTA', state_code, rate, date, wage_base=wage_base, relaxed=relaxed, **extra_contract)
diff --git a/l10n_us_hr_payroll/tests/test_us_nj_newjersey_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_nj_newjersey_payslip_2019.py
new file mode 100755
index 00000000..c28849b5
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_nj_newjersey_payslip_2019.py
@@ -0,0 +1,128 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .common import TestUsPayslip, process_payslip
+
+
+class TestUsNJPayslip(TestUsPayslip):
+ ###
+ # 2019 Taxes and Rates
+ ###
+ NJ_UNEMP_MAX_WAGE = 34400.0 # Note that this is used for SDI and FLI as well
+
+ ER_NJ_UNEMP = -2.6825 / 100.0
+ EE_NJ_UNEMP = -0.3825 / 100.0
+
+ ER_NJ_SDI = -0.5 / 100.0
+ EE_NJ_SDI = -0.17 / 100.0
+
+ ER_NJ_WF = -0.1175 / 100.0
+ EE_NJ_WF = -0.0425 / 100.0
+
+ ER_NJ_FLI = 0.0
+ EE_NJ_FLI = -0.08 / 100.0
+
+ # Examples found on page 24 of http://www.state.nj.us/treasury/taxation/pdf/current/njwt.pdf
+ def test_2019_taxes_example1(self):
+ salary = 300
+
+ # Tax Percentage Method for Single, taxable under $385
+ wh = -4.21
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('NJ'),
+ nj_njw4_sit_filing_status='single',
+ nj_njw4_sit_allowances=1,
+ state_income_tax_additional_withholding=0.0,
+ nj_njw4_sit_rate_table='A',
+ schedule_pay='weekly')
+
+ self._log('2019 New Jersey 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_SUTA'], salary * (self.EE_NJ_UNEMP + self.EE_NJ_SDI + self.EE_NJ_WF + self.EE_NJ_FLI))
+ self.assertPayrollEqual(cats['ER_US_SUTA'], salary * (self.ER_NJ_UNEMP + self.ER_NJ_SDI + self.ER_NJ_WF + self.ER_NJ_FLI))
+ self.assertTrue(all((cats['EE_US_SUTA'], cats['ER_US_SUTA'])))
+ # self.assertPayrollEqual(cats['EE_US_NJ_SDI_SIT'], cats['EE_US_NJ_SDI_SIT'] * self.EE_NJ_SDI)
+ # self.assertPayrollEqual(cats['ER_US_NJ_SDI_SUTA'], cats['ER_US_NJ_SDI_SUTA'] * self.ER_NJ_SDI)
+ # self.assertPayrollEqual(cats['EE_US_NJ_FLI_SIT'], cats['EE_US_NJ_FLI_SIT'] * self.EE_NJ_FLI)
+ # self.assertPayrollEqual(cats['EE_US_NJ_WF_SIT'], cats['EE_US_NJ_WF_SIT'] * self.EE_NJ_WF)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh)
+
+ process_payslip(payslip)
+
+ # # Make a new payslip, this one will have maximums
+ #
+ remaining_nj_unemp_wages = self.NJ_UNEMP_MAX_WAGE - salary if (self.NJ_UNEMP_MAX_WAGE - 2 * salary < salary) \
+ else salary
+
+ self._log('2019 New Jersey tax second payslip:')
+ payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
+
+ payslip.compute_sheet()
+
+ cats = self._getCategories(payslip)
+
+ # self.assertPayrollEqual(cats['WAGE_US_NJ_UNEMP'], remaining_nj_unemp_wages)
+ self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_nj_unemp_wages * (self.ER_NJ_UNEMP + self.ER_NJ_SDI + self.ER_NJ_WF + self.ER_NJ_FLI))
+ self.assertPayrollEqual(cats['EE_US_SUTA'], remaining_nj_unemp_wages * (self.EE_NJ_UNEMP + self.EE_NJ_SDI + self.EE_NJ_WF + self.EE_NJ_FLI))
+
+ def test_2019_taxes_example2(self):
+ salary = 1400.00
+
+ # Tax Percentage Method for Single, taxable pay over $962, under $1346
+ wh = -27.58
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('NJ'),
+ nj_njw4_sit_filing_status='married_separate',
+ nj_njw4_sit_allowances=3,
+ state_income_tax_additional_withholding=0.0,
+ #nj_njw4_sit_rate_table='B',
+ schedule_pay='weekly')
+
+ self.assertEqual(contract.schedule_pay, 'weekly')
+
+ self._log('2019 New Jersey 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)
+
+
+ def test_2019_taxes_to_the_limits(self):
+ salary = 30000.00
+
+ # Tax Percentage Method for Single, taxable pay over $18750, under 125000
+ wh = -1467.51
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('NJ'),
+ nj_njw4_sit_filing_status='married_joint',
+ nj_njw4_sit_allowances=3,
+ state_income_tax_additional_withholding=0.0,
+ # nj_njw4_sit_rate_table='B',
+ schedule_pay='quarterly')
+
+ self.assertEqual(contract.schedule_pay, 'quarterly')
+
+ self._log('2019 New Jersey tax first payslip:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-03-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_nj_newjersey_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_nj_newjersey_payslip_2020.py
new file mode 100755
index 00000000..79e0b861
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_nj_newjersey_payslip_2020.py
@@ -0,0 +1,48 @@
+# 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 TestUsNJPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ NJ_UNEMP_MAX_WAGE = 35300.0 # Note that this is used for SDI and FLI as well
+
+ ER_NJ_UNEMP = 2.6825
+ EE_NJ_UNEMP = 0.3825
+
+ ER_NJ_SDI = 0.5
+ EE_NJ_SDI = 0.26
+
+ ER_NJ_WF = 0.1175
+ EE_NJ_WF = 0.0425
+
+ ER_NJ_FLI = 0.0
+ EE_NJ_FLI = 0.16
+
+ def _test_sit(self, wage, filing_status, allowances, schedule_pay, date_start, expected_withholding, rate_table=False):
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('NJ'),
+ nj_njw4_sit_filing_status=filing_status,
+ nj_njw4_sit_allowances=allowances,
+ state_income_tax_additional_withholding=0.0,
+ nj_njw4_sit_rate_table=rate_table,
+ schedule_pay=schedule_pay)
+ payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+ self.assertPayrollAlmostEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding if filing_status else 0.0)
+
+ def test_2020_taxes_example1(self):
+ combined_er_rate = self.ER_NJ_UNEMP + self.ER_NJ_FLI + self.ER_NJ_SDI + self.ER_NJ_WF
+ self._test_er_suta('NJ', combined_er_rate, date(2020, 1, 1), wage_base=self.NJ_UNEMP_MAX_WAGE)
+ combined_ee_rate = self.EE_NJ_UNEMP + self.EE_NJ_FLI + self.EE_NJ_SDI + self.EE_NJ_WF
+ self._test_ee_suta('NJ', combined_ee_rate, date(2020, 1, 1), wage_base=self.NJ_UNEMP_MAX_WAGE, relaxed=True)
+ # these expected values come from https://www.state.nj.us/treasury/taxation/pdf/current/njwt.pdf
+ self._test_sit(300.0, 'single', 1, 'weekly', date(2020, 1, 1), 4.21)
+ self._test_sit(375.0, 'married_separate', 3, 'weekly', date(2020, 1, 1), 4.76)
+ self._test_sit(1400.0, 'head_household', 3, 'weekly', date(2020, 1, 1), 27.60)
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 e46f4a38..89121e21 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -73,6 +73,13 @@
+
+ Form NJ-W4 - State Income Tax
+
+
+
+
+
Form IT-4 - State Income Tax
From 810f4423bc84266dc502b62518bbdb01f6ffef1f Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Mon, 27 Jan 2020 10:32:09 -0500
Subject: [PATCH 03/12] IMP `l10n_us_hr_payroll` Port `l10n_us_nc_hr_payroll`
NC North Carolina including migration
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/final.xml | 3 +
.../data/state/nc_northcarolina.xml | 106 +++++++
l10n_us_hr_payroll/migrations/data.py | 16 ++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/nc_northcarolina.py | 37 +++
.../models/us_payroll_config.py | 9 +
l10n_us_hr_payroll/tests/__init__.py | 3 +
.../test_us_nc_northcarolina_payslip_2019.py | 270 ++++++++++++++++++
.../test_us_nc_northcarolina_payslip_2020.py | 36 +++
.../views/us_payroll_config_views.xml | 6 +
11 files changed, 489 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/nc_northcarolina.xml
create mode 100644 l10n_us_hr_payroll/models/state/nc_northcarolina.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_nc_northcarolina_payslip_2019.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_nc_northcarolina_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index fa50a6ff..7e7bacac 100755
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -33,6 +33,7 @@ USA Payroll Rules.
'data/state/mo_missouri.xml',
'data/state/ms_mississippi.xml',
'data/state/mt_montana.xml',
+ 'data/state/nc_northcarolina.xml',
'data/state/nj_newjersey.xml',
'data/state/oh_ohio.xml',
'data/state/pa_pennsylvania.xml',
diff --git a/l10n_us_hr_payroll/data/final.xml b/l10n_us_hr_payroll/data/final.xml
index ef0448af..f36c7a8f 100644
--- a/l10n_us_hr_payroll/data/final.xml
+++ b/l10n_us_hr_payroll/data/final.xml
@@ -31,6 +31,9 @@
ref('hr_payroll_rule_er_us_mt_suta_aft'),
ref('hr_payroll_rule_ee_us_mt_sit'),
+ ref('hr_payroll_rule_er_us_nc_suta'),
+ ref('hr_payroll_rule_ee_us_nc_sit'),
+
ref('hr_payroll_rule_er_us_nj_suta'),
ref('hr_payroll_rule_ee_us_nj_suta'),
ref('hr_payroll_rule_er_us_nj_sdi'),
diff --git a/l10n_us_hr_payroll/data/state/nc_northcarolina.xml b/l10n_us_hr_payroll/data/state/nc_northcarolina.xml
new file mode 100644
index 00000000..85ce2c2d
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/nc_northcarolina.xml
@@ -0,0 +1,106 @@
+
+
+
+
+
+ US NC North Carolina SUTA Wage Base
+ us_nc_suta_wage_base
+ 24300.0
+
+
+
+ US NC North Carolina SUTA Wage Base
+ us_nc_suta_wage_base
+ 25200.0
+
+
+
+
+
+
+
+ US NC North Carolina SUTA Rate
+ us_nc_suta_rate
+ 1.0
+
+
+
+ US NC North Carolina SUTA Rate
+ us_nc_suta_rate
+ 1.0
+
+
+
+
+
+
+ US NC North Carolina Allowance Rate
+ us_nc_sit_allowance_rate
+ {
+ 'weekly': {'allowance': 48.08, 'standard_deduction': 192.31, 'standard_deduction_hh': 288.46},
+ 'bi-weekly': {'allowance': 96.15, 'standard_deduction': 384.62, 'standard_deduction_hh': 576.92},
+ 'semi-monthly': {'allowance': 104.17, 'standard_deduction': 416.67, 'standard_deduction_hh': 625.00},
+ 'monthly': {'allowance': 208.33, 'standard_deduction': 833.33, 'standard_deduction_hh': 1250.00},
+ }
+
+
+
+ US NC North Carolina Allowance Rate
+ us_nc_sit_allowance_rate
+ {
+ 'weekly': {'allowance': 48.08, 'standard_deduction': 206.73, 'standard_deduction_hh': 310.10},
+ 'bi-weekly': {'allowance': 96.15, 'standard_deduction': 413.46, 'standard_deduction_hh': 620.19},
+ 'semi-monthly': {'allowance': 104.17, 'standard_deduction': 447.92, 'standard_deduction_hh': 671.88},
+ 'monthly': {'allowance': 208.33, 'standard_deduction': 895.83, 'standard_deduction_hh': 1343.75},
+ }
+
+
+
+
+
+
+ US North Carolina - Department of Taxation - Unemployment Tax
+
+
+ US North Carolina - Department of Taxation - Unemployment Tax
+
+
+
+
+ US North Carolina - Department of Taxation - Income Tax
+
+
+ US North Carolina - Department of Taxation - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US NC North Carolina State Unemployment
+ ER_US_NC_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nc_suta_wage_base', rate='us_nc_suta_rate', state_code='NC')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nc_suta_wage_base', rate='us_nc_suta_rate', state_code='NC')
+
+
+
+
+
+
+
+ EE: US NC North Carolina State Income Tax Withholding
+ EE_US_NC_SIT
+ python
+ result, _ = nc_northcarolina_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = nc_northcarolina_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/migrations/data.py b/l10n_us_hr_payroll/migrations/data.py
index 4f7bfeea..0c44e6c8 100644
--- a/l10n_us_hr_payroll/migrations/data.py
+++ b/l10n_us_hr_payroll/migrations/data.py
@@ -25,6 +25,10 @@ FIELDS_CONTRACT_TO_US_PAYROLL_FORMS_2020 = {
'mt_mw4_exemptions': 'mt_mw4_sit_exemptions',
'mt_mw4_exempt': 'mt_mw4_sit_exempt',
+ 'nc_nc4_filing_status': 'nc_nc4_sit_filing_status',
+ 'nc_nc4_allowances': 'nc_nc4_sit_allowances',
+ 'nc_nc4_additional_wh': 'state_income_tax_additional_withholding',
+
'nj_njw4_filing_status': 'nj_njw4_sit_filing_status',
'nj_njw4_allowances': 'nj_njw4_sit_allowances',
'nj_njw4_rate_table': 'nj_njw4_sit_rate_table',
@@ -80,6 +84,11 @@ XMLIDS_TO_REMOVE_2020 = [
'l10n_us_mt_hr_payroll.hr_payroll_mt_income_withhold',
'l10n_us_mt_hr_payroll.hr_payroll_rules_mt_unemp_wages',
+ 'l10n_us_nc_hr_payroll.hr_payroll_nc_unemp_wages',
+ 'l10n_us_nc_hr_payroll.hr_payroll_nc_unemp',
+ 'l10n_us_nc_hr_payroll.hr_payroll_nc_income_withhold',
+ 'l10n_us_nc_hr_payroll.hr_payroll_rules_nc_unemp_wages_2018',
+
'l10n_us_nj_hr_payroll.res_partner_njdor_unemp_company',
'l10n_us_nj_hr_payroll.res_partner_njdor_sdi_employee',
'l10n_us_nj_hr_payroll.res_partner_njdor_sdi_company',
@@ -187,6 +196,13 @@ XMLIDS_TO_RENAME_2020 = {
'l10n_us_mt_hr_payroll.hr_payroll_rules_mt_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_mt_suta',
'l10n_us_mt_hr_payroll.hr_payroll_rules_mt_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_mt_sit',
+ 'l10n_us_nc_hr_payroll.res_partner_ncdor_unemp':'l10n_us_hr_payroll.res_partner_us_nc_dor',
+ 'l10n_us_nc_hr_payroll.res_partner_ncdor_withhold': 'l10n_us_hr_payroll.res_partner_us_nc_dor_sit',
+ 'l10n_us_nc_hr_payroll.contrib_register_ncdor_unemp': 'l10n_us_hr_payroll.contrib_register_us_nc_dor',
+ 'l10n_us_nc_hr_payroll.contrib_register_ncdor_withhold': 'l10n_us_hr_payroll.contrib_register_us_nc_dor_sit',
+ 'l10n_us_nc_hr_payroll.hr_payroll_rules_nc_unemp_2018': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_nc_suta',
+ 'l10n_us_nc_hr_payroll.hr_payroll_rules_nc_inc_withhold_2018': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_nc_sit',
+
'l10n_us_nj_hr_payroll.res_partner_njdor_unemp_employee': 'l10n_us_hr_payroll.res_partner_us_nj_dor',
'l10n_us_nj_hr_payroll.res_partner_njdor_withhold': 'l10n_us_hr_payroll.res_partner_us_nj_dor_sit',
'l10n_us_nj_hr_payroll.contrib_register_njdor_unemp_employee': 'l10n_us_hr_payroll.contrib_register_us_nj_dor',
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index 9f028169..74994388 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -18,6 +18,7 @@ from .state.ga_georgia import ga_georgia_state_income_withholding
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.nj_newjersey import nj_newjersey_state_income_withholding
from .state.oh_ohio import oh_ohio_state_income_withholding
from .state.va_virginia import va_virginia_state_income_withholding
@@ -59,6 +60,7 @@ class HRPayslip(models.Model):
'mo_missouri_state_income_withholding': mo_missouri_state_income_withholding,
'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,
'nj_newjersey_state_income_withholding': nj_newjersey_state_income_withholding,
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
'va_virginia_state_income_withholding': va_virginia_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/nc_northcarolina.py b/l10n_us_hr_payroll/models/state/nc_northcarolina.py
new file mode 100644
index 00000000..4cf80742
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/nc_northcarolina.py
@@ -0,0 +1,37 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies
+
+
+def nc_northcarolina_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 = 'NC'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ filing_status = payslip.dict.contract_id.us_payroll_config_value('nc_nc4_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ schedule_pay = payslip.dict.contract_id.schedule_pay
+ additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ allowances = payslip.dict.contract_id.us_payroll_config_value('nc_nc4_sit_allowances')
+ allowances_rate = payslip.dict.rule_parameter('us_nc_sit_allowance_rate').get(schedule_pay)['allowance']
+ deduction = payslip.dict.rule_parameter('us_nc_sit_allowance_rate').get(schedule_pay)['standard_deduction'] if filing_status != 'head_household' else payslip.dict.rule_parameter('us_nc_sit_allowance_rate').get(schedule_pay)['standard_deduction_hh']
+
+ if wage == 0.0:
+ return 0.0, 0.0
+ taxable_wage = round((wage - (deduction + (allowances * allowances_rate))) * 0.0535)
+ withholding = 0.0
+ if taxable_wage < 0.0:
+ withholding -= taxable_wage
+ withholding = taxable_wage
+ 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 09ed845b..2166716f 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -94,6 +94,15 @@ class HRContractUSPayrollConfig(models.Model):
('montana_for_marriage', 'Montana for Marriage'),
], string='Montana MW-4 Exempt from Withholding', help='MW-4 Section 2')
+ nc_nc4_sit_filing_status = fields.Selection([
+ ('', 'Exempt'),
+ ('single', 'Single'),
+ ('married', 'Married'),
+ ('surviving_spouse', 'Surviving Spouse'),
+ ('head_household', 'Head of Household')
+ ], 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.')
+
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 f0e84ff2..3844fbcf 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -19,6 +19,9 @@ from . import test_us_ms_mississippi_payslip_2020
from . import test_us_mt_montana_payslip_2019
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_nj_newjersey_payslip_2019
from . import test_us_nj_newjersey_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_nc_northcarolina_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_nc_northcarolina_payslip_2019.py
new file mode 100755
index 00000000..14c1c5b2
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_nc_northcarolina_payslip_2019.py
@@ -0,0 +1,270 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .common import TestUsPayslip, process_payslip
+
+
+class TestUsNCPayslip(TestUsPayslip):
+ ###
+ # Taxes and Rates
+ ###
+ NC_UNEMP_MAX_WAGE = 24300.0
+ NC_UNEMP = -1.0 / 100.0
+ NC_INC_TAX = -0.0535
+
+
+ def test_2019_taxes_weekly(self):
+ salary = 20000.0
+ # allowance_multiplier and Portion of Standard Deduction for weekly
+ allowance_multiplier = 48.08
+ PST = 192.31
+ exemption = 1
+ # Algorithm derived from percentage method in https://files.nc.gov/ncdor/documents/files/nc-30_book_web.pdf
+ wh = -round((salary - (PST + (allowance_multiplier * exemption))) * -self.NC_INC_TAX)
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('NC'),
+ nc_nc4_sit_filing_status='married',
+ state_income_tax_additional_withholding=0.0,
+ nc_nc4_sit_allowances=1.0,
+ schedule_pay='weekly')
+
+ self._log('2019 North Carolina tax first payslip weekly:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+
+ payslip.compute_sheet()
+
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh)
+
+ process_payslip(payslip)
+
+ # Make a new payslip, this one will have maximums
+
+ remaining_NC_UNEMP_wages = self.NC_UNEMP_MAX_WAGE - salary if (self.NC_UNEMP_MAX_WAGE - 2*salary < salary) \
+ else salary
+ self._log('2019 North Carolina 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_NC_UNEMP_wages * self.NC_UNEMP)
+
+ def test_2019_taxes_with_external_weekly(self):
+ salary = 5000.0
+ schedule_pay = 'weekly'
+
+ employee = self._createEmployee()
+
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('NC'),
+ nc_nc4_sit_filing_status='married',
+ state_income_tax_additional_withholding=0.0,
+ nc_nc4_sit_allowances=1.0,
+ schedule_pay='weekly')
+
+ self._log('2019 NorthCarolina_external 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.NC_UNEMP)
+
+ def test_2019_taxes_biweekly(self):
+ salary = 5000.0
+ schedule_pay = 'bi-weekly'
+ # allowance_multiplier and Portion of Standard Deduction for weekly
+ allowance_multiplier = 96.15
+ PST = 384.62
+
+ allowances = 2
+ # Algorithm derived from percentage method in https://files.nc.gov/ncdor/documents/files/nc-30_book_web.pdf
+
+ wh = -round((salary - (PST + (allowance_multiplier * allowances))) * -self.NC_INC_TAX)
+
+ employee = self._createEmployee()
+
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('NC'),
+ nc_nc4_sit_filing_status='married',
+ state_income_tax_additional_withholding=0.0,
+ nc_nc4_sit_allowances=2.0,
+ schedule_pay='bi-weekly')
+
+ self._log('2019 North Carolina 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.NC_UNEMP)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh)
+
+ process_payslip(payslip)
+
+ # Make a new payslip, this one will have maximums
+
+ remaining_NC_UNEMP_wages = self.NC_UNEMP_MAX_WAGE - salary if (self.NC_UNEMP_MAX_WAGE - 2*salary < salary) \
+ else salary
+
+ self._log('2019 North Carolina 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_NC_UNEMP_wages * self.NC_UNEMP)
+
+ def test_2019_taxes_semimonthly(self):
+ salary = 4000.0
+ # allowance_multiplier and Portion of Standard Deduction for weekly
+ allowance_multiplier = 104.17
+ PST = 625.00
+
+ allowances = 1
+ # Algorithm derived from percentage method in https://files.nc.gov/ncdor/documents/files/nc-30_book_web.pdf
+
+ wh = -round((salary - (PST + (allowance_multiplier * allowances))) * -self.NC_INC_TAX)
+
+ employee = self._createEmployee()
+
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('NC'),
+ nc_nc4_sit_filing_status='head_household',
+ state_income_tax_additional_withholding=0.0,
+ nc_nc4_sit_allowances=1.0,
+ schedule_pay='semi-monthly')
+
+ self._log('2019 North 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'], salary * self.NC_UNEMP)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh)
+
+ process_payslip(payslip)
+
+ # Make a new payslip, this one will have maximums
+
+ remaining_NC_UNEMP_wages = self.NC_UNEMP_MAX_WAGE - salary if (self.NC_UNEMP_MAX_WAGE - 2 * salary < salary) \
+ else salary
+
+ self._log('2019 North Carolina 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_NC_UNEMP_wages * self.NC_UNEMP)
+
+ def test_2019_taxes_monthly(self):
+ salary = 4000.0
+ schedule_pay = 'monthly'
+ # allowance_multiplier and Portion of Standard Deduction for weekly
+ allowance_multiplier = 208.33
+ PST = 833.33
+
+ allowances = 1
+ # Algorithm derived from percentage method in https://files.nc.gov/ncdor/documents/files/nc-30_book_web.pdf
+
+ wh = -round((salary - (PST + (allowance_multiplier * allowances))) * -self.NC_INC_TAX)
+
+ employee = self._createEmployee()
+
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('NC'),
+ nc_nc4_sit_filing_status='single',
+ state_income_tax_additional_withholding=0.0,
+ nc_nc4_sit_allowances=1.0,
+ schedule_pay='monthly')
+
+ self._log('2019 North 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'], salary * self.NC_UNEMP)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh)
+
+ process_payslip(payslip)
+
+ # Make a new payslip, this one will have maximums
+
+ remaining_NC_UNEMP_wages = self.NC_UNEMP_MAX_WAGE - salary if (
+ self.NC_UNEMP_MAX_WAGE - 2 * salary < salary) \
+ else salary
+
+ self._log('2019 North Carolina 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_NC_UNEMP_wages * self.NC_UNEMP)
+
+ def test_additional_withholding(self):
+ salary = 4000.0
+ # allowance_multiplier and Portion of Standard Deduction for weekly
+ allowance_multiplier = 48.08
+ PST = 192.31
+ additional_wh = 40.0
+
+ #4000 - (168.27 + (48.08 * 1)
+
+ allowances = 1
+ # Algorithm derived from percentage method in https://files.nc.gov/ncdor/documents/files/nc-30_book_web.pdf
+
+ wh = -round(((salary - (PST + (allowance_multiplier * allowances))) * -self.NC_INC_TAX) + additional_wh)
+
+ employee = self._createEmployee()
+
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('NC'),
+ nc_nc4_sit_filing_status='married',
+ state_income_tax_additional_withholding=40.0,
+ nc_nc4_sit_allowances=1.0,
+ schedule_pay='weekly')
+
+ self._log('2019 North Carolina tax first payslip weekly:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+
+ payslip.compute_sheet()
+
+ cats = self._getCategories(payslip)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh)
+
+ process_payslip(payslip)
+
+ # Make a new payslip, this one will have maximums
+
+ remaining_NC_UNEMP_wages = self.NC_UNEMP_MAX_WAGE - salary if (self.NC_UNEMP_MAX_WAGE - 2 * salary < salary) \
+ else salary
+
+ self._log('2019 North Carolina 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_NC_UNEMP_wages * self.NC_UNEMP)
diff --git a/l10n_us_hr_payroll/tests/test_us_nc_northcarolina_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_nc_northcarolina_payslip_2020.py
new file mode 100755
index 00000000..2c484ac4
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_nc_northcarolina_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 TestUsNCPayslip(TestUsPayslip):
+ ###
+ # 2020 Taxes and Rates
+ ###
+ NC_UNEMP_MAX_WAGE = 25200.0
+ NC_UNEMP = 1.0
+ NC_INC_TAX = 0.0535
+
+ 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('NC'),
+ nc_nc4_sit_filing_status=filing_status,
+ nc_nc4_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 if filing_status else 0.0)
+
+ def test_2020_taxes_example(self):
+ self._test_er_suta('NC', self.NC_UNEMP, date(2020, 1, 1), wage_base=self.NC_UNEMP_MAX_WAGE)
+ self._test_sit(20000.0, 'single', 1, 100.0, 'weekly', date(2020, 1, 1), 1156.0)
+ self._test_sit(5000.0, 'married', 1, 0.0, 'weekly', date(2020, 1, 1), 254.0)
+ self._test_sit(4000.0, 'head_household', 1, 5.0, 'semi-monthly', date(2020, 1, 1), 177.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 89121e21..06dc9843 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -73,6 +73,12 @@
+
+ Form NC-4 - State Income Tax
+
+
+
+
Form NJ-W4 - State Income Tax
From e5034a10671a6d0234269a998916a43463079a72 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Wed, 29 Jan 2020 11:47:13 -0500
Subject: [PATCH 04/12] IMP `l10n_us_hr_payroll` Port `l10n_us_mi_hr_payroll`
MI Michigan including migration
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/final.xml | 3 +
l10n_us_hr_payroll/data/state/mi_michigan.xml | 96 +++++++++
l10n_us_hr_payroll/migrations/data.py | 16 ++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/mi_michigan.py | 35 ++++
.../models/us_payroll_config.py | 2 +
l10n_us_hr_payroll/tests/__init__.py | 3 +
.../tests/test_us_mi_michigan_payslip_2019.py | 194 ++++++++++++++++++
.../tests/test_us_mi_michigan_payslip_2020.py | 35 ++++
.../views/us_payroll_config_views.xml | 6 +
11 files changed, 393 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/mi_michigan.xml
create mode 100644 l10n_us_hr_payroll/models/state/mi_michigan.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_mi_michigan_payslip_2019.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_mi_michigan_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 7e7bacac..99a4b04e 100755
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -30,6 +30,7 @@ USA Payroll Rules.
'data/federal/fed_941_fit_rules.xml',
'data/state/fl_florida.xml',
'data/state/ga_georgia.xml',
+ 'data/state/mi_michigan.xml',
'data/state/mo_missouri.xml',
'data/state/ms_mississippi.xml',
'data/state/mt_montana.xml',
diff --git a/l10n_us_hr_payroll/data/final.xml b/l10n_us_hr_payroll/data/final.xml
index f36c7a8f..ccfa82fe 100644
--- a/l10n_us_hr_payroll/data/final.xml
+++ b/l10n_us_hr_payroll/data/final.xml
@@ -21,6 +21,9 @@
ref('hr_payroll_rule_er_us_ga_suta'),
ref('hr_payroll_rule_ee_us_ga_sit'),
+ ref('hr_payroll_rule_er_us_mi_suta'),
+ ref('hr_payroll_rule_ee_us_mi_sit'),
+
ref('hr_payroll_rule_er_us_mo_suta'),
ref('hr_payroll_rule_ee_us_mo_sit'),
diff --git a/l10n_us_hr_payroll/data/state/mi_michigan.xml b/l10n_us_hr_payroll/data/state/mi_michigan.xml
new file mode 100644
index 00000000..df0f6352
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/mi_michigan.xml
@@ -0,0 +1,96 @@
+
+
+
+
+
+ US MI Michigan SUTA Wage Base
+ us_mi_suta_wage_base
+ 9500.0
+
+
+
+ US MI Michigan SUTA Wage Base
+ us_mi_suta_wage_base
+ 9000.0
+
+
+
+
+
+
+
+ US MI Michigan SUTA Rate
+ us_mi_suta_rate
+ 2.7
+
+
+
+ US MI Michigan SUTA Rate
+ us_mi_suta_rate
+ 2.7
+
+
+
+
+
+
+ US MI Michigan Exemption Rate
+ us_mi_sit_exemption_rate
+ 4400.0
+
+
+
+ US MI Michigan Exemption Rate
+ us_mi_sit_exemption_rate
+ 4750.0
+
+
+
+
+
+
+ US Michigan - Unemployment Insurance Agency - Unemployment Tax
+
+
+ US Michigan - Unemployment Insurance Agency - Unemployment Tax
+
+
+
+
+ US Michigan - Department of Treasury - Income Tax
+
+
+ US Michigan - Department of Treasury - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US MI Michigan State Unemployment
+ ER_US_MI_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_mi_suta_wage_base', rate='us_mi_suta_rate', state_code='MI')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_mi_suta_wage_base', rate='us_mi_suta_rate', state_code='MI')
+
+
+
+
+
+
+
+ EE: US MI Michigan State Income Tax Withholding
+ EE_US_MI_SIT
+ python
+ result, _ = mi_michigan_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = mi_michigan_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/migrations/data.py b/l10n_us_hr_payroll/migrations/data.py
index 0c44e6c8..e11a5f12 100644
--- a/l10n_us_hr_payroll/migrations/data.py
+++ b/l10n_us_hr_payroll/migrations/data.py
@@ -14,6 +14,10 @@ FIELDS_CONTRACT_TO_US_PAYROLL_FORMS_2020 = {
'ga_g4_additional_allowances': 'ga_g4_sit_additional_allowances',
'ga_g4_additional_wh': 'state_income_tax_additional_withholding',
+ 'mi_w4_exemptions': 'mi_w4_sit_exemptions',
+ 'mi_w4_tax_exempt': 'state_income_tax_exempt',
+ 'mi_w4_additional_wh': 'state_income_tax_additional_withholding',
+
'mo_mow4_filing_status': 'mo_mow4_sit_filing_status',
'mo_mow4_additional_withholding': 'state_income_tax_additional_withholding',
@@ -69,6 +73,11 @@ XMLIDS_TO_REMOVE_2020 = [
'l10n_us_ga_hr_payroll.hr_payroll_ga_income_withhold',
'l10n_us_ga_hr_payroll.hr_payroll_rules_ga_unemp_wages',
+ 'l10n_us_mi_hr_payroll.hr_payroll_mi_unemp_wages',
+ 'l10n_us_mi_hr_payroll.hr_payroll_mi_unemp',
+ 'l10n_us_mi_hr_payroll.hr_payroll_mi_income_withhold',
+ 'l10n_us_mi_hr_payroll.hr_payroll_rules_mi_unemp_wages',
+
'l10n_us_mo_hr_payroll.hr_payroll_mo_unemp_wages',
'l10n_us_mo_hr_payroll.hr_payroll_mo_unemp',
'l10n_us_mo_hr_payroll.hr_payroll_mo_income_withhold',
@@ -175,6 +184,13 @@ XMLIDS_TO_RENAME_2020 = {
'l10n_us_ga_hr_payroll.hr_payroll_rules_ga_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_ga_suta',
'l10n_us_ga_hr_payroll.hr_payroll_rules_ga_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_ga_sit',
+ 'l10n_us_mi_hr_payroll.res_partner_mi_uia_unemp': 'l10n_us_hr_payroll.res_partner_us_mi_dor',
+ 'l10n_us_mi_hr_payroll.res_partner_mi_dot_withhold': 'l10n_us_hr_payroll.res_partner_us_mi_dor_sit',
+ 'l10n_us_mi_hr_payroll.contrib_register_mi_uia_unemp': 'l10n_us_hr_payroll.contrib_register_us_mi_dor',
+ 'l10n_us_mi_hr_payroll.contrib_register_mi_dot_withhold': 'l10n_us_hr_payroll.contrib_register_us_mi_dor_sit',
+ 'l10n_us_mi_hr_payroll.hr_payroll_rules_mi_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_mi_suta',
+ 'l10n_us_mi_hr_payroll.hr_payroll_rules_mi_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_mi_sit',
+
'l10n_us_mo_hr_payroll.res_partner_modor_unemp': 'l10n_us_hr_payroll.res_partner_us_mo_dor',
'l10n_us_mo_hr_payroll.res_partner_modor_withhold': 'l10n_us_hr_payroll.res_partner_us_mo_dor_sit',
'l10n_us_mo_hr_payroll.contrib_register_modor_unemp': 'l10n_us_hr_payroll.contrib_register_us_mo_dor',
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index 74994388..f699a59b 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -15,6 +15,7 @@ from .state.general import general_state_unemployment, \
general_state_income_withholding, \
is_us_state
from .state.ga_georgia import ga_georgia_state_income_withholding
+from .state.mi_michigan import mi_michigan_state_income_withholding
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
@@ -57,6 +58,7 @@ class HRPayslip(models.Model):
'general_state_income_withholding': general_state_income_withholding,
'is_us_state': is_us_state,
'ga_georgia_state_income_withholding': ga_georgia_state_income_withholding,
+ 'mi_michigan_state_income_withholding': mi_michigan_state_income_withholding,
'mo_missouri_state_income_withholding': mo_missouri_state_income_withholding,
'ms_mississippi_state_income_withholding': ms_mississippi_state_income_withholding,
'mt_montana_state_income_withholding': mt_montana_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/mi_michigan.py b/l10n_us_hr_payroll/models/state/mi_michigan.py
new file mode 100644
index 00000000..9112e970
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/mi_michigan.py
@@ -0,0 +1,35 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies
+
+
+def mi_michigan_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 = 'MI'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ if payslip.dict.contract_id.us_payroll_config_value('state_income_tax_exempt'):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ pay_periods = payslip.dict.get_pay_periods_in_year()
+ additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ exemption_rate = payslip.dict.rule_parameter('us_mi_sit_exemption_rate')
+ exemption = payslip.dict.contract_id.us_payroll_config_value('mi_w4_sit_exemptions')
+
+ if wage == 0.0:
+ return 0.0, 0.0
+
+ annual_exemption = (exemption * exemption_rate) / pay_periods
+ withholding = ((wage - annual_exemption) * 0.0425)
+ if withholding < 0.0:
+ 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 2166716f..c60d2f6f 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -64,6 +64,8 @@ class HRContractUSPayrollConfig(models.Model):
ga_g4_sit_additional_allowances = fields.Integer(string='Georgia G-4 Additional Allowances',
help='G-4 5.')
+ mi_w4_sit_exemptions = fields.Integer(string='Michigan MI W-4 Exemptions', help='MI-W4 6.')
+
mo_mow4_sit_filing_status = fields.Selection([
('', 'Exempt'),
('single', 'Single or Married Spouse Works or Married Filing Separate'),
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 3844fbcf..65616a6a 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -10,6 +10,9 @@ from . import test_us_fl_florida_payslip_2020
from . import test_us_ga_georgia_payslip_2019
from . import test_us_ga_georgia_payslip_2020
+from . import test_us_mi_michigan_payslip_2019
+from . import test_us_mi_michigan_payslip_2020
+
from . import test_us_mo_missouri_payslip_2019
from . import test_us_mo_missouri_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_mi_michigan_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_mi_michigan_payslip_2019.py
new file mode 100755
index 00000000..b12baed2
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_mi_michigan_payslip_2019.py
@@ -0,0 +1,194 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .common import TestUsPayslip, process_payslip
+
+
+class TestUsMIPayslip(TestUsPayslip):
+ # Taxes and Rates
+ MI_UNEMP_MAX_WAGE = 9500.0
+ MI_UNEMP = - 2.7 / 100.0
+ MI_INC_TAX = - 4.25 / 100.0
+ ANNUAL_EXEMPTION_AMOUNT = 4400.00
+ PAY_PERIOD_DIVISOR = {
+ 'weekly': 52.0,
+ 'bi-weekly': 26.0,
+ 'semi-monthly': 24.0,
+ 'monthly': 12.0
+ }
+
+ def test_2019_taxes_weekly(self):
+ salary = 5000.0
+ schedule_pay = 'weekly'
+ exemptions = 1
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MI'),
+ state_income_tax_additional_withholding=0.0,
+ mi_w4_sit_exemptions=1.0,
+ schedule_pay='weekly')
+
+ allowance_amount = self.ANNUAL_EXEMPTION_AMOUNT / self.PAY_PERIOD_DIVISOR[schedule_pay]
+ wh = -((salary - (allowance_amount * exemptions)) * -self.MI_INC_TAX)
+
+ self._log('2019 Michigan 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.MI_UNEMP)
+ self.assertPayrollAlmostEqual(cats['EE_US_SIT'], wh)
+ #
+ process_payslip(payslip)
+
+ # Make a new payslip, this one will have maximums
+ remaining_MI_UNEMP_wages = self.MI_UNEMP_MAX_WAGE - salary if (self.MI_UNEMP_MAX_WAGE - 2*salary < salary) \
+ else salary
+
+ self._log('2019 Michigan 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_MI_UNEMP_wages * self.MI_UNEMP)
+
+ def test_2019_taxes_biweekly(self):
+ salary = 5000.0
+ schedule_pay = 'bi-weekly'
+ allowance_amount = self.ANNUAL_EXEMPTION_AMOUNT / self.PAY_PERIOD_DIVISOR[schedule_pay]
+ exemption = 2
+
+ wh = -((salary - (allowance_amount * exemption)) * -self.MI_INC_TAX)
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MI'),
+ state_income_tax_additional_withholding=0.0,
+ mi_w4_sit_exemptions=2.0,
+ schedule_pay='bi-weekly')
+
+ self._log('2019 Michigan 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.MI_UNEMP)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh)
+
+ process_payslip(payslip)
+
+ # Make a new payslip, this one will have maximums
+ remaining_MI_UNEMP_wages = self.MI_UNEMP_MAX_WAGE - salary if (self.MI_UNEMP_MAX_WAGE - 2*salary < salary) \
+ else salary
+
+ self._log('2019 Michigan 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_MI_UNEMP_wages * self.MI_UNEMP)
+
+ def test_2019_taxes_semimonthly(self):
+ salary = 5000.0
+ schedule_pay = 'semi-monthly'
+ allowance_amount = self.ANNUAL_EXEMPTION_AMOUNT / self.PAY_PERIOD_DIVISOR[schedule_pay]
+ exemption = 1
+
+ wh = -((salary - (allowance_amount * exemption)) * -self.MI_INC_TAX)
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MI'),
+ state_income_tax_additional_withholding=0.0,
+ mi_w4_sit_exemptions=1.0,
+ schedule_pay='semi-monthly')
+
+ self._log('2019 Michigan tax first payslip semi-monthly:')
+ 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.MI_UNEMP)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh)
+
+ process_payslip(payslip)
+
+ # Make a new payslip, this one will have maximums
+ remaining_MI_UNEMP_wages = self.MI_UNEMP_MAX_WAGE - salary if (self.MI_UNEMP_MAX_WAGE - 2 * salary < salary) \
+ else salary
+
+ self._log('2019 Michigan tax second payslip semi-monthly:')
+ payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_MI_UNEMP_wages * self.MI_UNEMP)
+
+ def test_2019_taxes_monthly(self):
+ salary = 5000.0
+ schedule_pay = 'monthly'
+ allowance_amount = self.ANNUAL_EXEMPTION_AMOUNT / self.PAY_PERIOD_DIVISOR[schedule_pay]
+ exemption = 1
+
+ wh = -((salary - (allowance_amount * exemption)) * -self.MI_INC_TAX)
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MI'),
+ state_income_tax_additional_withholding=0.0,
+ mi_w4_sit_exemptions=1.0,
+ schedule_pay='monthly')
+
+ self._log('2019 Michigan tax first payslip monthly:')
+ 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.MI_UNEMP)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh)
+
+ process_payslip(payslip)
+
+ # Make a new payslip, this one will have maximums
+ remaining_MI_UNEMP_wages = self.MI_UNEMP_MAX_WAGE - salary if (
+ self.MI_UNEMP_MAX_WAGE - (2 * salary) < salary) \
+ else salary
+
+ self._log('2019 Michigan tax second payslip monthly:')
+ payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_MI_UNEMP_wages * self.MI_UNEMP)
+
+ def test_additional_withholding(self):
+ salary = 5000.0
+ schedule_pay = 'weekly'
+ allowance_amount = 0.0
+ allowance_amount = self.ANNUAL_EXEMPTION_AMOUNT / self.PAY_PERIOD_DIVISOR[schedule_pay]
+ additional_wh = 40.0
+ exemption = 1
+
+ wh = -(((salary - (allowance_amount * exemption)) * -self.MI_INC_TAX) + additional_wh)
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MI'),
+ state_income_tax_additional_withholding=40.0,
+ mi_w4_sit_exemptions=1.0,
+ schedule_pay='weekly')
+
+ self._log('2019 Michigan tax first payslip with additional withholding:')
+ 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.MI_UNEMP)
+ self.assertPayrollAlmostEqual(cats['EE_US_SIT'], wh)
+
+ process_payslip(payslip)
diff --git a/l10n_us_hr_payroll/tests/test_us_mi_michigan_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_mi_michigan_payslip_2020.py
new file mode 100755
index 00000000..7d178d76
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_mi_michigan_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 TestUsMIPayslip(TestUsPayslip):
+ # Taxes and Rates
+ MI_UNEMP_MAX_WAGE = 9000.0
+ MI_UNEMP = 2.7
+
+ def _test_sit(self, wage, exemptions, additional_withholding, schedule_pay, date_start, expected_withholding):
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('MI'),
+ mi_w4_sit_exemptions=exemptions,
+ 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('MI', self.MI_UNEMP, date(2020, 1, 1), wage_base=self.MI_UNEMP_MAX_WAGE)
+ self._test_sit(5000.0, 1, 100.0, 'weekly', date(2020, 1, 1), 308.62)
+ self._test_sit(5000.0, 1, 0.0, 'weekly', date(2020, 1, 1), 208.62)
+ self._test_sit(5000.0, 1, 5.0, 'semi-monthly', date(2020, 1, 1), 209.09)
+ self._test_sit(5000.0, 1, 5.0, 'monthly', date(2020, 1, 1), 200.68)
+ self._test_sit(5000.0, 200, 0.0, 'monthly', date(2020, 1, 1), 0.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 06dc9843..47ef9272 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -55,6 +55,12 @@
+
+ Form MI-W4 - State Income Tax
+
+
+
+
Form MO W-4 - State Income Tax
From 261cc998fd23daa6877035d07c10390919aca758 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Thu, 30 Jan 2020 18:20:31 -0500
Subject: [PATCH 05/12] IMP `l10n_us_hr_payroll` Port `l10n_us_mn_hr_payroll`
MN Minnesota including migration
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/final.xml | 3 +
.../data/state/mn_minnesota.xml | 137 +++++++++++++++
l10n_us_hr_payroll/migrations/data.py | 16 ++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/mn_minnesota.py | 43 +++++
.../models/us_payroll_config.py | 7 +
l10n_us_hr_payroll/tests/__init__.py | 3 +
.../test_us_mn_minnesota_payslip_2019.py | 159 ++++++++++++++++++
.../test_us_mn_minnesota_payslip_2020.py | 36 ++++
.../views/us_payroll_config_views.xml | 6 +
11 files changed, 413 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/mn_minnesota.xml
create mode 100644 l10n_us_hr_payroll/models/state/mn_minnesota.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_mn_minnesota_payslip_2019.py
create mode 100755 l10n_us_hr_payroll/tests/test_us_mn_minnesota_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 99a4b04e..e6bb1b7e 100755
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -31,6 +31,7 @@ USA Payroll Rules.
'data/state/fl_florida.xml',
'data/state/ga_georgia.xml',
'data/state/mi_michigan.xml',
+ 'data/state/mn_minnesota.xml',
'data/state/mo_missouri.xml',
'data/state/ms_mississippi.xml',
'data/state/mt_montana.xml',
diff --git a/l10n_us_hr_payroll/data/final.xml b/l10n_us_hr_payroll/data/final.xml
index ccfa82fe..e18d015e 100644
--- a/l10n_us_hr_payroll/data/final.xml
+++ b/l10n_us_hr_payroll/data/final.xml
@@ -21,6 +21,9 @@
ref('hr_payroll_rule_er_us_ga_suta'),
ref('hr_payroll_rule_ee_us_ga_sit'),
+ ref('hr_payroll_rule_er_us_mn_suta'),
+ ref('hr_payroll_rule_ee_us_mn_sit'),
+
ref('hr_payroll_rule_er_us_mi_suta'),
ref('hr_payroll_rule_ee_us_mi_sit'),
diff --git a/l10n_us_hr_payroll/data/state/mn_minnesota.xml b/l10n_us_hr_payroll/data/state/mn_minnesota.xml
new file mode 100644
index 00000000..d21874cc
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/mn_minnesota.xml
@@ -0,0 +1,137 @@
+
+
+
+
+
+ US MN Minnesota SUTA Wage Base
+ us_mn_suta_wage_base
+ 34000.0
+
+
+
+ US MN Minnesota SUTA Wage Base
+ us_mn_suta_wage_base
+ 35000.0
+
+
+
+
+
+
+
+ US MN Minnesota SUTA Rate
+ us_mn_suta_rate
+ 1.11
+
+
+
+ US MN Minnesota SUTA Rate
+ us_mn_suta_rate
+ 1.11
+
+
+
+
+
+
+ US MN Minnesota SIT Tax Rate
+ us_mn_sit_tax_rate
+ {
+ 'single': [
+ ( 28920, 2400, 5.35, 0.00),
+ ( 89510, 28920, 7.05, 1418.82),
+ (166290, 89510, 7.85, 5690.42),
+ ( 'inf', 166290, 9.85, 11717.65),
+ ],
+ 'married': [
+ ( 47820, 9050, 5.35, 0.00),
+ ( 163070, 47820, 7.05, 2074.20),
+ ( 282200, 163070, 7.85, 10199.33),
+ ( 'inf', 282200, 9.85, 19551.04),
+ ],
+ }
+
+
+
+ US MN Minnesota SIT Tax Rate
+ us_mn_sit_tax_rate
+ {
+ 'single': [
+ ( 30760, 3800, 5.35, 0.00),
+ ( 92350, 30760, 6.80, 1442.36),
+ (168200, 92350, 7.85, 5630.48),
+ ( 'inf', 168200, 9.85, 11584.71),
+ ],
+ 'married': [
+ ( 51310, 11900, 5.35, 0.00),
+ ( 168470, 51310, 6.80, 2108.44),
+ ( 285370, 168470, 7.85, 10075.32),
+ ( 'inf', 285370, 9.85, 19251.97),
+ ],
+ }
+
+
+
+
+
+
+ US MN Minnesota Allowances Rate
+ us_mn_sit_allowances_rate
+ 4250.0
+
+
+
+ US MN Minnesota Allowances Rate
+ us_mn_sit_allowances_rate
+ 4300.0
+
+
+
+
+
+
+ US Minnesota - Unemployment Insurance Agency - Unemployment Tax
+
+
+ US Minnesota - Unemployment Insurance Agency - Unemployment Tax
+
+
+
+
+ US Minnesota - Department of Treasury - Income Tax
+
+
+ US Minnesota - Department of Treasury - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US MN Minnesota State Unemployment
+ ER_US_MN_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_mn_suta_wage_base', rate='us_mn_suta_rate', state_code='MN')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_mn_suta_wage_base', rate='us_mn_suta_rate', state_code='MN')
+
+
+
+
+
+
+
+ EE: US MN Minnesota State Income Tax Withholding
+ EE_US_MN_SIT
+ python
+ result, _ = mn_minnesota_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = mn_minnesota_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/migrations/data.py b/l10n_us_hr_payroll/migrations/data.py
index e11a5f12..432b3680 100644
--- a/l10n_us_hr_payroll/migrations/data.py
+++ b/l10n_us_hr_payroll/migrations/data.py
@@ -18,6 +18,10 @@ FIELDS_CONTRACT_TO_US_PAYROLL_FORMS_2020 = {
'mi_w4_tax_exempt': 'state_income_tax_exempt',
'mi_w4_additional_wh': 'state_income_tax_additional_withholding',
+ 'mn_w4mn_filing_status': 'mn_w4mn_sit_filing_status',
+ 'mn_w4mn_allowances': 'mn_w4mn_sit_allowances',
+ 'mn_w4mn_additional_wh': 'state_income_tax_additional_withholding',
+
'mo_mow4_filing_status': 'mo_mow4_sit_filing_status',
'mo_mow4_additional_withholding': 'state_income_tax_additional_withholding',
@@ -78,6 +82,11 @@ XMLIDS_TO_REMOVE_2020 = [
'l10n_us_mi_hr_payroll.hr_payroll_mi_income_withhold',
'l10n_us_mi_hr_payroll.hr_payroll_rules_mi_unemp_wages',
+ 'l10n_us_mn_hr_payroll.hr_payroll_mn_unemp_wages',
+ 'l10n_us_mn_hr_payroll.hr_payroll_mn_unemp',
+ 'l10n_us_mn_hr_payroll.hr_payroll_mn_income_withhold',
+ 'l10n_us_mn_hr_payroll.hr_payroll_rules_mn_unemp_wages',
+
'l10n_us_mo_hr_payroll.hr_payroll_mo_unemp_wages',
'l10n_us_mo_hr_payroll.hr_payroll_mo_unemp',
'l10n_us_mo_hr_payroll.hr_payroll_mo_income_withhold',
@@ -191,6 +200,13 @@ XMLIDS_TO_RENAME_2020 = {
'l10n_us_mi_hr_payroll.hr_payroll_rules_mi_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_mi_suta',
'l10n_us_mi_hr_payroll.hr_payroll_rules_mi_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_mi_sit',
+ 'l10n_us_mn_hr_payrol.res_partner_mn_ui_unemp': 'l10n_us_hr_payroll.res_partner_us_mn_dor',
+ 'l10n_us_mn_hr_payrol.res_partner_mn_dor_withhold': 'l10n_us_hr_payroll.res_partner_us_mn_dor_sit',
+ 'l10n_us_mn_hr_payrol.contrib_register_mn_ui_unemp': 'l10n_us_hr_payroll.contrib_register_us_mn_dor',
+ 'l10n_us_mn_hr_payrol.contrib_register_mn_dor_withhold': 'l10n_us_hr_payroll.contrib_register_us_mn_dor_sit',
+ 'l10n_us_mn_hr_payrol.hr_payroll_rules_mn_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_mn_suta',
+ 'l10n_us_mn_hr_payrol.hr_payroll_rules_mn_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_mn_sit',
+
'l10n_us_mo_hr_payroll.res_partner_modor_unemp': 'l10n_us_hr_payroll.res_partner_us_mo_dor',
'l10n_us_mo_hr_payroll.res_partner_modor_withhold': 'l10n_us_hr_payroll.res_partner_us_mo_dor_sit',
'l10n_us_mo_hr_payroll.contrib_register_modor_unemp': 'l10n_us_hr_payroll.contrib_register_us_mo_dor',
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index f699a59b..c2174f97 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -16,6 +16,7 @@ from .state.general import general_state_unemployment, \
is_us_state
from .state.ga_georgia import ga_georgia_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
from .state.ms_mississippi import ms_mississippi_state_income_withholding
from .state.mt_montana import mt_montana_state_income_withholding
@@ -59,6 +60,7 @@ class HRPayslip(models.Model):
'is_us_state': is_us_state,
'ga_georgia_state_income_withholding': ga_georgia_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,
'ms_mississippi_state_income_withholding': ms_mississippi_state_income_withholding,
'mt_montana_state_income_withholding': mt_montana_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/mn_minnesota.py b/l10n_us_hr_payroll/models/state/mn_minnesota.py
new file mode 100644
index 00000000..f640b36a
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/mn_minnesota.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
+
+
+def mn_minnesota_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 = 'MN'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ filing_status = payslip.dict.contract_id.us_payroll_config_value('mn_w4mn_sit_filing_status')
+ if not filing_status:
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ pay_periods = payslip.dict.get_pay_periods_in_year()
+ additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ sit_tax_rate = payslip.dict.rule_parameter('us_mn_sit_tax_rate')[filing_status]
+ allowances_rate = payslip.dict.rule_parameter('us_mn_sit_allowances_rate')
+ allowances = payslip.dict.contract_id.us_payroll_config_value('mn_w4mn_sit_allowances')
+ if wage == 0.0:
+ return 0.0, 0.0
+
+ taxable_income = (wage * pay_periods) - (allowances * allowances_rate)
+ withholding = 0.0
+ for row in sit_tax_rate:
+ cap, subtract_amt, rate, flat_fee = row
+ cap = float(cap)
+ if cap > taxable_income:
+ withholding = ((rate / 100.00) * (taxable_income - subtract_amt)) + flat_fee
+ break
+ withholding = round(withholding / pay_periods)
+ if withholding < 0.0:
+ 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 c60d2f6f..fd21e0d2 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -66,6 +66,13 @@ class HRContractUSPayrollConfig(models.Model):
mi_w4_sit_exemptions = fields.Integer(string='Michigan MI W-4 Exemptions', help='MI-W4 6.')
+ mn_w4mn_sit_filing_status = fields.Selection([
+ ('', 'Exempt'),
+ ('single', 'Single'),
+ ('married', 'Married'),
+ ], string='Minnesota W-4MN Marital Status', help='W-4MN')
+ mn_w4mn_sit_allowances = fields.Integer(string='Minnesota Allowances', help='W-4MN 1.')
+
mo_mow4_sit_filing_status = fields.Selection([
('', 'Exempt'),
('single', 'Single or Married Spouse Works or Married Filing Separate'),
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 65616a6a..711bb35c 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -13,6 +13,9 @@ from . import test_us_ga_georgia_payslip_2020
from . import test_us_mi_michigan_payslip_2019
from . import test_us_mi_michigan_payslip_2020
+from . import test_us_mn_minnesota_payslip_2019
+from . import test_us_mn_minnesota_payslip_2020
+
from . import test_us_mo_missouri_payslip_2019
from . import test_us_mo_missouri_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_mn_minnesota_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_mn_minnesota_payslip_2019.py
new file mode 100755
index 00000000..2a64b57d
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_mn_minnesota_payslip_2019.py
@@ -0,0 +1,159 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .common import TestUsPayslip, process_payslip
+
+
+class TestUsMNPayslip(TestUsPayslip):
+ # TAXES AND RATES
+ MN_UNEMP_MAX_WAGE = 34000.0
+ MN_UNEMP = -1.11 / 100.0
+
+ def test_taxes_weekly(self):
+ salary = 30000.0
+ # Hand Calculated Amount to Test
+ # Step 1 -> 30000.00 for wages per period Step 2 -> 52.0 for weekly -> 30000 * 52 -> 1560000
+ # Step 3 -> allowances * 4250.0 -> 4250.00 in this case.
+ # Step 4 -> Step 2 - Step 3 -> 1560000 - 4250.00 -> 1555750
+ # Step 5 -> using chart -> we have last row -> ((1555750 - 166290) * (9.85 / 100)) + 11717.65 -> 148579.46
+ # Step 6 -> Convert back to pay period amount and round - > 2857.297 - > 2857.0
+ # wh = 2857.0
+ wh = -2857.0
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MN'),
+ mn_w4mn_sit_filing_status='single',
+ state_income_tax_additional_withholding=0.0,
+ mn_w4mn_sit_allowances=1.0,
+ schedule_pay='weekly')
+
+ self._log('2019 Minnesota 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.MN_UNEMP)
+ self.assertPayrollAlmostEqual(cats['EE_US_SIT'], wh) # Test numbers are off by 1 penny
+
+ process_payslip(payslip)
+
+ # Make a new payslip, this one will have maximums
+ remaining_MN_UNEMP_wages = self.MN_UNEMP_MAX_WAGE - salary if (self.MN_UNEMP_MAX_WAGE - 2*salary < salary) \
+ else salary
+
+ self._log('2019 Minnesota 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_MN_UNEMP_wages * self.MN_UNEMP)
+
+ def test_taxes_married(self):
+ salary = 5000.00
+
+ # Hand Calculated Amount to Test
+ # Step 1 -> 5000.0 for wages per period Step 2 -> 52.0 for weekly -> 5000 * 52 -> 260,000
+ # Step 3 -> allowances * 4250.0 -> 4250.00 in this case.
+ # Step 4 -> Step 2 - Step 3 -> 260,000 - 4250.00 -> 255750.0
+ # For step five we used the married section
+ # Step 5 -> using chart -> we have 2nd last row -> ((255750 - 163070) * (7.85 / 100)) + 10199.33 ->
+ # Step 6 -> Convert back to pay period amount and round
+ # wh = 336.0
+ wh = -336.0
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MN'),
+ mn_w4mn_sit_filing_status='married',
+ state_income_tax_additional_withholding=0.0,
+ mn_w4mn_sit_allowances=1.0,
+ schedule_pay='weekly')
+
+ self._log('2019 Minnesota tax first payslip married:')
+ 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.MN_UNEMP)
+ self.assertPayrollAlmostEqual(cats['EE_US_SIT'], wh)
+
+ def test_taxes_semimonthly(self):
+ salary = 6500.00
+ # Hand Calculated Amount to Test
+ # Step 1 -> 6500.00 for wages per period Step 2 -> 24 for semi-monthly -> 6500.00 * 24 -> 156000.00
+ # Step 3 -> allowances * 4250.0 -> 4250.00 in this case.
+ # Step 4 -> Step 2 - Step 3 -> 156000.00 - 4250.00 -> 151750.0
+ # Step 5 -> using chart -> we have 2nd last row -> ((151750.0- 89510) * (7.85 / 100)) + 5690.42 -> 10576.26
+ # Step 6 -> Convert back to pay period amount and round
+ # wh = -441
+ wh = -441.00
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MN'),
+ mn_w4mn_sit_filing_status='single',
+ state_income_tax_additional_withholding=0.0,
+ mn_w4mn_sit_allowances=1.0,
+ schedule_pay='semi-monthly')
+
+
+ self._log('2019 Minnesota tax first payslip semimonthly:')
+ 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.MN_UNEMP)
+ self.assertPayrollAlmostEqual(cats['EE_US_SIT'], wh)
+
+ def test_tax_exempt(self):
+ salary = 5500.00
+ wh = 0
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MN'),
+ mn_w4mn_sit_filing_status='',
+ state_income_tax_additional_withholding=0.0,
+ mn_w4mn_sit_allowances=2.0,
+ schedule_pay='weekly')
+
+ self._log('2019 Minnesota tax first payslip exempt:')
+ 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.MN_UNEMP)
+ self.assertPayrollAlmostEqual(cats['EE_US_SIT'], wh)
+
+ def test_additional_withholding(self):
+ salary = 5500.0
+ # Hand Calculated Amount to Test
+ # Step 1 -> 5500 for wages per period Step 2 -> 52 for weekly -> 5500 * 52 -> 286000.00
+ # Step 3 -> allowances * 4250.0 -> 8500 in this case.
+ # Step 4 -> Step 2 - Step 3 -> 286000.00 - 8500 -> 277500
+ # Step 5 -> using chart -> we have last row -> ((277500- 166290) * (9.85 / 100)) + 11717.65 -> 22671.835
+ # Step 6 -> Convert back to pay period amount and round
+ # wh = -436.0
+ # Add additional_withholding
+ # wh = -436.0 + 40.0
+ wh = -476.0
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('MN'),
+ mn_w4mn_sit_filing_status='single',
+ state_income_tax_additional_withholding=40.0,
+ mn_w4mn_sit_allowances=2.0,
+ schedule_pay='weekly')
+
+ self._log('2019 Minnesota tax first payslip additional withholding:')
+ 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.MN_UNEMP)
+ self.assertPayrollAlmostEqual(cats['EE_US_SIT'], wh)
diff --git a/l10n_us_hr_payroll/tests/test_us_mn_minnesota_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_mn_minnesota_payslip_2020.py
new file mode 100755
index 00000000..c91fa2a8
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_mn_minnesota_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 TestUsMNPayslip(TestUsPayslip):
+ # TAXES AND RATES
+ MN_UNEMP_MAX_WAGE = 35000.0
+ MN_UNEMP = 1.11
+
+ 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('MN'),
+ mn_w4mn_sit_filing_status=filing_status,
+ state_income_tax_additional_withholding=additional_withholding,
+ mn_w4mn_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('MN', self.MN_UNEMP, date(2020, 1, 1), wage_base=self.MN_UNEMP_MAX_WAGE)
+ self._test_sit(5000.0, 'single', 1.0, 0.0, 'weekly', date(2020, 1, 1), 389.0)
+ self._test_sit(30000.0, 'single', 1.0, 0.0, 'weekly', date(2020, 1, 1), 2850.99)
+ self._test_sit(5000.0, 'married', 1.0, 0.0, 'weekly', date(2020, 1, 1), 325.0)
+ self._test_sit(6500.0, 'single', 1.0, 0.0, 'semi-monthly', date(2020, 1, 1), 429.0)
+ self._test_sit(5500.0, '', 2.0, 0.0, 'weekly', date(2020, 1, 1), 0.0)
+ self._test_sit(5500.0, 'single', 2.0, 40.0, 'weekly', date(2020, 1, 1), 470.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 47ef9272..12e5c507 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -61,6 +61,12 @@
+
+ Form W-4MN - State Income Tax
+
+
+
+
Form MO W-4 - State Income Tax
From 74689df8d7d2e744704cbe0b41075987316cdb4d Mon Sep 17 00:00:00 2001
From: Jared Kipe
Date: Sat, 1 Feb 2020 05:52:50 -0800
Subject: [PATCH 06/12] IMP `l10n_us_hr_payroll` Create tax exempt categories
for table coverage from IRS Pub. 15-B
---
l10n_us_hr_payroll/data/base.xml | 82 ++++++++++--
l10n_us_hr_payroll/models/federal/fed_940.py | 56 +++++++-
l10n_us_hr_payroll/models/federal/fed_941.py | 126 ++++++++++++++----
l10n_us_hr_payroll/models/state/ga_georgia.py | 13 +-
l10n_us_hr_payroll/models/state/general.py | 25 ++--
.../models/state/mi_michigan.py | 10 +-
.../models/state/mn_minnesota.py | 9 +-
.../models/state/mo_missouri.py | 11 +-
.../models/state/ms_mississippi.py | 6 +-
l10n_us_hr_payroll/models/state/mt_montana.py | 9 +-
.../models/state/nc_northcarolina.py | 9 +-
.../models/state/nj_newjersey.py | 9 +-
l10n_us_hr_payroll/models/state/oh_ohio.py | 9 +-
.../models/state/va_virginia.py | 9 +-
14 files changed, 288 insertions(+), 95 deletions(-)
diff --git a/l10n_us_hr_payroll/data/base.xml b/l10n_us_hr_payroll/data/base.xml
index 71203f74..f951d57b 100644
--- a/l10n_us_hr_payroll/data/base.xml
+++ b/l10n_us_hr_payroll/data/base.xml
@@ -20,25 +20,89 @@
-
+
+
+
+
+ Wage: US FIT Exempt
+ ALW_FIT_EXEMPT
+
+
+
+
+ Wage: US FIT & FICA Exempt
+ ALW_FIT_FICA_EXEMPT
+
+
+
+
+ Wage: US FIT & FUTA Exempt
+ ALW_FIT_FUTA_EXEMPT
+
+
+
+
+ Wage: US FIT & FICA & FUTA Exempt
+ ALW_FIT_FICA_FUTA_EXEMPT
+
+
+
+
+ Wage: US FICA Exempt
+ ALW_FICA_EXEMPT
+
+
+
+
+ Wage: US FICA & FUTA Exempt
+ ALW_FICA_FUTA_EXEMPT
+
+
+
+
+ Wage: US FUTA Exempt
+ ALW_FUTA_EXEMPT
+
+
+
-
-
+
- Deduction: US Federal Income Tax Exempt
+ Deduction: US FIT Exempt
DED_FIT_EXEMPT
-
-
-
+
+
+ Deduction: US FIT & FICA Exempt
+ DED_FIT_FICA_EXEMPT
+
+
+
+
+ Deduction: US FIT & FUTA Exempt
+ DED_FIT_FUTA_EXEMPT
+
+
+
+
+ Deduction: US FIT & FICA & FUTA Exempt
+ DED_FIT_FICA_FUTA_EXEMPT
+
+
+
Deduction: US FICA Exempt
DED_FICA_EXEMPT
-
-
+
+
+ Deduction: US FICA & FUTA Exempt
+ DED_FICA_FUTA_EXEMPT
+
+
+
Deduction: US FUTA Exempt
DED_FUTA_EXEMPT
diff --git a/l10n_us_hr_payroll/models/federal/fed_940.py b/l10n_us_hr_payroll/models/federal/fed_940.py
index 816c88d5..85987ed9 100644
--- a/l10n_us_hr_payroll/models/federal/fed_940.py
+++ b/l10n_us_hr_payroll/models/federal/fed_940.py
@@ -1,9 +1,53 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+def futa_wage(payslip, categories):
+ """
+ Returns FUTA eligible wage for current Payslip (no wage_base, just by categories)
+ WAGE = GROSS - ALW_FUTA_EXEMPT + DED_FUTA_EXEMPT
+ :return: wage
+ """
+ wage = categories.GROSS
+
+ wage -= categories.ALW_FUTA_EXEMPT + \
+ categories.ALW_FIT_FUTA_EXEMPT + \
+ categories.ALW_FIT_FICA_FUTA_EXEMPT + \
+ categories.ALW_FICA_FUTA_EXEMPT
+
+ wage += categories.DED_FUTA_EXEMPT + \
+ categories.DED_FIT_FUTA_EXEMPT + \
+ categories.DED_FIT_FICA_FUTA_EXEMPT + \
+ categories.DED_FICA_FUTA_EXEMPT
+
+ return wage
+
+
+def futa_wage_ytd(payslip, categories):
+ """
+ Returns Year to Date FUTA eligible wages
+ WAGE = GROSS - ALW_FUTA_EXEMPT + DED_FUTA_EXEMPT
+ :return: wage
+ """
+ year = payslip.dict.get_year()
+ ytd_wage = payslip.sum_category('GROSS', str(year) + '-01-01', str(year+1) + '-01-01')
+
+ ytd_wage -= payslip.sum_category('ALW_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('ALW_FIT_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('ALW_FIT_FICA_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('ALW_FICA_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01')
+
+ ytd_wage += payslip.sum_category('DED_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('DED_FIT_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('DED_FIT_FICA_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('DED_FICA_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01')
+
+ ytd_wage += payslip.dict.contract_id.external_wages
+ return ytd_wage
+
+
def er_us_940_futa(payslip, categories, worked_days, inputs):
"""
Returns FUTA eligible wage and rate.
- WAGE = GROSS + DED_FUTA_EXEMPT
:return: result, result_rate (wage, percent)
"""
@@ -17,16 +61,14 @@ def er_us_940_futa(payslip, categories, worked_days, inputs):
result_rate = -payslip.dict.rule_parameter('fed_940_futa_rate_normal')
# Determine Wage
- year = payslip.dict.get_year()
- ytd_wage = payslip.sum_category('GROSS', str(year) + '-01-01', str(year+1) + '-01-01')
- ytd_wage += payslip.sum_category('DED_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01')
- ytd_wage += payslip.dict.contract_id.external_wages
+ wage = futa_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+ ytd_wage = futa_wage_ytd(payslip, categories)
wage_base = payslip.dict.rule_parameter('fed_940_futa_wage_base')
remaining = wage_base - ytd_wage
- wage = categories.GROSS + categories.DED_FUTA_EXEMPT
-
if remaining < 0.0:
result = 0.0
elif remaining < wage:
diff --git a/l10n_us_hr_payroll/models/federal/fed_941.py b/l10n_us_hr_payroll/models/federal/fed_941.py
index 41019465..8bc1a90a 100644
--- a/l10n_us_hr_payroll/models/federal/fed_941.py
+++ b/l10n_us_hr_payroll/models/federal/fed_941.py
@@ -4,10 +4,53 @@
# _logger = logging.getLogger(__name__)
+def fica_wage(payslip, categories):
+ """
+ Returns FICA eligible wage for current Payslip (no wage_base, just by categories)
+ WAGE = GROSS - ALW_FICA_EXEMPT + DED_FICA_EXEMPT
+ :return: wage
+ """
+ wage = categories.GROSS
+
+ wage -= categories.ALW_FICA_EXEMPT + \
+ categories.ALW_FIT_FICA_EXEMPT + \
+ categories.ALW_FIT_FICA_FUTA_EXEMPT + \
+ categories.ALW_FICA_FUTA_EXEMPT
+
+ wage += categories.DED_FICA_EXEMPT + \
+ categories.DED_FIT_FICA_EXEMPT + \
+ categories.DED_FIT_FICA_FUTA_EXEMPT + \
+ categories.DED_FICA_FUTA_EXEMPT
+
+ return wage
+
+
+def fica_wage_ytd(payslip, categories):
+ """
+ Returns Year to Date FICA eligible wages
+ WAGE = GROSS - ALW_FICA_EXEMPT + DED_FICA_EXEMPT
+ :return: wage
+ """
+ year = payslip.dict.get_year()
+ ytd_wage = payslip.sum_category('GROSS', str(year) + '-01-01', str(year+1) + '-01-01')
+
+ ytd_wage -= payslip.sum_category('ALW_FICA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('ALW_FIT_FICA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('ALW_FIT_FICA_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('ALW_FICA_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01')
+
+ ytd_wage += payslip.sum_category('DED_FICA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('DED_FIT_FICA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('DED_FIT_FICA_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('DED_FICA_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01')
+
+ ytd_wage += payslip.dict.contract_id.external_wages
+ return ytd_wage
+
+
def ee_us_941_fica_ss(payslip, categories, worked_days, inputs):
"""
Returns FICA Social Security eligible wage and rate.
- WAGE = GROSS + DED_FICA_EXEMPT
:return: result, result_rate (wage, percent)
"""
exempt = payslip.dict.contract_id.us_payroll_config_value('fed_941_fica_exempt')
@@ -18,16 +61,14 @@ def ee_us_941_fica_ss(payslip, categories, worked_days, inputs):
result_rate = -payslip.dict.rule_parameter('fed_941_fica_ss_rate')
# Determine Wage
- year = payslip.dict.get_year()
- ytd_wage = payslip.sum_category('GROSS', str(year) + '-01-01', str(year+1) + '-01-01')
- ytd_wage += payslip.sum_category('DED_FICA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01')
- ytd_wage += payslip.dict.contract_id.external_wages
+ wage = fica_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+ ytd_wage = fica_wage_ytd(payslip, categories)
wage_base = payslip.dict.rule_parameter('fed_941_fica_ss_wage_base')
remaining = wage_base - ytd_wage
- wage = categories.GROSS + categories.DED_FICA_EXEMPT
-
if remaining < 0.0:
result = 0.0
elif remaining < wage:
@@ -44,7 +85,6 @@ er_us_941_fica_ss = ee_us_941_fica_ss
def ee_us_941_fica_m(payslip, categories, worked_days, inputs):
"""
Returns FICA Medicare eligible wage and rate.
- WAGE = GROSS + DED_FICA_EXEMPT
:return: result, result_rate (wage, percent)
"""
exempt = payslip.dict.contract_id.us_payroll_config_value('fed_941_fica_exempt')
@@ -55,16 +95,14 @@ def ee_us_941_fica_m(payslip, categories, worked_days, inputs):
result_rate = -payslip.dict.rule_parameter('fed_941_fica_m_rate')
# Determine Wage
- year = payslip.dict.get_year()
- ytd_wage = payslip.sum_category('GROSS', str(year) + '-01-01', str(year+1) + '-01-01')
- ytd_wage += payslip.sum_category('DED_FICA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01')
- ytd_wage += payslip.dict.contract_id.external_wages
+ wage = fica_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+ ytd_wage = fica_wage_ytd(payslip, categories)
wage_base = float(payslip.dict.rule_parameter('fed_941_fica_m_wage_base')) # inf
remaining = wage_base - ytd_wage
- wage = categories.GROSS + categories.DED_FICA_EXEMPT
-
if remaining < 0.0:
result = 0.0
elif remaining < wage:
@@ -81,8 +119,6 @@ er_us_941_fica_m = ee_us_941_fica_m
def ee_us_941_fica_m_add(payslip, categories, worked_days, inputs):
"""
Returns FICA Medicare Additional eligible wage and rate.
- Note that this wage is not capped like the above rules.
- WAGE = GROSS - WAGE_FICA_EXEMPT
:return: result, result_rate (wage, percent)
"""
exempt = payslip.dict.contract_id.us_payroll_config_value('fed_941_fica_exempt')
@@ -93,16 +129,14 @@ def ee_us_941_fica_m_add(payslip, categories, worked_days, inputs):
result_rate = -payslip.dict.rule_parameter('fed_941_fica_m_add_rate')
# Determine Wage
- year = payslip.dict.get_year()
- ytd_wage = payslip.sum_category('GROSS', str(year) + '-01-01', str(year+1) + '-01-01')
- ytd_wage += payslip.sum_category('DED_FICA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01')
- ytd_wage += payslip.dict.contract_id.external_wages
+ wage = fica_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+ ytd_wage = fica_wage_ytd(payslip, categories)
wage_start = payslip.dict.rule_parameter('fed_941_fica_m_add_wage_start')
existing_wage = ytd_wage - wage_start
- wage = categories.GROSS + categories.DED_FICA_EXEMPT
-
if existing_wage >= 0.0:
result = wage
elif wage + existing_wage > 0.0:
@@ -113,11 +147,54 @@ def ee_us_941_fica_m_add(payslip, categories, worked_days, inputs):
return result, result_rate
+def fit_wage(payslip, categories):
+ """
+ Returns FIT eligible wage for current Payslip (no wage_base, just by categories)
+ WAGE = GROSS - ALW_FIT_EXEMPT + DED_FIT_EXEMPT
+ :return: wage
+ """
+ wage = categories.GROSS
+
+ wage -= categories.ALW_FIT_EXEMPT + \
+ categories.ALW_FIT_FICA_EXEMPT + \
+ categories.ALW_FIT_FICA_FUTA_EXEMPT + \
+ categories.ALW_FIT_FUTA_EXEMPT
+
+ wage += categories.DED_FIT_EXEMPT + \
+ categories.DED_FIT_FICA_EXEMPT + \
+ categories.DED_FIT_FICA_FUTA_EXEMPT + \
+ categories.DED_FIT_FUTA_EXEMPT
+
+ return wage
+
+
+def fit_wage_ytd(payslip, categories):
+ """
+ Returns Year to Date FIT eligible wages
+ WAGE = GROSS - ALW_FIT_EXEMPT + DED_FIT_EXEMPT
+ :return: wage
+ """
+ year = payslip.dict.get_year()
+ ytd_wage = payslip.sum_category('GROSS', str(year) + '-01-01', str(year+1) + '-01-01')
+
+ ytd_wage -= payslip.sum_category('ALW_FIT_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('ALW_FIT_FICA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('ALW_FIT_FICA_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('ALW_FIT_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01')
+
+ ytd_wage += payslip.sum_category('DED_FIT_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('DED_FIT_FICA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('DED_FIT_FICA_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01') + \
+ payslip.sum_category('DED_FIT_FUTA_EXEMPT', str(year) + '-01-01', str(year+1) + '-01-01')
+
+ ytd_wage += payslip.dict.contract_id.external_wages
+ return ytd_wage
+
+
# Federal Income Tax
def ee_us_941_fit(payslip, categories, worked_days, inputs):
"""
Returns Wage and rate that is computed given the amount to withhold.
- WAGE = GROSS + DED_FIT_EXEMPT
:return: result, result_rate (wage, percent)
"""
filing_status = payslip.dict.contract_id.us_payroll_config_value('fed_941_fit_w4_filing_status')
@@ -125,7 +202,8 @@ def ee_us_941_fit(payslip, categories, worked_days, inputs):
return 0.0, 0.0
schedule_pay = payslip.dict.contract_id.schedule_pay
- wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ wage = fit_wage(payslip, categories)
+
#_logger.warn('initial gross wage: ' + str(wage))
year = payslip.dict.get_year()
if year >= 2020:
diff --git a/l10n_us_hr_payroll/models/state/ga_georgia.py b/l10n_us_hr_payroll/models/state/ga_georgia.py
index 38032409..f1bbbc31 100644
--- a/l10n_us_hr_payroll/models/state/ga_georgia.py
+++ b/l10n_us_hr_payroll/models/state/ga_georgia.py
@@ -1,12 +1,11 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
-from .general import _state_applies
+from .general import _state_applies, sit_wage
def ga_georgia_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)
"""
@@ -18,7 +17,10 @@ def ga_georgia_state_income_withholding(payslip, categories, worked_days, inputs
return 0.0, 0.0
# Determine Wage
- wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
schedule_pay = payslip.dict.contract_id.schedule_pay
additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
dependent_allowances = payslip.dict.contract_id.us_payroll_config_value('ga_g4_sit_dependent_allowances')
@@ -27,10 +29,7 @@ def ga_georgia_state_income_withholding(payslip, categories, worked_days, inputs
personal_allowance = payslip.dict.rule_parameter('us_ga_sit_personal_allowance').get(ga_filing_status, {}).get(schedule_pay)
deduction = payslip.dict.rule_parameter('us_ga_sit_deduction').get(ga_filing_status, {}).get(schedule_pay)
withholding_rate = payslip.dict.rule_parameter('us_ga_sit_rate').get(ga_filing_status, {}).get(schedule_pay)
- if not all((dependent_allowance_rate, personal_allowance, deduction, withholding_rate)) or wage == 0.0:
- return 0.0, 0.0
-
- if wage == 0.0:
+ if not all((dependent_allowance_rate, personal_allowance, deduction, withholding_rate)):
return 0.0, 0.0
after_standard_deduction = wage - deduction
diff --git a/l10n_us_hr_payroll/models/state/general.py b/l10n_us_hr_payroll/models/state/general.py
index f0dbc37f..8cac1bc6 100644
--- a/l10n_us_hr_payroll/models/state/general.py
+++ b/l10n_us_hr_payroll/models/state/general.py
@@ -1,9 +1,16 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from odoo.exceptions import UserError
+from ..federal.fed_940 import futa_wage, futa_wage_ytd
+from ..federal.fed_941 import fit_wage, fit_wage_ytd
# import logging
# _logger = logging.getLogger(__name__)
+suta_wage = futa_wage
+suta_wage_ytd = futa_wage_ytd
+sit_wage = fit_wage
+sit_wage_ytd = fit_wage_ytd
+
def _state_applies(payslip, state_code):
return state_code == payslip.dict.contract_id.us_payroll_config_value('state_code')
@@ -89,12 +96,12 @@ def general_state_unemployment(payslip, categories, worked_days, inputs, wage_ba
return 0.0, 0.0
# Determine Wage
- year = payslip.dict.get_year()
- ytd_wage = payslip.sum_category('GROSS', str(year) + '-01-01', str(year + 1) + '-01-01')
- ytd_wage += payslip.sum_category('DED_FUTA_EXEMPT', str(year) + '-01-01', str(year + 1) + '-01-01')
- ytd_wage += payslip.dict.contract_id.external_wages
+ wage = suta_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ ytd_wage = suta_wage_ytd(payslip, categories)
- wage = categories.GROSS + categories.DED_FUTA_EXEMPT
return _general_rate(payslip, wage, ytd_wage, wage_base=wage_base, wage_start=wage_start, rate=rate)
@@ -112,12 +119,8 @@ def general_state_income_withholding(payslip, categories, worked_days, inputs, w
return 0.0, 0.0
# Determine Wage
- year = payslip.dict.get_year()
- ytd_wage = payslip.sum_category('GROSS', str(year) + '-01-01', str(year + 1) + '-01-01')
- ytd_wage += payslip.sum_category('DED_FIT_EXEMPT', str(year) + '-01-01', str(year + 1) + '-01-01')
- ytd_wage += payslip.dict.contract_id.external_wages
-
- wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ ytd_wage = sit_wage_ytd(payslip, categories)
+ wage = sit_wage(payslip, categories)
result, result_rate = _general_rate(payslip, wage, ytd_wage, wage_base=wage_base, wage_start=wage_start, rate=rate)
additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
if additional:
diff --git a/l10n_us_hr_payroll/models/state/mi_michigan.py b/l10n_us_hr_payroll/models/state/mi_michigan.py
index 9112e970..1c5f1cf6 100644
--- a/l10n_us_hr_payroll/models/state/mi_michigan.py
+++ b/l10n_us_hr_payroll/models/state/mi_michigan.py
@@ -1,6 +1,6 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
-from .general import _state_applies
+from .general import _state_applies, sit_wage
def mi_michigan_state_income_withholding(payslip, categories, worked_days, inputs):
@@ -18,15 +18,15 @@ def mi_michigan_state_income_withholding(payslip, categories, worked_days, input
return 0.0, 0.0
# Determine Wage
- wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
pay_periods = payslip.dict.get_pay_periods_in_year()
additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
exemption_rate = payslip.dict.rule_parameter('us_mi_sit_exemption_rate')
exemption = payslip.dict.contract_id.us_payroll_config_value('mi_w4_sit_exemptions')
- if wage == 0.0:
- return 0.0, 0.0
-
annual_exemption = (exemption * exemption_rate) / pay_periods
withholding = ((wage - annual_exemption) * 0.0425)
if withholding < 0.0:
diff --git a/l10n_us_hr_payroll/models/state/mn_minnesota.py b/l10n_us_hr_payroll/models/state/mn_minnesota.py
index f640b36a..3aab572c 100644
--- a/l10n_us_hr_payroll/models/state/mn_minnesota.py
+++ b/l10n_us_hr_payroll/models/state/mn_minnesota.py
@@ -1,6 +1,6 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
-from .general import _state_applies
+from .general import _state_applies, sit_wage
def mn_minnesota_state_income_withholding(payslip, categories, worked_days, inputs):
@@ -19,14 +19,15 @@ def mn_minnesota_state_income_withholding(payslip, categories, worked_days, inpu
return 0.0, 0.0
# Determine Wage
- wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
pay_periods = payslip.dict.get_pay_periods_in_year()
additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
sit_tax_rate = payslip.dict.rule_parameter('us_mn_sit_tax_rate')[filing_status]
allowances_rate = payslip.dict.rule_parameter('us_mn_sit_allowances_rate')
allowances = payslip.dict.contract_id.us_payroll_config_value('mn_w4mn_sit_allowances')
- if wage == 0.0:
- return 0.0, 0.0
taxable_income = (wage * pay_periods) - (allowances * allowances_rate)
withholding = 0.0
diff --git a/l10n_us_hr_payroll/models/state/mo_missouri.py b/l10n_us_hr_payroll/models/state/mo_missouri.py
index 7819fc7b..d917856c 100644
--- a/l10n_us_hr_payroll/models/state/mo_missouri.py
+++ b/l10n_us_hr_payroll/models/state/mo_missouri.py
@@ -1,6 +1,6 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
-from .general import _state_applies
+from .general import _state_applies, sit_wage
def mo_missouri_state_income_withholding(payslip, categories, worked_days, inputs):
@@ -19,8 +19,11 @@ def mo_missouri_state_income_withholding(payslip, categories, worked_days, input
return 0.0, 0.0
# Determine Wage
- wage = categories.GROSS + categories.DED_FIT_EXEMPT
- reduced_withholding = payslip.dict.contract_id.us_payroll_config_value('mo_mow4_sit_withholding')
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
+ reduced_withholding = payslip.contract_id.us_payroll_config_value('mo_mow4_sit_withholding')
if reduced_withholding:
return wage, -((reduced_withholding / wage) * 100.0)
@@ -28,8 +31,6 @@ def mo_missouri_state_income_withholding(payslip, categories, worked_days, input
additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
sit_table = payslip.dict.rule_parameter('us_mo_sit_rate')
deduction = payslip.dict.rule_parameter('us_mo_sit_deduction')[filing_status]
- if wage == 0.0:
- return 0.0, 0.0
gross_taxable_income = wage * pay_periods
gross_taxable_income -= deduction
diff --git a/l10n_us_hr_payroll/models/state/ms_mississippi.py b/l10n_us_hr_payroll/models/state/ms_mississippi.py
index 33162129..d5f0fa84 100644
--- a/l10n_us_hr_payroll/models/state/ms_mississippi.py
+++ b/l10n_us_hr_payroll/models/state/ms_mississippi.py
@@ -1,6 +1,6 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
-from .general import _state_applies
+from .general import _state_applies, sit_wage
def ms_mississippi_state_income_withholding(payslip, categories, worked_days, inputs):
@@ -19,8 +19,8 @@ def ms_mississippi_state_income_withholding(payslip, categories, worked_days, in
return 0.0, 0.0
# Determine Wage
- wage = categories.GROSS + categories.DED_FIT_EXEMPT
- if wage == 0.0:
+ wage = sit_wage(payslip, categories)
+ if not wage:
return 0.0, 0.0
pay_periods = payslip.dict.get_pay_periods_in_year()
diff --git a/l10n_us_hr_payroll/models/state/mt_montana.py b/l10n_us_hr_payroll/models/state/mt_montana.py
index a531c0e0..92dc8b5c 100644
--- a/l10n_us_hr_payroll/models/state/mt_montana.py
+++ b/l10n_us_hr_payroll/models/state/mt_montana.py
@@ -1,6 +1,6 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
-from .general import _state_applies
+from .general import _state_applies, sit_wage
def mt_montana_state_income_withholding(payslip, categories, worked_days, inputs):
@@ -18,13 +18,16 @@ def mt_montana_state_income_withholding(payslip, categories, worked_days, inputs
return 0.0, 0.0
# Determine Wage
- wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
schedule_pay = payslip.dict.contract_id.schedule_pay
additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
exemptions = payslip.dict.contract_id.us_payroll_config_value('mt_mw4_sit_exemptions')
exemption_rate = payslip.dict.rule_parameter('us_mt_sit_exemption_rate').get(schedule_pay)
withholding_rate = payslip.dict.rule_parameter('us_mt_sit_rate').get(schedule_pay)
- if not exemption_rate or not withholding_rate or wage == 0.0:
+ if not exemption_rate or not withholding_rate:
return 0.0, 0.0
adjusted_wage = wage - (exemption_rate * (exemptions or 0))
diff --git a/l10n_us_hr_payroll/models/state/nc_northcarolina.py b/l10n_us_hr_payroll/models/state/nc_northcarolina.py
index 4cf80742..1078a185 100644
--- a/l10n_us_hr_payroll/models/state/nc_northcarolina.py
+++ b/l10n_us_hr_payroll/models/state/nc_northcarolina.py
@@ -1,6 +1,6 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
-from .general import _state_applies
+from .general import _state_applies, sit_wage
def nc_northcarolina_state_income_withholding(payslip, categories, worked_days, inputs):
@@ -19,15 +19,16 @@ def nc_northcarolina_state_income_withholding(payslip, categories, worked_days,
return 0.0, 0.0
# Determine Wage
- wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
schedule_pay = payslip.dict.contract_id.schedule_pay
additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
allowances = payslip.dict.contract_id.us_payroll_config_value('nc_nc4_sit_allowances')
allowances_rate = payslip.dict.rule_parameter('us_nc_sit_allowance_rate').get(schedule_pay)['allowance']
deduction = payslip.dict.rule_parameter('us_nc_sit_allowance_rate').get(schedule_pay)['standard_deduction'] if filing_status != 'head_household' else payslip.dict.rule_parameter('us_nc_sit_allowance_rate').get(schedule_pay)['standard_deduction_hh']
- if wage == 0.0:
- return 0.0, 0.0
taxable_wage = round((wage - (deduction + (allowances * allowances_rate))) * 0.0535)
withholding = 0.0
if taxable_wage < 0.0:
diff --git a/l10n_us_hr_payroll/models/state/nj_newjersey.py b/l10n_us_hr_payroll/models/state/nj_newjersey.py
index 4c8870b8..4f9301fe 100644
--- a/l10n_us_hr_payroll/models/state/nj_newjersey.py
+++ b/l10n_us_hr_payroll/models/state/nj_newjersey.py
@@ -1,6 +1,6 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
-from .general import _state_applies
+from .general import _state_applies, sit_wage
def nj_newjersey_state_income_withholding(payslip, categories, worked_days, inputs):
@@ -19,7 +19,9 @@ def nj_newjersey_state_income_withholding(payslip, categories, worked_days, inpu
return 0.0, 0.0
# Determine Wage
- wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
allowances = payslip.dict.contract_id.us_payroll_config_value('nj_njw4_sit_allowances')
sit_rate_table_key = payslip.dict.contract_id.us_payroll_config_value('nj_njw4_sit_rate_table')
@@ -34,9 +36,6 @@ def nj_newjersey_state_income_withholding(payslip, categories, worked_days, inpu
if not allowances:
return 0.0, 0.0
- if wage == 0.0:
- return 0.0, 0.0
-
gross_taxable_income = wage - (allowance_value * allowances)
withholding = 0.0
prior_wage_base = 0.0
diff --git a/l10n_us_hr_payroll/models/state/oh_ohio.py b/l10n_us_hr_payroll/models/state/oh_ohio.py
index 4691600a..11ea9e9f 100644
--- a/l10n_us_hr_payroll/models/state/oh_ohio.py
+++ b/l10n_us_hr_payroll/models/state/oh_ohio.py
@@ -1,6 +1,6 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
-from .general import _state_applies
+from .general import _state_applies, sit_wage
def oh_ohio_state_income_withholding(payslip, categories, worked_days, inputs):
@@ -18,15 +18,16 @@ def oh_ohio_state_income_withholding(payslip, categories, worked_days, inputs):
return 0.0, 0.0
# Determine Wage
- wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
pay_periods = payslip.dict.get_pay_periods_in_year()
additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
exemptions = payslip.dict.contract_id.us_payroll_config_value('oh_it4_sit_exemptions')
exemption_rate = payslip.dict.rule_parameter('us_oh_sit_exemption_rate')
withholding_rate = payslip.dict.rule_parameter('us_oh_sit_rate')
multiplier_rate = payslip.dict.rule_parameter('us_oh_sit_multiplier')
- if wage == 0.0:
- return 0.0, 0.0
taxable_wage = (wage * pay_periods) - (exemption_rate * (exemptions or 0))
withholding = 0.0
diff --git a/l10n_us_hr_payroll/models/state/va_virginia.py b/l10n_us_hr_payroll/models/state/va_virginia.py
index e2cae3e2..a4929bca 100644
--- a/l10n_us_hr_payroll/models/state/va_virginia.py
+++ b/l10n_us_hr_payroll/models/state/va_virginia.py
@@ -1,6 +1,6 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
-from .general import _state_applies
+from .general import _state_applies, sit_wage
def va_virginia_state_income_withholding(payslip, categories, worked_days, inputs):
@@ -18,7 +18,10 @@ def va_virginia_state_income_withholding(payslip, categories, worked_days, input
return 0.0, 0.0
# Determine Wage
- wage = categories.GROSS + categories.DED_FIT_EXEMPT
+ wage = sit_wage(payslip, categories)
+ if not wage:
+ return 0.0, 0.0
+
pay_periods = payslip.dict.get_pay_periods_in_year()
additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
personal_exemptions = payslip.dict.contract_id.us_payroll_config_value('va_va4_sit_exemptions')
@@ -27,8 +30,6 @@ def va_virginia_state_income_withholding(payslip, categories, worked_days, input
other_exemption_rate = payslip.dict.rule_parameter('us_va_sit_other_exemption_rate')
deduction = payslip.dict.rule_parameter('us_va_sit_deduction')
withholding_rate = payslip.dict.rule_parameter('us_va_sit_rate')
- if wage == 0.0:
- return 0.0, 0.0
taxable_wage = (wage * pay_periods) - (deduction + (personal_exemptions * personal_exemption_rate) + (other_exemptions * other_exemption_rate))
withholding = 0.0
From bbea403f33eb0b17e701d38fb21d14c7db216ce7 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Wed, 5 Feb 2020 11:30:31 -0500
Subject: [PATCH 07/12] IMP `l10n_us_hr_payroll` Port `l10n_us_ar_hr_payroll`
AR Arkansas including migration
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/final.xml | 3 +
l10n_us_hr_payroll/data/state/ar_arkansas.xml | 137 ++++++++++++++++++
l10n_us_hr_payroll/migrations/data.py | 17 +++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/ar_arkansas.py | 47 ++++++
.../models/us_payroll_config.py | 2 +
l10n_us_hr_payroll/tests/__init__.py | 3 +
.../tests/test_us_ar_arkansas_payslip_2019.py | 72 +++++++++
.../tests/test_us_ar_arkansas_payslip_2020.py | 35 +++++
.../views/us_payroll_config_views.xml | 6 +
11 files changed, 325 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/ar_arkansas.xml
create mode 100644 l10n_us_hr_payroll/models/state/ar_arkansas.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_ar_arkansas_payslip_2019.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_ar_arkansas_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index e6bb1b7e..065334d3 100755
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -28,6 +28,7 @@ USA Payroll Rules.
'data/federal/fed_941_fica_rules.xml',
'data/federal/fed_941_fit_parameters.xml',
'data/federal/fed_941_fit_rules.xml',
+ 'data/state/ar_arkansas.xml',
'data/state/fl_florida.xml',
'data/state/ga_georgia.xml',
'data/state/mi_michigan.xml',
diff --git a/l10n_us_hr_payroll/data/final.xml b/l10n_us_hr_payroll/data/final.xml
index e18d015e..573f2c59 100644
--- a/l10n_us_hr_payroll/data/final.xml
+++ b/l10n_us_hr_payroll/data/final.xml
@@ -16,6 +16,9 @@
ref('hr_payroll_rule_ee_fed_941_fit'),
+ ref('hr_payroll_rule_er_us_ar_suta'),
+ ref('hr_payroll_rule_ee_us_ar_sit'),
+
ref('hr_payroll_rule_er_us_fl_suta'),
ref('hr_payroll_rule_er_us_ga_suta'),
diff --git a/l10n_us_hr_payroll/data/state/ar_arkansas.xml b/l10n_us_hr_payroll/data/state/ar_arkansas.xml
new file mode 100644
index 00000000..fcc162eb
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/ar_arkansas.xml
@@ -0,0 +1,137 @@
+
+
+
+
+
+ US AR Arkansas SUTA Wage Base
+ us_ar_suta_wage_base
+ 10000.0
+
+
+
+ US AR Arkansas SUTA Wage Base
+ us_ar_suta_wage_base
+ 8000.0
+
+
+
+
+
+
+
+ US AR Arkansas SUTA Rate
+ us_ar_suta_rate
+ 3.2
+
+
+
+ US AR Arkansas SUTA Rate
+ us_ar_suta_rate
+ 2.9
+
+
+
+
+
+
+ US AR Arkansas SIT Tax Rate
+ us_ar_sit_tax_rate
+ [
+ ( 4599, 0.0, 0.00),
+ ( 9099, 2.0, 91.98),
+ ( 13699, 3.0, 182.97),
+ ( 22599, 3.4, 237.77),
+ ( 37899, 5.0, 421.46),
+ ( 80800, 5.9, 762.55),
+ ( 81800, 6.6, 1243.40),
+ ( 82800, 6.6, 1143.40),
+ ( 84100, 6.6, 1043.40),
+ ( 85200, 6.6, 943.40),
+ ( 86200, 6.6, 843.40),
+ ( 'inf', 6.6, 803.40),
+ ]
+
+
+
+ US AR Arkansas SIT Tax Rate
+ us_ar_sit_tax_rate
+ [
+ ( 4599, 0.0, 0.00),
+ ( 9099, 2.0, 91.98),
+ ( 13699, 3.0, 182.97),
+ ( 22599, 3.4, 237.77),
+ ( 37899, 5.0, 421.46),
+ ( 80800, 5.9, 762.55),
+ ( 81800, 6.6, 1243.40),
+ ( 82800, 6.6, 1143.40),
+ ( 84100, 6.6, 1043.40),
+ ( 85200, 6.6, 943.40),
+ ( 86200, 6.6, 843.40),
+ ( 'inf', 6.6, 803.40),
+ ]
+
+
+
+
+
+
+ US AR Arkansas Allowances Rate
+ us_ar_sit_standard_deduction_rate
+ 2200.0
+
+
+
+ US AR Arkansas Allowances Rate
+ us_ar_sit_standard_deduction_rate
+ 2200.0
+
+
+
+
+
+
+ US Arkansas - Department of Workforce Solutions - Unemployment Tax
+
+
+ US Arkansas - Department of Workforce Solutions - Unemployment Tax
+
+
+
+
+ US Arkansas - Department of Financial Administration - Income Tax
+
+
+ US Arkansas - Department of Financial Administration - Income Tax
+
+
+
+
+
+
+
+
+
+ ER: US AR Arkansas State Unemployment
+ ER_US_AR_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ar_suta_wage_base', rate='us_ar_suta_rate', state_code='AR')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ar_suta_wage_base', rate='us_ar_suta_rate', state_code='AR')
+
+
+
+
+
+
+
+ EE: US AR Arkansas State Income Tax Withholding
+ EE_US_AR_SIT
+ python
+ result, _ = ar_arkansas_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = ar_arkansas_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/migrations/data.py b/l10n_us_hr_payroll/migrations/data.py
index 432b3680..10951185 100644
--- a/l10n_us_hr_payroll/migrations/data.py
+++ b/l10n_us_hr_payroll/migrations/data.py
@@ -9,6 +9,10 @@ FIELDS_CONTRACT_TO_US_PAYROLL_FORMS_2020 = {
'fica_exempt': 'fed_941_fica_exempt',
'futa_type': 'fed_940_type',
# State
+ 'ar_w4_allowances': 'ar_ar4ec_sit_allowances',
+ 'ar_w4_tax_exempt': 'state_income_tax_exempt',
+ 'ar_w4_additional_wh': 'state_income_tax_additional_withholding',
+
'ga_g4_filing_status': 'ga_g4_sit_filing_status',
'ga_g4_dependent_allowances': 'ga_g4_sit_dependent_allowances',
'ga_g4_additional_allowances': 'ga_g4_sit_additional_allowances',
@@ -68,6 +72,11 @@ XMLIDS_TO_REMOVE_2020 = [
'l10n_us_hr_payroll.hr_payroll_rules_futa_wages_2018',
'l10n_us_hr_payroll.hr_payroll_rules_fed_inc_withhold_2018_married',
# State
+ 'l10n_us_ar_hr_payroll.hr_payroll_ar_unemp_wages',
+ 'l10n_us_ar_hr_payroll.hr_payroll_ar_unemp',
+ 'l10n_us_ar_hr_payroll.hr_payroll_ar_income_withhold',
+ 'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_unemp_wages',
+
'l10n_us_fl_hr_payroll.hr_payroll_fl_unemp_wages',
'l10n_us_fl_hr_payroll.hr_payroll_fl_unemp',
'l10n_us_fl_hr_payroll.hr_payroll_rules_fl_unemp_wages_2018',
@@ -182,6 +191,14 @@ XMLIDS_TO_RENAME_2020 = {
'l10n_us_hr_payroll.hr_payroll_rules_fica_comp_m': 'l10n_us_hr_payroll.hr_payroll_rule_er_fed_941_m',
'l10n_us_hr_payroll.hr_payroll_rules_fed_inc_withhold_2018_single': 'l10n_us_hr_payroll.hr_payroll_rule_ee_fed_941_fit',
# State
+ 'l10n_us_ar_hr_payroll.res_partner_ar_dws_unemp': 'l10n_us_hr_payroll.res_partner_us_ar_dor',
+ 'l10n_us_ar_hr_payroll.res_partner_ar_dfa_withhold': 'l10n_us_hr_payroll.res_partner_us_ar_dor_sit',
+ 'l10n_us_ar_hr_payroll.contrib_register_ar_dws_unemp': 'l10n_us_hr_payroll.contrib_register_us_ar_dor',
+ 'l10n_us_ar_hr_payroll.contrib_register_ar_dfa_withhold': 'l10n_us_hr_payroll.contrib_register_us_ar_dor_sit',
+ 'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_ar_suta',
+ 'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_inc_withhold': 'l10n_us_hr_payroll',
+ 'l10n_us_ar_hr_payroll.': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_ar_sit',
+
'l10n_us_fl_hr_payroll.hr_payroll_rules_fl_unemp_2018': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_fl_suta',
'l10n_us_fl_hr_payroll.res_partner_fldor': 'l10n_us_hr_payroll.res_partner_us_fl_dor',
'l10n_us_fl_hr_payroll.contrib_register_fldor': 'l10n_us_hr_payroll.contrib_register_us_fl_dor',
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index c2174f97..cab0c257 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -14,6 +14,7 @@ from .federal.fed_941 import ee_us_941_fica_ss, \
from .state.general import general_state_unemployment, \
general_state_income_withholding, \
is_us_state
+from .state.ar_arkansas import ar_arkansas_state_income_withholding
from .state.ga_georgia import ga_georgia_state_income_withholding
from .state.mi_michigan import mi_michigan_state_income_withholding
from .state.mn_minnesota import mn_minnesota_state_income_withholding
@@ -58,6 +59,7 @@ class HRPayslip(models.Model):
'general_state_unemployment': general_state_unemployment,
'general_state_income_withholding': general_state_income_withholding,
'is_us_state': is_us_state,
+ 'ar_arkansas_state_income_withholding': ar_arkansas_state_income_withholding,
'ga_georgia_state_income_withholding': ga_georgia_state_income_withholding,
'mi_michigan_state_income_withholding': mi_michigan_state_income_withholding,
'mn_minnesota_state_income_withholding': mn_minnesota_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/ar_arkansas.py b/l10n_us_hr_payroll/models/state/ar_arkansas.py
new file mode 100644
index 00000000..87190e62
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/ar_arkansas.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 ar_arkansas_state_income_withholding(payslip, categories, worked_days, inputs):
+ """
+ Returns SIT eligible wage and rate.
+
+ :return: result, result_rate (wage, percent)
+ """
+ state_code = 'AR'
+ if not _state_applies(payslip, state_code):
+ return 0.0, 0.0
+
+ if payslip.dict.contract_id.us_payroll_config_value('state_income_tax_exempt'):
+ return 0.0, 0.0
+
+ # Determine Wage
+ wage = sit_wage(payslip, categories)
+ if wage == 0.0:
+ return 0.0, 0.0
+
+ pay_periods = payslip.dict.get_pay_periods_in_year()
+ additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ sit_tax_rate = payslip.dict.rule_parameter('us_ar_sit_tax_rate')
+ standard_deduction = payslip.dict.rule_parameter('us_ar_sit_standard_deduction_rate')
+ allowances = payslip.dict.contract_id.us_payroll_config_value('ar_ar4ec_sit_allowances')
+
+ allowances_amt = allowances * 26.0
+ taxable_income = (wage * pay_periods) - standard_deduction
+ if taxable_income < 87001.0:
+ taxable_income = (taxable_income // 50) * 50.0 + 50.0
+
+ withholding = 0.0
+ for row in sit_tax_rate:
+ cap, rate, adjust_amount = row
+ cap = float(cap)
+ if cap > taxable_income:
+ withholding = (((rate / 100.0) * taxable_income) - adjust_amount) - allowances_amt
+ break
+
+ # In case withholding or taxable_income is negative
+ withholding = max(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 fd21e0d2..b269cab7 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -51,6 +51,8 @@ class HRContractUSPayrollConfig(models.Model):
fed_941_fit_w4_additional_withholding = fields.Float(string='Federal W4 Additional Withholding [4(c)]',
help='Form W4 (2020+) 4(c)')
+ ar_ar4ec_sit_allowances = fields.Integer(string='Arkansas AR4EC allowances', help='AR4EC 3.')
+
ga_g4_sit_filing_status = fields.Selection([
('exempt', 'Exempt'),
('single', 'Single'),
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 711bb35c..83e839d9 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -4,6 +4,9 @@ from . import common
from . import test_us_payslip_2019
from . import test_us_payslip_2020
+from . import test_us_ar_arkansas_payslip_2019
+from . import test_us_ar_arkansas_payslip_2020
+
from . import test_us_fl_florida_payslip_2019
from . import test_us_fl_florida_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_ar_arkansas_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_ar_arkansas_payslip_2019.py
new file mode 100644
index 00000000..73b0f59c
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_ar_arkansas_payslip_2019.py
@@ -0,0 +1,72 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .common import TestUsPayslip, process_payslip
+
+
+class TestUsARPayslip(TestUsPayslip):
+ # https://www.dfa.arkansas.gov/images/uploads/incomeTaxOffice/whformula.pdf Calculation based on this file.
+ AR_UNEMP_MAX_WAGE = 10000.00
+ AR_UNEMP = -3.2 / 100.0
+ AR_INC_TAX = -0.0535
+
+ def test_taxes_monthly(self):
+ salary = 2127.0
+ schedule_pay = 'monthly'
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('AR'),
+ state_income_tax_additional_withholding=0.0,
+ ar_ar4ec_sit_allowances=2.0,
+ state_income_tax_exempt=False,
+ schedule_pay='monthly')
+
+ self._log('2019 Arkansas tax first payslip weekly:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ # Not exempt from rule 1 or rule 2 - unemployment wages., and actual unemployment.
+ self.assertPayrollEqual(cats['ER_US_SUTA'], salary * self.AR_UNEMP)
+
+ process_payslip(payslip)
+
+ # Make a new payslip, this one will have maximums
+ remaining_AR_UNEMP_wages = self.AR_UNEMP_MAX_WAGE - salary if (self.AR_UNEMP_MAX_WAGE - 2*salary < salary) else salary
+ # We reached the cap of 10000.0 in the first payslip.
+ self._log('2019 Arkansas 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_AR_UNEMP_wages * self.AR_UNEMP)
+
+ def test_additional_withholding(self):
+ salary = 5000.0
+ schedule_pay = 'monthly'
+ pay_periods = 12
+ allowances = 2
+ # TODO: comment on how it was calculated
+ test_ar_amt = 2598.60
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('AR'),
+ state_income_tax_additional_withholding=100.0,
+ ar_ar4ec_sit_allowances=2.0,
+ state_income_tax_exempt=False,
+ schedule_pay='monthly')
+
+
+ self._log('2019 Arkansas 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.AR_UNEMP)
+ # TODO: change to hand the test_ar_amt already be divided by pay periods
+ self.assertPayrollAlmostEqual(cats['EE_US_SIT'], -round(test_ar_amt / pay_periods) - 100)
+
+ process_payslip(payslip)
diff --git a/l10n_us_hr_payroll/tests/test_us_ar_arkansas_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_ar_arkansas_payslip_2020.py
new file mode 100644
index 00000000..bf630b6c
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_ar_arkansas_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 TestUsARPayslip(TestUsPayslip):
+ # Taxes and Rates
+ AR_UNEMP_MAX_WAGE = 8000.0
+ AR_UNEMP = 2.9
+
+ def _test_sit(self, wage, exemptions, allowances, additional_withholding, schedule_pay, date_start, expected_withholding):
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('AR'),
+ state_income_tax_exempt=exemptions,
+ state_income_tax_additional_withholding=additional_withholding,
+ ar_ar4ec_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('AR', self.AR_UNEMP, date(2020, 1, 1), wage_base=self.AR_UNEMP_MAX_WAGE)
+ self._test_sit(5000.0, True, 0.0, 0, 'monthly', date(2020, 1, 1), 0.0)
+ self._test_sit(5000.0, False, 0.0, 0, 'monthly', date(2020, 1, 1), 221.0)
+ self._test_sit(5000.0, False, 0.0, 150, 'monthly', date(2020, 1, 1), 371.0)
+ self._test_sit(5000.0, False, 2.0, 0, 'monthly', date(2020, 1, 1), 217)
+ self._test_sit(5000.0, False, 2.0, 150, 'monthly', date(2020, 1, 1), 367)
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 12e5c507..51a4c6b9 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -44,6 +44,12 @@
+
+ Form AR4EC - State Income Tax
+
+
+
+
No additional fields.
From fc99e98cd820a4d28bf59c80ed42e5fde1a76f51 Mon Sep 17 00:00:00 2001
From: Jared Kipe
Date: Wed, 5 Feb 2020 13:58:06 -0800
Subject: [PATCH 08/12] FIX `l10n_us_hr_payroll` Migration script data for AR
missing new rule name.
---
l10n_us_hr_payroll/migrations/data.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/l10n_us_hr_payroll/migrations/data.py b/l10n_us_hr_payroll/migrations/data.py
index 10951185..9208eb49 100644
--- a/l10n_us_hr_payroll/migrations/data.py
+++ b/l10n_us_hr_payroll/migrations/data.py
@@ -196,7 +196,7 @@ XMLIDS_TO_RENAME_2020 = {
'l10n_us_ar_hr_payroll.contrib_register_ar_dws_unemp': 'l10n_us_hr_payroll.contrib_register_us_ar_dor',
'l10n_us_ar_hr_payroll.contrib_register_ar_dfa_withhold': 'l10n_us_hr_payroll.contrib_register_us_ar_dor_sit',
'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_ar_suta',
- 'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_inc_withhold': 'l10n_us_hr_payroll',
+ 'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_ar_sit',
'l10n_us_ar_hr_payroll.': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_ar_sit',
'l10n_us_fl_hr_payroll.hr_payroll_rules_fl_unemp_2018': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_fl_suta',
From da987a4cd0289f0ee71250c94def8a42c1046b8d Mon Sep 17 00:00:00 2001
From: Jared Kipe
Date: Wed, 5 Feb 2020 14:08:52 -0800
Subject: [PATCH 09/12] FIX `l10n_us_hr_payroll` Migration script data for AR
missing old rule name.
---
l10n_us_hr_payroll/migrations/data.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/l10n_us_hr_payroll/migrations/data.py b/l10n_us_hr_payroll/migrations/data.py
index 9208eb49..ea3435a0 100644
--- a/l10n_us_hr_payroll/migrations/data.py
+++ b/l10n_us_hr_payroll/migrations/data.py
@@ -197,7 +197,6 @@ XMLIDS_TO_RENAME_2020 = {
'l10n_us_ar_hr_payroll.contrib_register_ar_dfa_withhold': 'l10n_us_hr_payroll.contrib_register_us_ar_dor_sit',
'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_ar_suta',
'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_ar_sit',
- 'l10n_us_ar_hr_payroll.': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_ar_sit',
'l10n_us_fl_hr_payroll.hr_payroll_rules_fl_unemp_2018': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_fl_suta',
'l10n_us_fl_hr_payroll.res_partner_fldor': 'l10n_us_hr_payroll.res_partner_us_fl_dor',
From a30b816afc1856660e27186798bd1b4381f6b330 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Tue, 11 Feb 2020 14:14:40 -0500
Subject: [PATCH 10/12] IMP `l10n_us_hr_payroll` Port `l10n_us_il_hr_payroll`
IL Illinois including migration
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/final.xml | 3 +
l10n_us_hr_payroll/data/state/il_illinois.xml | 111 ++++++++++++++++++
l10n_us_hr_payroll/migrations/data.py | 16 +++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
.../models/state/il_illinois.py | 35 ++++++
.../models/us_payroll_config.py | 3 +
l10n_us_hr_payroll/tests/__init__.py | 3 +
.../tests/test_us_il_illinois_payslip_2019.py | 71 +++++++++++
.../tests/test_us_il_illinois_payslip_2020.py | 36 ++++++
.../views/us_payroll_config_views.xml | 6 +
11 files changed, 287 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/il_illinois.xml
create mode 100644 l10n_us_hr_payroll/models/state/il_illinois.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_il_illinois_payslip_2019.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_il_illinois_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 065334d3..350b82c5 100755
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -31,6 +31,7 @@ USA Payroll Rules.
'data/state/ar_arkansas.xml',
'data/state/fl_florida.xml',
'data/state/ga_georgia.xml',
+ 'data/state/il_illinois.xml',
'data/state/mi_michigan.xml',
'data/state/mn_minnesota.xml',
'data/state/mo_missouri.xml',
diff --git a/l10n_us_hr_payroll/data/final.xml b/l10n_us_hr_payroll/data/final.xml
index 573f2c59..4b6f5d8a 100644
--- a/l10n_us_hr_payroll/data/final.xml
+++ b/l10n_us_hr_payroll/data/final.xml
@@ -24,6 +24,9 @@
ref('hr_payroll_rule_er_us_ga_suta'),
ref('hr_payroll_rule_ee_us_ga_sit'),
+ ref('hr_payroll_rule_er_us_il_suta'),
+ ref('hr_payroll_rule_ee_us_il_sit'),
+
ref('hr_payroll_rule_er_us_mn_suta'),
ref('hr_payroll_rule_ee_us_mn_sit'),
diff --git a/l10n_us_hr_payroll/data/state/il_illinois.xml b/l10n_us_hr_payroll/data/state/il_illinois.xml
new file mode 100644
index 00000000..1f51bc52
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/il_illinois.xml
@@ -0,0 +1,111 @@
+
+
+
+
+
+ US IL Illinois SUTA Wage Base
+ us_il_suta_wage_base
+ 12960.0
+
+
+
+ US IL Illinois SUTA Wage Base
+ us_il_suta_wage_base
+ 12740.0
+
+
+
+
+
+
+
+ US IL Illinois SUTA Rate
+ us_il_suta_rate
+ 3.175
+
+
+
+ US IL Illinois SUTA Rate
+ us_il_suta_rate
+ 3.130
+
+
+
+
+
+
+ US IL Illinois Basic Allowances Rate
+ us_il_sit_basic_allowances_rate
+ 2275.0
+
+
+
+ US IL Illinois Basic Allowances Rate
+ us_il_sit_basic_allowances_rate
+ 2325.0
+
+
+
+
+
+
+ US IL Illinois Additional Allowances Rate
+ us_il_sit_additional_allowances_rate
+ 1000.0
+
+
+
+ US IL Illinois Additional Allowances Rate
+ us_il_sit_additional_allowances_rate
+ 1000.0
+
+
+
+
+
+
+ US Illinois - Department of Economic Security (IDES) - Unemployment Tax
+
+
+ US Illinois - Department of Economic Security (IDES) - Unemployment Tax
+
+
+
+
+ US Illinois - Department of Revenue (IDOR) - Income Tax
+
+
+ US Illinois - Department of Revenue (IDOR) - Unemployment Tax
+
+
+
+
+
+
+
+
+
+ ER: US IL Illinois State Unemployment
+ ER_US_IL_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_il_suta_wage_base', rate='us_il_suta_rate', state_code='IL')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_il_suta_wage_base', rate='us_il_suta_rate', state_code='IL')
+
+
+
+
+
+
+
+ EE: US IL Illinois State Income Tax Withholding
+ EE_US_IL_SIT
+ python
+ result, _ = il_illinois_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = il_illinois_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/migrations/data.py b/l10n_us_hr_payroll/migrations/data.py
index ea3435a0..4ab21ec1 100644
--- a/l10n_us_hr_payroll/migrations/data.py
+++ b/l10n_us_hr_payroll/migrations/data.py
@@ -18,6 +18,10 @@ FIELDS_CONTRACT_TO_US_PAYROLL_FORMS_2020 = {
'ga_g4_additional_allowances': 'ga_g4_sit_additional_allowances',
'ga_g4_additional_wh': 'state_income_tax_additional_withholding',
+ 'il_w4_basic_allowances': 'il_w4_sit_basic_allowances',
+ 'il_w4_additional_allowances': 'il_w4_sit_additional_allowances',
+ 'il_w4_additional_wh': 'state_income_tax_additional_withholding',
+
'mi_w4_exemptions': 'mi_w4_sit_exemptions',
'mi_w4_tax_exempt': 'state_income_tax_exempt',
'mi_w4_additional_wh': 'state_income_tax_additional_withholding',
@@ -86,6 +90,11 @@ XMLIDS_TO_REMOVE_2020 = [
'l10n_us_ga_hr_payroll.hr_payroll_ga_income_withhold',
'l10n_us_ga_hr_payroll.hr_payroll_rules_ga_unemp_wages',
+ 'l10n_us_il_hr_payroll.hr_payroll_il_unemp_wages',
+ 'l10n_us_il_hr_payroll.hr_payroll_il_unemp',
+ 'l10n_us_il_hr_payroll.hr_payroll_il_income_withhold',
+ 'l10n_us_il_hr_payroll.hr_payroll_rules_il_unemp_wages',
+
'l10n_us_mi_hr_payroll.hr_payroll_mi_unemp_wages',
'l10n_us_mi_hr_payroll.hr_payroll_mi_unemp',
'l10n_us_mi_hr_payroll.hr_payroll_mi_income_withhold',
@@ -209,6 +218,13 @@ XMLIDS_TO_RENAME_2020 = {
'l10n_us_ga_hr_payroll.hr_payroll_rules_ga_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_ga_suta',
'l10n_us_ga_hr_payroll.hr_payroll_rules_ga_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_ga_sit',
+ 'l10n_us_il_hr_payroll.res_partner_il_des_unemp': 'l10n_us_hr_payroll.res_partner_us_il_dor',
+ 'l10n_us_il_hr_payroll.res_partner_il_dor_withhold': 'l10n_us_hr_payroll.res_partner_us_il_dor_sit',
+ 'l10n_us_il_hr_payroll.contrib_register_il_des_unemp': 'l10n_us_hr_payroll.contrib_register_us_il_dor',
+ 'l10n_us_il_hr_payroll.contrib_register_il_dor_withhold': 'l10n_us_hr_payroll.contrib_register_us_il_dor_sit',
+ 'l10n_us_il_hr_payroll.hr_payroll_rules_il_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_il_suta',
+ 'l10n_us_il_hr_payroll.hr_payroll_rules_il_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_il_sit',
+
'l10n_us_mi_hr_payroll.res_partner_mi_uia_unemp': 'l10n_us_hr_payroll.res_partner_us_mi_dor',
'l10n_us_mi_hr_payroll.res_partner_mi_dot_withhold': 'l10n_us_hr_payroll.res_partner_us_mi_dor_sit',
'l10n_us_mi_hr_payroll.contrib_register_mi_uia_unemp': 'l10n_us_hr_payroll.contrib_register_us_mi_dor',
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index cab0c257..db723ea4 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -16,6 +16,7 @@ from .state.general import general_state_unemployment, \
is_us_state
from .state.ar_arkansas import ar_arkansas_state_income_withholding
from .state.ga_georgia import ga_georgia_state_income_withholding
+from .state.il_illinois import il_illinois_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
@@ -61,6 +62,7 @@ class HRPayslip(models.Model):
'is_us_state': is_us_state,
'ar_arkansas_state_income_withholding': ar_arkansas_state_income_withholding,
'ga_georgia_state_income_withholding': ga_georgia_state_income_withholding,
+ 'il_illinois_state_income_withholding': il_illinois_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/il_illinois.py b/l10n_us_hr_payroll/models/state/il_illinois.py
new file mode 100644
index 00000000..e0e920a3
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/il_illinois.py
@@ -0,0 +1,35 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def il_illinois_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 = 'IL'
+ 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.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ basic_allowances_rate = payslip.dict.rule_parameter('us_il_sit_basic_allowances_rate')
+ additional_allowances_rate = payslip.dict.rule_parameter('us_il_sit_additional_allowances_rate')
+ basic_allowances = payslip.dict.contract_id.us_payroll_config_value('il_w4_sit_basic_allowances')
+ additional_allowances = payslip.dict.contract_id.us_payroll_config_value('il_w4_sit_additional_allowances')
+
+ rate = 4.95 / 100.0
+ withholding = rate * (wage - (((basic_allowances * basic_allowances_rate) + (additional_allowances *
+ additional_allowances_rate)) / pay_periods))
+ if withholding < 0.0:
+ 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 b269cab7..ad0ab52e 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -66,6 +66,9 @@ class HRContractUSPayrollConfig(models.Model):
ga_g4_sit_additional_allowances = fields.Integer(string='Georgia G-4 Additional Allowances',
help='G-4 5.')
+ 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.')
+
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 83e839d9..56d2a837 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -13,6 +13,9 @@ from . import test_us_fl_florida_payslip_2020
from . import test_us_ga_georgia_payslip_2019
from . import test_us_ga_georgia_payslip_2020
+from . import test_us_il_illinois_payslip_2019
+from . import test_us_il_illinois_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_il_illinois_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_il_illinois_payslip_2019.py
new file mode 100644
index 00000000..ba633607
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_il_illinois_payslip_2019.py
@@ -0,0 +1,71 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .common import TestUsPayslip, process_payslip
+
+
+class TestUsILPayslip(TestUsPayslip):
+ # TAXES AND RATES
+ IL_UNEMP_MAX_WAGE = 12960.00
+ IL_UNEMP = -(3.175 / 100.0)
+
+ def test_taxes_monthly(self):
+ salary = 15000.00
+ schedule_pay = 'monthly'
+ basic_allowances = 1
+ additional_allowances = 1
+ flat_rate = (4.95 / 100)
+ wh_to_test = -(flat_rate * (salary - ((basic_allowances * 2275 + additional_allowances * 1000) / 12.0)))
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('IL'),
+ state_income_tax_additional_withholding=0.0,
+ il_w4_sit_basic_allowances=1.0,
+ il_w4_sit_additional_allowances=1.0,
+ schedule_pay='monthly')
+
+ self._log('2019 Illinois tax first payslip monthly:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['ER_US_SUTA'], self.IL_UNEMP_MAX_WAGE * self.IL_UNEMP)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh_to_test)
+
+ process_payslip(payslip)
+
+ remaining_IL_UNEMP_wages = 0.0 # We already reached max unemployment wages.
+
+ self._log('2019 Illinois tax second payslip monthly:')
+ payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_IL_UNEMP_wages * self.IL_UNEMP)
+
+ def test_taxes_with_additional_wh(self):
+ salary = 15000.00
+ schedule_pay = 'monthly'
+ basic_allowances = 1
+ additional_allowances = 1
+ additional_wh = 15.0
+ flat_rate = (4.95 / 100)
+ wh_to_test = -(flat_rate * (salary - ((basic_allowances * 2275 + additional_allowances * 1000) / 12.0)) + additional_wh)
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('IL'),
+ state_income_tax_additional_withholding=15.0,
+ il_w4_sit_basic_allowances=1.0,
+ il_w4_sit_additional_allowances=1.0,
+ schedule_pay='monthly')
+
+ self._log('2019 Illinois tax first payslip monthly:')
+ payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
+ payslip.compute_sheet()
+ cats = self._getCategories(payslip)
+
+ self.assertPayrollEqual(cats['ER_US_SUTA'], self.IL_UNEMP_MAX_WAGE * self.IL_UNEMP)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh_to_test)
diff --git a/l10n_us_hr_payroll/tests/test_us_il_illinois_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_il_illinois_payslip_2020.py
new file mode 100644
index 00000000..244c383c
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_il_illinois_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 TestUsILPayslip(TestUsPayslip):
+ # Taxes and Rates
+ MI_UNEMP_MAX_WAGE = 12740.0
+ MI_UNEMP = 3.130
+
+ def _test_sit(self, wage, additional_withholding, basic_allowances, additional_allowances, schedule_pay, date_start, expected_withholding):
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('IL'),
+ state_income_tax_additional_withholding=additional_withholding,
+ il_w4_sit_basic_allowances=basic_allowances,
+ il_w4_sit_additional_allowances=additional_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('IL', self.MI_UNEMP, date(2020, 1, 1), wage_base=self.MI_UNEMP_MAX_WAGE)
+ self._test_sit(800.0, 0.0, 2, 2, 'weekly', date(2020, 1, 1), 33.27)
+ self._test_sit(800.0, 10.0, 2, 2, 'weekly', date(2020, 1, 1), 43.27)
+ self._test_sit(2500.0, 0.0, 1, 1, 'monthly', date(2020, 1, 1), 110.04)
+ self._test_sit(2500.0, 0.0, 0, 0, 'monthly', date(2020, 1, 1), 123.75)
+ self._test_sit(3000.0, 15.0, 0, 0, 'quarterly', date(2020, 1, 1), 163.50)
+
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 51a4c6b9..c8501063 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -61,6 +61,12 @@
+
+ Form IL-W-4 - State Income Tax
+
+
+
+
Form MI-W4 - State Income Tax
From 1d9ce377857df522084dd906eb44f3ad491a7f1d Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Thu, 13 Feb 2020 12:32:57 -0500
Subject: [PATCH 11/12] IMP `l10n_us_hr_payroll` Port `l10n_us_az_hr_payroll`
AZ Arizona including migration
---
l10n_us_hr_payroll/__manifest__.py | 1 +
l10n_us_hr_payroll/data/final.xml | 3 +
l10n_us_hr_payroll/data/state/az_arizona.xml | 81 +++++++++++++++++++
l10n_us_hr_payroll/migrations/data.py | 15 ++++
l10n_us_hr_payroll/models/hr_payslip.py | 2 +
l10n_us_hr_payroll/models/state/az_arizona.py | 35 ++++++++
.../models/us_payroll_config.py | 4 +
l10n_us_hr_payroll/tests/__init__.py | 3 +
.../tests/test_us_az_arizona_payslip_2019.py | 72 +++++++++++++++++
.../tests/test_us_az_arizona_payslip_2020.py | 33 ++++++++
.../views/us_payroll_config_views.xml | 5 ++
11 files changed, 254 insertions(+)
create mode 100644 l10n_us_hr_payroll/data/state/az_arizona.xml
create mode 100644 l10n_us_hr_payroll/models/state/az_arizona.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_az_arizona_payslip_2019.py
create mode 100644 l10n_us_hr_payroll/tests/test_us_az_arizona_payslip_2020.py
diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py
index 350b82c5..41d93477 100755
--- a/l10n_us_hr_payroll/__manifest__.py
+++ b/l10n_us_hr_payroll/__manifest__.py
@@ -29,6 +29,7 @@ USA Payroll Rules.
'data/federal/fed_941_fit_parameters.xml',
'data/federal/fed_941_fit_rules.xml',
'data/state/ar_arkansas.xml',
+ 'data/state/az_arizona.xml',
'data/state/fl_florida.xml',
'data/state/ga_georgia.xml',
'data/state/il_illinois.xml',
diff --git a/l10n_us_hr_payroll/data/final.xml b/l10n_us_hr_payroll/data/final.xml
index 4b6f5d8a..23b5beef 100644
--- a/l10n_us_hr_payroll/data/final.xml
+++ b/l10n_us_hr_payroll/data/final.xml
@@ -19,6 +19,9 @@
ref('hr_payroll_rule_er_us_ar_suta'),
ref('hr_payroll_rule_ee_us_ar_sit'),
+ ref('hr_payroll_rule_er_us_az_suta'),
+ ref('hr_payroll_rule_ee_us_az_sit'),
+
ref('hr_payroll_rule_er_us_fl_suta'),
ref('hr_payroll_rule_er_us_ga_suta'),
diff --git a/l10n_us_hr_payroll/data/state/az_arizona.xml b/l10n_us_hr_payroll/data/state/az_arizona.xml
new file mode 100644
index 00000000..e83a174e
--- /dev/null
+++ b/l10n_us_hr_payroll/data/state/az_arizona.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+ US AZ Arizona SUTA Wage Base
+ us_az_suta_wage_base
+ 7000.0
+
+
+
+ US AZ Arizona SUTA Wage Base
+ us_az_suta_wage_base
+ 7000.0
+
+
+
+
+
+
+
+ US AZ Arizona SUTA Rate
+ us_az_suta_rate
+ 2.0
+
+
+
+ US AZ Arizona SUTA Rate
+ us_az_suta_rate
+ 2.0
+
+
+
+
+
+
+ US Arizona - Department of Economic Security (ADES) - Unemployment Tax
+
+
+ US Arizona - Department of Economic Security (ADES) - Unemployment Tax
+
+
+
+
+ US Arizona - Department of Revenue (ADOR) - Income Tax
+
+
+ US Arizona - Department of Revenue (ADOR) - Unemployment Tax
+
+
+
+
+
+
+
+
+
+ ER: US AZ Arizona State Unemployment
+ ER_US_AZ_SUTA
+ python
+ result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_az_suta_wage_base', rate='us_az_suta_rate', state_code='AZ')
+ code
+ result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_az_suta_wage_base', rate='us_az_suta_rate', state_code='AZ')
+
+
+
+
+
+
+
+ EE: US AZ Arizona State Income Tax Withholding
+ EE_US_AZ_SIT
+ python
+ result, _ = az_arizona_state_income_withholding(payslip, categories, worked_days, inputs)
+ code
+ result, result_rate = az_arizona_state_income_withholding(payslip, categories, worked_days, inputs)
+
+
+
+
+
\ No newline at end of file
diff --git a/l10n_us_hr_payroll/migrations/data.py b/l10n_us_hr_payroll/migrations/data.py
index 4ab21ec1..e6077043 100644
--- a/l10n_us_hr_payroll/migrations/data.py
+++ b/l10n_us_hr_payroll/migrations/data.py
@@ -13,6 +13,9 @@ FIELDS_CONTRACT_TO_US_PAYROLL_FORMS_2020 = {
'ar_w4_tax_exempt': 'state_income_tax_exempt',
'ar_w4_additional_wh': 'state_income_tax_additional_withholding',
+ 'az_a4_withholding_percentage': 'az_a4_sit_withholding_percentage',
+ 'az_a4_additional_withholding': 'state_income_tax_additional_withholding',
+
'ga_g4_filing_status': 'ga_g4_sit_filing_status',
'ga_g4_dependent_allowances': 'ga_g4_sit_dependent_allowances',
'ga_g4_additional_allowances': 'ga_g4_sit_additional_allowances',
@@ -81,6 +84,11 @@ XMLIDS_TO_REMOVE_2020 = [
'l10n_us_ar_hr_payroll.hr_payroll_ar_income_withhold',
'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_unemp_wages',
+ 'l10n_us_az_hr_payroll.hr_payroll_az_unemp_wages',
+ 'l10n_us_az_hr_payroll.hr_payroll_az_unemp',
+ 'l10n_us_az_hr_payroll.hr_payroll_az_income_withhold',
+ 'l10n_us_az_hr_payroll.hr_payroll_rules_az_unemp_wages',
+
'l10n_us_fl_hr_payroll.hr_payroll_fl_unemp_wages',
'l10n_us_fl_hr_payroll.hr_payroll_fl_unemp',
'l10n_us_fl_hr_payroll.hr_payroll_rules_fl_unemp_wages_2018',
@@ -207,6 +215,13 @@ XMLIDS_TO_RENAME_2020 = {
'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_ar_suta',
'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_ar_sit',
+ 'l10n_us_az_hr_payroll.res_partner_az_des_unemp': 'l10n_us_hr_payroll.res_partner_us_az_dor',
+ 'l10n_us_az_hr_payroll.res_partner_az_dor_withhold': 'l10n_us_hr_payroll.res_partner_us_az_dor_sit',
+ 'l10n_us_az_hr_payroll.contrib_register_az_des_unemp': 'l10n_us_hr_payroll.contrib_register_us_az_dor',
+ 'l10n_us_az_hr_payroll.contrib_register_az_dor_withhold': 'l10n_us_hr_payroll.contrib_register_us_az_dor_sit',
+ 'l10n_us_az_hr_payroll.hr_payroll_az_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_az_suta',
+ 'l10n_us_az_hr_payroll.hr_payroll_az_income_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_az_sit',
+
'l10n_us_fl_hr_payroll.hr_payroll_rules_fl_unemp_2018': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_fl_suta',
'l10n_us_fl_hr_payroll.res_partner_fldor': 'l10n_us_hr_payroll.res_partner_us_fl_dor',
'l10n_us_fl_hr_payroll.contrib_register_fldor': 'l10n_us_hr_payroll.contrib_register_us_fl_dor',
diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py
index db723ea4..449861d9 100644
--- a/l10n_us_hr_payroll/models/hr_payslip.py
+++ b/l10n_us_hr_payroll/models/hr_payslip.py
@@ -15,6 +15,7 @@ from .state.general import general_state_unemployment, \
general_state_income_withholding, \
is_us_state
from .state.ar_arkansas import ar_arkansas_state_income_withholding
+from .state.az_arizona import az_arizona_state_income_withholding
from .state.ga_georgia import ga_georgia_state_income_withholding
from .state.il_illinois import il_illinois_state_income_withholding
from .state.mi_michigan import mi_michigan_state_income_withholding
@@ -61,6 +62,7 @@ class HRPayslip(models.Model):
'general_state_income_withholding': general_state_income_withholding,
'is_us_state': is_us_state,
'ar_arkansas_state_income_withholding': ar_arkansas_state_income_withholding,
+ 'az_arizona_state_income_withholding': az_arizona_state_income_withholding,
'ga_georgia_state_income_withholding': ga_georgia_state_income_withholding,
'il_illinois_state_income_withholding': il_illinois_state_income_withholding,
'mi_michigan_state_income_withholding': mi_michigan_state_income_withholding,
diff --git a/l10n_us_hr_payroll/models/state/az_arizona.py b/l10n_us_hr_payroll/models/state/az_arizona.py
new file mode 100644
index 00000000..5878a7b9
--- /dev/null
+++ b/l10n_us_hr_payroll/models/state/az_arizona.py
@@ -0,0 +1,35 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .general import _state_applies, sit_wage
+
+
+def az_arizona_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 = 'AZ'
+ 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.dict.contract_id.schedule_pay
+ additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
+ withholding_percent = payslip.dict.contract_id.us_payroll_config_value('az_a4_sit_withholding_percentage')
+
+ if withholding_percent <= 0.0:
+ return 0.0, 0.0
+
+ wh_percentage = withholding_percent / 100.0
+ withholding = wage * wh_percentage
+
+ if withholding < 0.0:
+ 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 ad0ab52e..0284c170 100644
--- a/l10n_us_hr_payroll/models/us_payroll_config.py
+++ b/l10n_us_hr_payroll/models/us_payroll_config.py
@@ -53,6 +53,10 @@ class HRContractUSPayrollConfig(models.Model):
ar_ar4ec_sit_allowances = fields.Integer(string='Arkansas AR4EC allowances', help='AR4EC 3.')
+ az_a4_sit_withholding_percentage = fields.Float(
+ string='Arizona A-4 Withholding Percentage',
+ help='A-4 1. (0.8 or 1.3 or 1.8 or 2.7 or 3.6 or 4.2 or 5.1 or 0 for exempt.')
+
ga_g4_sit_filing_status = fields.Selection([
('exempt', 'Exempt'),
('single', 'Single'),
diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py
index 56d2a837..7d4abae5 100755
--- a/l10n_us_hr_payroll/tests/__init__.py
+++ b/l10n_us_hr_payroll/tests/__init__.py
@@ -7,6 +7,9 @@ from . import test_us_payslip_2020
from . import test_us_ar_arkansas_payslip_2019
from . import test_us_ar_arkansas_payslip_2020
+from . import test_us_az_arizona_payslip_2019
+from . import test_us_az_arizona_payslip_2020
+
from . import test_us_fl_florida_payslip_2019
from . import test_us_fl_florida_payslip_2020
diff --git a/l10n_us_hr_payroll/tests/test_us_az_arizona_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_az_arizona_payslip_2019.py
new file mode 100644
index 00000000..b97063b6
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_az_arizona_payslip_2019.py
@@ -0,0 +1,72 @@
+# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
+
+from .common import TestUsPayslip, process_payslip
+
+
+class TestUsAZPayslip(TestUsPayslip):
+
+ # TAXES AND RATES
+ AZ_UNEMP_MAX_WAGE = 7000.00
+ AZ_UNEMP = -(2.00 / 100.0)
+
+ def test_taxes_with_additional_wh(self):
+ salary = 15000.00
+ schedule_pay = 'weekly'
+ withholding_percentage = 5.1
+ percent_wh = (5.10 / 100) # 5.1%
+ additional_wh = 12.50
+
+ wh_to_test = -((percent_wh * salary) + additional_wh)
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('AZ'),
+ state_income_tax_additional_withholding=12.50,
+ az_a4_sit_withholding_percentage=withholding_percentage,
+ schedule_pay=schedule_pay)
+
+ self._log('2019 Arizona 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'], self.AZ_UNEMP_MAX_WAGE * self.AZ_UNEMP)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh_to_test)
+
+ process_payslip(payslip)
+
+ remaining_AZ_UNEMP_wages = 0.0 # We already reached max unemployment wages.
+
+ self._log('2019 Arizona 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_AZ_UNEMP_wages * self.AZ_UNEMP)
+
+ def test_taxes_monthly(self):
+ salary = 1000.00
+ schedule_pay = 'monthly'
+ withholding_percentage = 2.7
+ percent_wh = (2.70 / 100) # 2.7%
+ additional_wh = 0.0
+ wh_to_test = -((percent_wh * salary) + additional_wh)
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=salary,
+ state_id=self.get_us_state('AZ'),
+ state_income_tax_additional_withholding=0.0,
+ az_a4_sit_withholding_percentage=withholding_percentage,
+ schedule_pay=schedule_pay)
+
+ self._log('2019 Arizona tax first payslip monthly:')
+ 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.AZ_UNEMP)
+ self.assertPayrollEqual(cats['EE_US_SIT'], wh_to_test)
+
+ process_payslip(payslip)
diff --git a/l10n_us_hr_payroll/tests/test_us_az_arizona_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_az_arizona_payslip_2020.py
new file mode 100644
index 00000000..d1d14d80
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_az_arizona_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 TestUsAZPayslip(TestUsPayslip):
+ # Taxes and Rates
+ AZ_UNEMP_MAX_WAGE = 7000.0
+ AZ_UNEMP = 2.0
+
+ def _test_sit(self, wage, additional_withholding, withholding_percent, schedule_pay, date_start, expected_withholding):
+
+ employee = self._createEmployee()
+ contract = self._createContract(employee,
+ wage=wage,
+ state_id=self.get_us_state('AZ'),
+ state_income_tax_additional_withholding=additional_withholding,
+ az_a4_sit_withholding_percentage=withholding_percent,
+ 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('AZ', self.AZ_UNEMP, date(2020, 1, 1), wage_base=self.AZ_UNEMP_MAX_WAGE)
+ self._test_sit(1000.0, 0.0, 2.70, 'monthly', date(2020, 1, 1), 27.0)
+ self._test_sit(1000.0, 10.0, 2.70, 'monthly', date(2020, 1, 1), 37.0)
+ self._test_sit(15000.0, 0.0, 3.60, 'weekly', date(2020, 1, 1), 540.0)
+ self._test_sit(8000.0, 0.0, 4.20, 'semi-monthly', date(2020, 1, 1), 336.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 c8501063..0bfa51a9 100644
--- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml
+++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml
@@ -50,6 +50,11 @@
+
+ Form A-4 - State Income Tax
+
+
+
No additional fields.
From 8ec7a4e7b278fd418be9604840015cbc1e3e1fc4 Mon Sep 17 00:00:00 2001
From: Bhoomi Vaishnani
Date: Thu, 13 Feb 2020 17:32:34 -0500
Subject: [PATCH 12/12] FIX `l10n_us_hr_payroll` Changed SUTA Rate for Illinois
2020.
---
l10n_us_hr_payroll/data/state/il_illinois.xml | 2 +-
.../tests/test_us_il_illinois_payslip_2020.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/l10n_us_hr_payroll/data/state/il_illinois.xml b/l10n_us_hr_payroll/data/state/il_illinois.xml
index 1f51bc52..731da1fb 100644
--- a/l10n_us_hr_payroll/data/state/il_illinois.xml
+++ b/l10n_us_hr_payroll/data/state/il_illinois.xml
@@ -27,7 +27,7 @@
US IL Illinois SUTA Rate
us_il_suta_rate
- 3.130
+ 3.125
diff --git a/l10n_us_hr_payroll/tests/test_us_il_illinois_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_il_illinois_payslip_2020.py
index 244c383c..ead932e4 100644
--- a/l10n_us_hr_payroll/tests/test_us_il_illinois_payslip_2020.py
+++ b/l10n_us_hr_payroll/tests/test_us_il_illinois_payslip_2020.py
@@ -6,8 +6,8 @@ from .common import TestUsPayslip
class TestUsILPayslip(TestUsPayslip):
# Taxes and Rates
- MI_UNEMP_MAX_WAGE = 12740.0
- MI_UNEMP = 3.130
+ IL_UNEMP_MAX_WAGE = 12740.0
+ IL_UNEMP = 3.125
def _test_sit(self, wage, additional_withholding, basic_allowances, additional_allowances, schedule_pay, date_start, expected_withholding):
@@ -27,7 +27,7 @@ class TestUsILPayslip(TestUsPayslip):
self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
def test_2020_taxes_example(self):
- self._test_er_suta('IL', self.MI_UNEMP, date(2020, 1, 1), wage_base=self.MI_UNEMP_MAX_WAGE)
+ self._test_er_suta('IL', self.IL_UNEMP, date(2020, 1, 1), wage_base=self.IL_UNEMP_MAX_WAGE)
self._test_sit(800.0, 0.0, 2, 2, 'weekly', date(2020, 1, 1), 33.27)
self._test_sit(800.0, 10.0, 2, 2, 'weekly', date(2020, 1, 1), 43.27)
self._test_sit(2500.0, 0.0, 1, 1, 'monthly', date(2020, 1, 1), 110.04)