From aafc5c9f3b83223bcf4b2a7f81aee3611c636e41 Mon Sep 17 00:00:00 2001 From: Bhoomi Vaishnani Date: Wed, 19 Aug 2020 14:42:35 -0400 Subject: [PATCH] [IMP] l10n_us_hr_payroll: Refactored Tax table, changed filing status string and Improved test case for KS Kansas 2020. --- l10n_us_hr_payroll/data/state/ks_kansas.xml | 109 ++++++++++++++---- .../models/us_payroll_config.py | 3 +- .../tests/test_us_ks_kansas_payslip_2020.py | 9 +- .../views/us_payroll_config_views.xml | 2 +- 4 files changed, 92 insertions(+), 31 deletions(-) diff --git a/l10n_us_hr_payroll/data/state/ks_kansas.xml b/l10n_us_hr_payroll/data/state/ks_kansas.xml index ea4d5672..5b59d2b7 100644 --- a/l10n_us_hr_payroll/data/state/ks_kansas.xml +++ b/l10n_us_hr_payroll/data/state/ks_kansas.xml @@ -48,7 +48,7 @@ - + US KS Kansas SIT Tax Rate us_ks_sit_tax_rate @@ -58,31 +58,92 @@ { 'single': { - 'weekly': ((58, 0.00, 0.00), (346, 3.10, 0.00), (635, 5.25, 8.94), ('inf', 5.70, 24.09)), - 'bi-weekly': ((115, 0.00, 0.00), (692, 3.10, 0.00), (1269, 5.25, 17.88), ('inf', 5.70, 48.17)), - 'semi-monthly': ((125, 0.00, 0.00), (750, 3.10, 0.00), (1375, 5.25, 19.38), ('inf', 5.70, 52.19)), - 'monthly': ((250, 0.00, 0.00), (1500, 3.10, 0.00), (2750, 5.25, 38.75), ('inf', 5.70, 104.38)), - 'quarterly': ((750, 0.00, 0.00), (4500, 3.10, 0.00), (8250, 5.25, 116.25), ('inf', 5.70, 313.13)), - 'semi-annual': ((1500, 0.00, 0.00), (9000, 3.10, 0.00), (16500, 5.25, 232.50), ('inf', 5.70, 626.25)), - 'annually': ((3000, 0.00, 0.00), (18000, 3.10, 0.00), (33000, 5.25, 465.00), ('inf', 5.70, 1252.50)), + 'weekly': ( + ( 58, 0.00, 0.00), + ( 346, 3.10, 0.00), + ( 635, 5.25, 8.94), + ('inf', 5.70, 24.09), + ), + 'bi-weekly': ( + ( 115, 0.00, 0.00), + ( 692, 3.10, 0.00), + ( 1269, 5.25, 17.88), + ('inf', 5.70, 48.17), + ), + 'semi-monthly': ( + ( 125, 0.00, 0.00), + ( 750, 3.10, 0.00), + ( 1375, 5.25, 19.38), + ('inf', 5.70, 52.19), + ), + 'monthly': ( + ( 250, 0.00, 0.00), + ( 1500, 3.10, 0.00), + ( 2750, 5.25, 38.75), + ('inf', 5.70, 104.38), + ), + 'quarterly': ( + ( 750, 0.00, 0.00), + ( 4500, 3.10, 0.00), + (8250, 5.25, 116.25), + ('inf', 5.70, 313.13), + ), + 'semi-annual': ( + ( 1500, 0.00, 0.00), + ( 9000, 3.10, 0.00), + (16500, 5.25, 232.50), + ('inf', 5.70, 626.25), + ), + 'annually': ( + ( 3000, 0.00, 0.00), + (18000, 3.10, 0.00), + (33000, 5.25, 465.00), + ('inf', 5.70, 1252.50), + ), }, 'married': { - 'weekly': ((144, 0.00, 0.00), (721, 3.10, 0.00), (1298, 5.25, 17.88), ('inf', 5.70, 48.17)), - 'bi-weekly': ((288, 0.00, 0.00), (1442, 3.10, 0.00), (2596, 5.25, 35.77), ('inf', 5.70, 96.35)), - 'semi-monthly': ((313, 0.00, 0.00), (1563, 3.10, 0.00), (2813, 5.25, 38.75), ('inf', 5.70, 104.38)), - 'monthly': ((625, 0.00, 0.00), (3125, 3.10, 0.00), (5625, 5.25, 77.50), ('inf', 5.70, 208.75)), - 'quarterly': ((1875, 0.00, 0.00), (9375, 3.10, 0.00), (16875, 5.25, 232.50), ('inf', 5.70, 626.25)), - 'semi-annual': ((3750, 0.00, 0.00), (18750, 3.10, 0.00), (33750, 5.25, 465.00), ('inf', 5.70, 1252.50)), - 'annually': ((7500, 0.00, 0.00), (37500, 3.10, 0.00), (67500, 5.25, 930.00), ('inf', 5.70, 2505.00)), - }, - 'head_household': { - 'weekly': ((58, 0.00, 0.00), (346, 3.10, 0.00), (635, 5.25, 8.94), ('inf', 5.70, 24.09)), - 'bi-weekly': ((115, 0.00, 0.00), (692, 3.10, 0.00), (1269, 5.25, 17.88), ('inf', 5.70, 48.17)), - 'semi-monthly': ((125, 0.00, 0.00), (750, 3.10, 0.00), (1375, 5.25, 19.38), ('inf', 5.70, 52.19)), - 'monthly': ((250, 0.00, 0.00), (1500, 3.10, 0.00), (2750, 5.25, 38.75), ('inf', 5.70, 104.38)), - 'quarterly': ((750, 0.00, 0.00), (4500, 3.10, 0.00), (8250, 5.25, 116.25), ('inf', 5.70, 313.13)), - 'semi-annual': ((1500, 0.00, 0.00), (9000, 3.10, 0.00), (16500, 5.25, 232.50), ('inf', 5.70, 626.25)), - 'annually': ((3000, 0.00, 0.00), (18000, 3.10, 0.00), (33000, 5.25, 465.00), ('inf', 5.70, 1252.50)), + 'weekly': ( + ( 144, 0.00, 0.00), + ( 721, 3.10, 0.00), + (1298, 5.25, 17.88), + ('inf', 5.70, 48.17), + ), + 'bi-weekly': ( + ( 288, 0.00, 0.00), + ( 1442, 3.10, 0.00), + ( 2596, 5.25, 35.77), + ('inf', 5.70, 96.35), + ), + 'semi-monthly': ( + ( 313, 0.00, 0.00), + ( 1563, 3.10, 0.00), + ( 2813, 5.25, 38.75), + ('inf', 5.70, 104.38), + ), + 'monthly': ( + ( 625, 0.00, 0.00), + ( 3125, 3.10, 0.00), + ( 5625, 5.25, 77.50), + ('inf', 5.70, 208.75), + ), + 'quarterly': ( + ( 1875, 0.00, 0.00), + ( 9375, 3.10, 0.00), + (16875, 5.25, 232.50), + ('inf', 5.70, 626.25), + ), + 'semi-annual': ( + ( 3750, 0.00, 0.00), + (18750, 3.10, 0.00), + (33750, 5.25, 465.00), + ('inf', 5.70, 1252.50), + ), + 'annually': ( + ( 7500, 0.00, 0.00), + (37500, 3.10, 0.00), + (67500, 5.25, 930.00), + ('inf', 5.70, 2505.00), + ), }, } diff --git a/l10n_us_hr_payroll/models/us_payroll_config.py b/l10n_us_hr_payroll/models/us_payroll_config.py index 8741d81d..2707a4b7 100644 --- a/l10n_us_hr_payroll/models/us_payroll_config.py +++ b/l10n_us_hr_payroll/models/us_payroll_config.py @@ -129,8 +129,7 @@ class HRContractUSPayrollConfig(models.Model): ks_k4_sit_filing_status = fields.Selection([ ('single', 'Single'), - ('married', 'Married'), - ('head of household', 'Head of Household'), + ('married', 'Joint'), ], string='Kansas K-4 Filing Status', help='KS K-4 3.') ks_k4_sit_allowances = fields.Integer(string='Kansas KS K-4 Number of Allowances', help='KS K-4 Step 4.') diff --git a/l10n_us_hr_payroll/tests/test_us_ks_kansas_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_ks_kansas_payslip_2020.py index 61416613..3ed586f8 100755 --- a/l10n_us_hr_payroll/tests/test_us_ks_kansas_payslip_2020.py +++ b/l10n_us_hr_payroll/tests/test_us_ks_kansas_payslip_2020.py @@ -26,10 +26,11 @@ class TestUsKSPayslip(TestUsPayslip): cats = self._getCategories(payslip) self._log('Computed period tax: ' + str(expected_withholding)) - self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding) + self.assertPayrollAlmostEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding) def test_2020_taxes_example(self): self._test_er_suta('KS', self.KS_UNEMP, date(2020, 1, 1), wage_base=self.KS_UNEMP_MAX_WAGE) - self._test_sit(625, 'married', 2, 0, 'semi-monthly', date(2020, 1, 1), 4.00) - # self._test_sit(1500, 'single', 0, 0, 'bi-weekly', date(2020, 1, 1), 69.90) - # self._test_sit(1500, 'single', 0, 0, 'bi-weekly', date(2020, 1, 1), 79.90) + self._test_sit(6250, 'married', 2, 0, 'semi-monthly', date(2020, 1, 1), 290.00) + self._test_sit(5000, 'single', 1, 0, 'monthly', date(2020, 1, 1), 222.00) + self._test_sit(1500, 'married', 0, 0, 'bi-weekly', date(2020, 1, 1), 39.00) + self._test_sit(750, 'single', 2, 10, 'weekly', date(2020, 1, 1), 36.00) 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 022326ea..d9f83626 100644 --- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml +++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml @@ -127,7 +127,7 @@

Form KS K-4 - State Income Tax

- +