diff --git a/l10n_us_hr_payroll/data/state/mi_michigan.xml b/l10n_us_hr_payroll/data/state/mi_michigan.xml
index 1ce32483..df67c982 100644
--- a/l10n_us_hr_payroll/data/state/mi_michigan.xml
+++ b/l10n_us_hr_payroll/data/state/mi_michigan.xml
@@ -7,16 +7,17 @@
-
- 9500.0
-
-
-
9000.0
+
+
+ 9500.0
+
+
+
@@ -26,11 +27,7 @@
-
- 2.7
-
-
-
+
2.7
@@ -44,18 +41,21 @@
-
- 4400.0
-
-
-
4750.0
+
+
+ 4900.0
+
+
+
+
+
US Michigan - Unemployment Insurance Agency - Unemployment Tax
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
deleted file mode 100755
index b12baed2..00000000
--- a/l10n_us_hr_payroll/tests/test_us_mi_michigan_payslip_2019.py
+++ /dev/null
@@ -1,194 +0,0 @@
-# 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_2021.py b/l10n_us_hr_payroll/tests/test_us_mi_michigan_payslip_2021.py
new file mode 100755
index 00000000..690749f8
--- /dev/null
+++ b/l10n_us_hr_payroll/tests/test_us_mi_michigan_payslip_2021.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 = 9500.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_2021_taxes_example(self):
+ self._test_er_suta('MI', self.MI_UNEMP, date(2021, 1, 1), wage_base=self.MI_UNEMP_MAX_WAGE)
+ self._test_sit(750.0, 1, 100.0, 'weekly', date(2021, 1, 1), 127.87)
+ self._test_sit(1750.0, 1, 0.0, 'bi-weekly', date(2021, 1, 1), 66.37)
+ self._test_sit(5000.0, 1, 5.0, 'semi-monthly', date(2021, 1, 1), 208.83)
+ self._test_sit(8000.0, 1, 5.0, 'monthly', date(2021, 1, 1), 327.65)
+ self._test_sit(5000.0, 2, 0.0, 'monthly', date(2021, 1, 1), 177.79)
+