From d903820f11884e336124f3b00e3ee4ba0c98bcad Mon Sep 17 00:00:00 2001 From: Bhoomi Vaishnani Date: Wed, 20 May 2020 17:12:55 -0400 Subject: [PATCH] [IMP] l10n_us_hr_payroll: For Utah 13.0 --- l10n_us_hr_payroll/__manifest__.py | 1 + l10n_us_hr_payroll/data/state/ut_utah.xml | 157 ++++++++++++++++++ l10n_us_hr_payroll/models/hr_payslip.py | 2 + l10n_us_hr_payroll/models/state/ut_utah.py | 39 +++++ .../models/us_payroll_config.py | 6 + l10n_us_hr_payroll/tests/__init__.py | 2 + .../tests/test_us_us_utah_payslip_2020.py | 37 +++++ .../views/us_payroll_config_views.xml | 5 + 8 files changed, 249 insertions(+) create mode 100644 l10n_us_hr_payroll/data/state/ut_utah.xml create mode 100644 l10n_us_hr_payroll/models/state/ut_utah.py create mode 100755 l10n_us_hr_payroll/tests/test_us_us_utah_payslip_2020.py diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py index 617ec04b..9194230c 100644 --- a/l10n_us_hr_payroll/__manifest__.py +++ b/l10n_us_hr_payroll/__manifest__.py @@ -62,6 +62,7 @@ United States of America - Payroll Rules. 'data/state/pa_pennsylvania.xml', 'data/state/sc_south_carolina.xml', 'data/state/tx_texas.xml', + 'data/state/ut_utah.xml', 'data/state/vt_vermont.xml', 'data/state/va_virginia.xml', 'data/state/wa_washington.xml', diff --git a/l10n_us_hr_payroll/data/state/ut_utah.xml b/l10n_us_hr_payroll/data/state/ut_utah.xml new file mode 100644 index 00000000..f3622248 --- /dev/null +++ b/l10n_us_hr_payroll/data/state/ut_utah.xml @@ -0,0 +1,157 @@ + + + + + US UT Utah SUTA Wage Base + us_ut_suta_wage_base + + + + + 36600.0 + + + + + + + + US UT Utah SUTA Rate + us_ut_suta_rate + + + + + 1.5 + + + + + + + US UT Utah TAX Rate + us_ut_tax_rate + + + + + 0.0495 + + + + + + + US UT Utah Allowances Rate + us_ut_sit_allowances_rate + + + + + { + 'single': { + 'weekly' : 7, + 'bi-weekly' : 14, + 'semi-monthly': 15, + 'monthly' : 30, + 'quarterly' : 90, + 'semi-annual': 180, + 'annually': 360, + }, + 'married': { + 'weekly' : 14, + 'bi-weekly' : 28, + 'semi-monthly': 30, + 'monthly' : 60, + 'quarterly' : 180, + 'semi-annual': 360, + 'annually': 720, + }, + } + + + + + + + US UT Utah SIT Tax Rate + us_ut_sit_tax_rate + + + + + { + 'single': { + 'weekly': ((137, 1.3)), + 'bi-weekly': ((274, 1.3)), + 'semi-monthly': ((297, 1.3)), + 'monthly': ((594, 1.3)), + 'quarterly': ((1782, 1.3)), + 'semi-annual': ((3564, 1.3)), + 'annually': ((7128, 1.3)), + }, + 'married': { + 'weekly': ((274, 1.3)), + 'bi-weekly': (548, 1.3), + 'semi-monthly': ((594, 1.3)), + 'monthly': ((1188, 1.3)), + 'quarterly': ((3564, 1.3)), + 'semi-annual': ((7128, 1.3)), + 'annually': ((14256, 1.3)), + }, + 'head_household': { + 'weekly': ((137, 1.3)), + 'bi-weekly': ((274, 1.3)), + 'semi-monthly': ((297, 1.3)), + 'monthly': ((594, 1.3)), + 'quarterly': ((1782, 1.3)), + 'semi-annual': ((3564, 1.3)), + 'annually': ((7128, 1.3)), + }, + } + + + + + + + + US Utah - Employment Security Commission - Unemployment Tax + + + + US Utah - Tax Commission - Income Tax + + + + + + + + + + ER: US UT Utah State Unemployment + ER_US_UT_SUTA + python + result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ut_suta_wage_base', rate='us_ut_suta_rate', state_code='UT') + code + result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ut_suta_wage_base', rate='us_ut_suta_rate', state_code='UT') + + + + + + + + + EE: US UT Utah State Income Tax Withholding + EE_US_UT_SIT + python + result, _ = ut_utah_state_income_withholding(payslip, categories, worked_days, inputs) + code + result, result_rate = ut_utah_state_income_withholding(payslip, categories, worked_days, inputs) + + + + + \ No newline at end of file diff --git a/l10n_us_hr_payroll/models/hr_payslip.py b/l10n_us_hr_payroll/models/hr_payslip.py index 76bc6637..e8f10cd0 100644 --- a/l10n_us_hr_payroll/models/hr_payslip.py +++ b/l10n_us_hr_payroll/models/hr_payslip.py @@ -43,6 +43,7 @@ from .state.ny_new_york import ny_new_york_state_income_withholding from .state.oh_ohio import oh_ohio_state_income_withholding from .state.ok_oklahoma import ok_oklahoma_state_income_withholding from .state.sc_south_carolina import sc_south_carolina_state_income_withholding +from .state.ut_utah import ut_utah_state_income_withholding from .state.vt_vermont import vt_vermont_state_income_withholding from .state.va_virginia import va_virginia_state_income_withholding from .state.wa_washington import wa_washington_fml_er, \ @@ -109,6 +110,7 @@ class HRPayslip(models.Model): 'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding, 'ok_oklahoma_state_income_withholding': ok_oklahoma_state_income_withholding, 'sc_south_carolina_state_income_withholding': sc_south_carolina_state_income_withholding, + 'ut_utah_state_income_withholding': ut_utah_state_income_withholding, 'vt_vermont_state_income_withholding': vt_vermont_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/ut_utah.py b/l10n_us_hr_payroll/models/state/ut_utah.py new file mode 100644 index 00000000..9e6b26f9 --- /dev/null +++ b/l10n_us_hr_payroll/models/state/ut_utah.py @@ -0,0 +1,39 @@ +# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. + +from .general import _state_applies, sit_wage + + +def ut_utah_state_income_withholding(payslip, categories, worked_days, inputs): + """ + Returns SIT eligible wage and rate. + + :return: result, result_rate (wage, percent) + """ + state_code = 'UT' + 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 + + filing_status = payslip.contract_id.us_payroll_config_value('ut_w4_sit_filing_status') + if not filing_status: + return 0.0, 0.0 + + schedule_pay = payslip.contract_id.schedule_pay + additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding') + tax_rate = payslip.rule_parameter('us_ut_tax_rate') + allowances = payslip.rule_parameter('us_ut_sit_allowances_rate')[filing_status].get(schedule_pay) + tax_table = payslip.rule_parameter('us_ut_sit_tax_rate')[filing_status].get(schedule_pay) + + taxable_income = wage * tax_rate + withholding = 0.0 + amt, rate = tax_table + withholding = taxable_income - (allowances - ((wage - amt) * (rate / 100))) + + withholding = max(withholding, 0.0) + 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 de2e82df..12f6177e 100644 --- a/l10n_us_hr_payroll/models/us_payroll_config.py +++ b/l10n_us_hr_payroll/models/us_payroll_config.py @@ -244,6 +244,12 @@ class HRContractUSPayrollConfig(models.Model): ok_w4_sit_allowances = fields.Integer(string='Oklahoma OK-W-4 Allowances', help='OK-W-4 1.2.3.') sc_w4_sit_allowances = fields.Integer(string='South Carolina SC W-4 Allowances', help='SC W-4 5.') + ut_w4_sit_filing_status = fields.Selection([ + ('single', 'Single'), + ('married', 'Married'), + ('head_household', 'Head of Household') + ], string='Utah UT W-4 Filing Status', help='UT W-4 C.') + vt_w4vt_sit_filing_status = fields.Selection([ ('single', 'Single'), ('married', 'Married'), diff --git a/l10n_us_hr_payroll/tests/__init__.py b/l10n_us_hr_payroll/tests/__init__.py index 1948f1e3..aee2a839 100755 --- a/l10n_us_hr_payroll/tests/__init__.py +++ b/l10n_us_hr_payroll/tests/__init__.py @@ -103,6 +103,8 @@ from . import test_us_sc_south_carolina_payslip_2020 from . import test_us_tx_texas_payslip_2019 from . import test_us_tx_texas_payslip_2020 +from . import test_us_us_utah_payslip_2020 + from . import test_us_vt_vermont_payslip_2020 from . import test_us_va_virginia_payslip_2019 diff --git a/l10n_us_hr_payroll/tests/test_us_us_utah_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_us_utah_payslip_2020.py new file mode 100755 index 00000000..0518fb79 --- /dev/null +++ b/l10n_us_hr_payroll/tests/test_us_us_utah_payslip_2020.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 TestUsUTPayslip(TestUsPayslip): + ### + # 2020 Taxes and Rates + ### + UT_UNEMP_MAX_WAGE = 36600.0 + UT_UNEMP = 1.5 + # Calculation based on example https://src.bna.com/MSO + + def _test_sit(self, wage, filing_status, additional_withholding, schedule_pay, date_start, expected_withholding): + employee = self._createEmployee() + contract = self._createContract(employee, + wage=wage, + state_id=self.get_us_state('UT'), + ut_w4_sit_filing_status=filing_status, + 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('UT', self.UT_UNEMP, date(2020, 1, 1), wage_base=self.UT_UNEMP_MAX_WAGE) + self._test_sit(400, 'single', 0, 'weekly', date(2020, 1, 1), 16.00) + self._test_sit(1000, 'single', 0, 'bi-weekly', date(2020, 1, 1), 45.00) + self._test_sit(855, 'married', 0, 'semi-monthly', date(2020, 1, 1), 16.00) + self._test_sit(2500, 'married', 0, 'monthly', date(2020, 1, 1), 81.00) + self._test_sit(8000, 'single', 0, 'quarterly', date(2020, 1, 1), 387.00) + self._test_sit(8000, 'single', 10, 'quarterly', date(2020, 1, 1), 397.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 21d3b5d0..a012ff3d 100644 --- a/l10n_us_hr_payroll/views/us_payroll_config_views.xml +++ b/l10n_us_hr_payroll/views/us_payroll_config_views.xml @@ -245,6 +245,11 @@

No additional fields.

+ +

Form UT W-4 - State Income Tax

+ + +

Form VT W-4VT - State Income Tax