From ac222b587c931c8e1caae7fe8e6e7091cdc615b6 Mon Sep 17 00:00:00 2001 From: Jared Self Date: Thu, 7 Jan 2021 10:40:26 -0700 Subject: [PATCH] MT Montana --- l10n_us_hr_payroll/data/state/mt_montana.xml | 16 +- .../tests/test_us_mt_montana_payslip_2019.py | 139 ------------------ .../tests/test_us_mt_montana_payslip_2021.py | 37 +++++ 3 files changed, 43 insertions(+), 149 deletions(-) delete mode 100755 l10n_us_hr_payroll/tests/test_us_mt_montana_payslip_2019.py create mode 100755 l10n_us_hr_payroll/tests/test_us_mt_montana_payslip_2021.py diff --git a/l10n_us_hr_payroll/data/state/mt_montana.xml b/l10n_us_hr_payroll/data/state/mt_montana.xml index b777fb4e..7df6da1c 100644 --- a/l10n_us_hr_payroll/data/state/mt_montana.xml +++ b/l10n_us_hr_payroll/data/state/mt_montana.xml @@ -1,22 +1,23 @@ + US MT Montana SUTA Wage Base us_mt_suta_wage_base - - 33000.00 - - - 34100.00 + + 35300.00 + + + @@ -26,11 +27,6 @@ - - 1.18 - - - 1.18 diff --git a/l10n_us_hr_payroll/tests/test_us_mt_montana_payslip_2019.py b/l10n_us_hr_payroll/tests/test_us_mt_montana_payslip_2019.py deleted file mode 100755 index ff6e2daf..00000000 --- a/l10n_us_hr_payroll/tests/test_us_mt_montana_payslip_2019.py +++ /dev/null @@ -1,139 +0,0 @@ -# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. - -from .common import TestUsPayslip, process_payslip - - -class TestUsMtPayslip(TestUsPayslip): - # Calculations from https://app.mt.gov/myrevenue/Endpoint/DownloadPdf?yearId=705 - MT_UNEMP = -1.18 / 100.0 - MT_UNEMP_AFT = -0.13 / 100.0 - - def test_2019_taxes_one(self): - # Payroll Period Semi-Monthly example - salary = 550 - mt_mw4_exemptions = 5 - - employee = self._createEmployee() - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('MT'), - mt_mw4_sit_exemptions=mt_mw4_exemptions, - schedule_pay='semi-monthly') - - self._log('2019 Montana 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.MT_UNEMP + self.MT_UNEMP_AFT)) # New non-combined... - - mt_taxable_income = salary - (79.0 * mt_mw4_exemptions) - mt_withhold = round(0 + (0.018 * (mt_taxable_income - 0))) - self.assertPayrollEqual(mt_taxable_income, 155.0) - self.assertPayrollEqual(mt_withhold, 3.0) - self.assertPayrollEqual(cats['EE_US_SIT'], -mt_withhold) - - def test_2019_taxes_two(self): - # Payroll Period Bi-Weekly example - salary = 2950 - mt_mw4_exemptions = 2 - - employee = self._createEmployee() - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('MT'), - mt_mw4_sit_exemptions=mt_mw4_exemptions, - schedule_pay='bi-weekly') - - self._log('2019 Montana 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'], round(salary * (self.MT_UNEMP + self.MT_UNEMP_AFT), 2)) - - # Note!! - # The example calculation uses A = 16 but the actual table describes this as A = 18 - mt_taxable_income = salary - (73.0 * mt_mw4_exemptions) - mt_withhold = round(18 + (0.06 * (mt_taxable_income - 577))) - self.assertPayrollEqual(mt_taxable_income, 2804.0) - self.assertPayrollEqual(mt_withhold, 152.0) - self.assertPayrollEqual(cats['EE_US_SIT'], -mt_withhold) - - def test_2019_taxes_three(self): - # Payroll Period Weekly example - salary = 135 - mt_mw4_exemptions = 1 - - employee = self._createEmployee() - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('MT'), - mt_mw4_sit_exemptions=mt_mw4_exemptions, - schedule_pay='weekly') - - self._log('2019 Montana 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'], round(salary * (self.MT_UNEMP + self.MT_UNEMP_AFT), 2)) - - mt_taxable_income = salary - (37.0 * mt_mw4_exemptions) - mt_withhold = round(0 + (0.018 * (mt_taxable_income - 0))) - self.assertPayrollEqual(mt_taxable_income, 98.0) - self.assertPayrollEqual(mt_withhold, 2.0) - self.assertPayrollEqual(cats['EE_US_SIT'], -mt_withhold) - - def test_2019_taxes_three_exempt(self): - # Payroll Period Weekly example - salary = 135 - mt_mw4_exemptions = 1 - - employee = self._createEmployee() - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('MT'), - mt_mw4_sit_exemptions=mt_mw4_exemptions, - mt_mw4_sit_exempt='reserve', - schedule_pay='weekly') - - self._log('2019 Montana tax single first payslip:') - payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31') - - payslip.compute_sheet() - - cats = self._getCategories(payslip) - self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), 0.0) - - def test_2019_taxes_three_additional(self): - # Payroll Period Weekly example - salary = 135 - mt_mw4_exemptions = 1 - mt_mw4_additional_withholding = 20.0 - - employee = self._createEmployee() - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('MT'), - mt_mw4_sit_exemptions=mt_mw4_exemptions, - state_income_tax_additional_withholding=mt_mw4_additional_withholding, - schedule_pay='weekly') - - self._log('2019 Montana tax single first payslip:') - payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31') - - payslip.compute_sheet() - cats = self._getCategories(payslip) - - mt_taxable_income = salary - (37.0 * mt_mw4_exemptions) - mt_withhold = round(0 + (0.018 * (mt_taxable_income - 0))) - self.assertPayrollEqual(mt_taxable_income, 98.0) - self.assertPayrollEqual(mt_withhold, 2.0) - self.assertPayrollEqual(cats['EE_US_SIT'], -mt_withhold + -mt_mw4_additional_withholding) diff --git a/l10n_us_hr_payroll/tests/test_us_mt_montana_payslip_2021.py b/l10n_us_hr_payroll/tests/test_us_mt_montana_payslip_2021.py new file mode 100755 index 00000000..755f6208 --- /dev/null +++ b/l10n_us_hr_payroll/tests/test_us_mt_montana_payslip_2021.py @@ -0,0 +1,37 @@ +# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. + +from datetime import date, timedelta +from .common import TestUsPayslip + + +class TestUsMtPayslip(TestUsPayslip): + ### + # 2021 Taxes and Rates + ### + MT_UNEMP_WAGE_MAX = 35300.0 + MT_UNEMP = 1.18 + MT_UNEMP_AFT = 0.13 + + # Calculations from https://app.mt.gov/myrevenue/Endpoint/DownloadPdf?yearId=705 + def _test_sit(self, wage, additional_withholding, exemptions, schedule_pay, date_start, expected_withholding): + employee = self._createEmployee() + contract = self._createContract(employee, + wage=wage, + state_id=self.get_us_state('MT'), + state_income_tax_additional_withholding=additional_withholding, + mt_mw4_sit_exemptions=exemptions, + 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_one(self): + combined_rate = self.MT_UNEMP + self.MT_UNEMP_AFT # Combined for test as they both go to the same category and have the same cap + self._test_er_suta('MT', combined_rate + .0001, date(2021, 1, 1), wage_base=self.MT_UNEMP_WAGE_MAX, relaxed=True) + self._test_sit(550.0, 0.0, 5.0, 'semi-monthly', date(2021, 1, 1), 3.0) + self._test_sit(2950.0, 10.0, 2.0, 'bi-weekly', date(2021, 1, 1), 162.0) + self._test_sit(5000.0, 0.0, 1.0, 'monthly', date(2021, 1, 1), 256.0) + self._test_sit(750.0, 0.0, 1.0, 'weekly', date(2021, 1, 1), 34.0)