From 1d45b0bf11d7009dfbf88dfee9bc4d2e9c179198 Mon Sep 17 00:00:00 2001 From: Bhoomi Vaishnani Date: Fri, 21 Aug 2020 15:48:22 -0400 Subject: [PATCH] [IMP] l10n_us_hr_payroll: Added Tax table and improved Test case for MT Montana 2020 --- l10n_us_hr_payroll/data/state/mt_montana.xml | 71 ++++++++++++++++--- .../tests/test_us_mt_montana_payslip_2020.py | 30 ++++++-- 2 files changed, 86 insertions(+), 15 deletions(-) diff --git a/l10n_us_hr_payroll/data/state/mt_montana.xml b/l10n_us_hr_payroll/data/state/mt_montana.xml index b420c4fe..b777fb4e 100644 --- a/l10n_us_hr_payroll/data/state/mt_montana.xml +++ b/l10n_us_hr_payroll/data/state/mt_montana.xml @@ -64,40 +64,78 @@ { - 'weekly': [ + 'weekly': ( ( 135.00, 0.0, 1.80), ( 288.00, 2.0, 4.40), ( 2308.00, 9.0, 6.00), ( 'inf', 130.0, 6.60), - ], - 'bi-weekly': [ + ), + 'bi-weekly': ( ( 269.00, 0.0, 1.80), ( 577.00, 5.0, 4.40), ( 4615.00, 18.0, 6.00), ( 'inf', 261.0, 6.60), - ], - 'semi-monthly': [ + ), + 'semi-monthly': ( ( 292.00, 0.0, 1.80), ( 625.00, 5.0, 4.40), ( 5000.00, 20.0, 6.00), ( 'inf', 282.0, 6.60), - ], - 'monthly': [ + ), + 'monthly': ( ( 583.00, 0.0, 1.80), ( 1250.00, 11.0, 4.40), ( 10000.00, 40.0, 6.00), ( 'inf', 565.0, 6.60), - ], - 'annually': [ + ), + 'annually': ( ( 7000.00, 0.0, 1.80), ( 15000.00, 126.0, 4.40), ( 120000.00, 478.0, 6.00), ( 'inf', 6778.0, 6.60), - ], + ), } + + + + { + 'weekly': ( + ( 135.00, 0.0, 1.80), + ( 288.00, 2.0, 4.40), + ( 2308.00, 9.0, 6.00), + ( 'inf', 130.0, 6.60), + ), + 'bi-weekly': ( + ( 269.00, 0.0, 1.80), + ( 577.00, 5.0, 4.40), + ( 4615.00, 18.0, 6.00), + ( 'inf', 261.0, 6.60), + ), + 'semi-monthly': ( + ( 292.00, 0.0, 1.80), + ( 625.00, 5.0, 4.40), + ( 5000.00, 20.0, 6.00), + ( 'inf', 282.0, 6.60), + ), + 'monthly': ( + ( 583.00, 0.0, 1.80), + ( 1250.00, 11.0, 4.40), + ( 10000.00, 40.0, 6.00), + ( 'inf', 565.0, 6.60), + ), + 'annually': ( + ( 7000.00, 0.0, 1.80), + ( 15000.00, 126.0, 4.40), + ( 120000.00, 478.0, 6.00), + ( 'inf', 6778.0, 6.60), + ), + } + + + @@ -117,6 +155,19 @@ + + + + { + 'weekly': 37.0, + 'bi-weekly': 73.0, + 'semi-monthly': 79.0, + 'monthly': 158.0, + 'annually': 1900.0, + } + + + diff --git a/l10n_us_hr_payroll/tests/test_us_mt_montana_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_mt_montana_payslip_2020.py index ec861a0d..13a7e69f 100755 --- a/l10n_us_hr_payroll/tests/test_us_mt_montana_payslip_2020.py +++ b/l10n_us_hr_payroll/tests/test_us_mt_montana_payslip_2020.py @@ -1,17 +1,37 @@ # Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. -from datetime import date -from .common import TestUsPayslip, process_payslip +from datetime import date, timedelta +from .common import TestUsPayslip class TestUsMtPayslip(TestUsPayslip): - # Calculations from https://app.mt.gov/myrevenue/Endpoint/DownloadPdf?yearId=705 + ### + # 2020 Taxes and Rates + ### MT_UNEMP_WAGE_MAX = 34100.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_2020_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, date(2020, 1, 1), wage_base=self.MT_UNEMP_WAGE_MAX) - - # TODO Montana Incometax rates for 2020 when released + self._test_sit(550.0, 0.0, 5.0, 'semi-monthly', date(2020, 1, 1), 3.0) + self._test_sit(2950.0, 10.0, 2.0, 'bi-weekly', date(2020, 1, 1), 162.0) + self._test_sit(5000.0, 0.0, 1.0, 'monthly', date(2020, 1, 1), 256.0) + self._test_sit(750.0, 0.0, 1.0, 'weekly', date(2020, 1, 1), 34.0)