[IMP] l10n_us_hr_payroll: Added comment and improved Test case for MS Mississippi 2020

This commit is contained in:
Bhoomi Vaishnani
2020-08-24 11:53:41 -04:00
parent 9603b7281b
commit 669acc5589
2 changed files with 37 additions and 108 deletions

View File

@@ -53,6 +53,8 @@
<field name="rule_parameter_id" ref="rule_parameter_us_ms_sit_rate"/>
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
</record>
<!-- https://www.dor.ms.gov/Documents/Computer%20Payroll%20Flowchart.pdf -->
<!-- Table D. -->
<record id="rule_parameter_us_ms_sit_rate_2020" model="hr.rule.parameter.value">
<field name="parameter_value">[
( 10000.00, 260.0, 0.05),
@@ -80,6 +82,18 @@
<field name="rule_parameter_id" ref="rule_parameter_us_ms_sit_deduction"/>
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
</record>
<!-- https://www.dor.ms.gov/Documents/Computer%20Payroll%20Flowchart.pdf -->
<!-- Table C. -->
<record id="rule_parameter_us_ms_sit_deduction_2020" model="hr.rule.parameter.value">
<field name="parameter_value">{
'single': 2300.0,
'head_of_household': 3400.0,
'married_dual': 2300.0,
'married': 4600.0,
}</field>
<field name="rule_parameter_id" ref="rule_parameter_us_ms_sit_deduction"/>
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
</record>
</data>
<!-- Partners and Contribution Registers -->

View File

@@ -1,120 +1,35 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from datetime import date
from datetime import date, timedelta
from .common import TestUsPayslip
class TestUsMsPayslip(TestUsPayslip):
# Calculations from https://www.dor.ms.gov/Documents/Computer%20Payroll%20Accounting%201-2-19.pdf
# Calculations from https://www.dor.ms.gov/Documents/Computer%20Payroll%20Flowchart.pdf
MS_UNEMP = 1.2
MS_UNEMP_MAX_WAGE = 14000.0
def test_2020_taxes_one(self):
def _test_sit(self, wage, filing_status, additional_withholding, exemption, schedule_pay, date_start, expected_withholding):
employee = self._createEmployee()
contract = self._createContract(employee,
wage=wage,
state_id=self.get_us_state('MS'),
ms_89_350_sit_filing_status=filing_status,
state_income_tax_additional_withholding=additional_withholding,
ms_89_350_sit_exemption_value=exemption,
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.assertPayrollAlmostEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
def test_2020_taxes_example(self):
self._test_er_suta('MS', self.MS_UNEMP, date(2020, 1, 1), wage_base=self.MS_UNEMP_MAX_WAGE)
self._test_sit(1250.0, 'head_of_household', 0.0, 11000, 'semi-monthly', date(2020, 1, 1), 22.00)
self._test_sit(500.0, '', 5.0, 0, 'bi-weekly', date(2020, 1, 1), 0.00)
self._test_sit(12000.0, 'single', 0.0, 11000, 'monthly', date(2020, 1, 1), 525.00)
self._test_sit(2500.0, 'married', 5.0, 500, 'bi-weekly', date(2020, 1, 1), 111.00)
salary = 1250.0
ms_89_350_exemption = 11000.0
employee = self._createEmployee()
contract = self._createContract(employee,
wage=salary,
state_id=self.get_us_state('MS'),
ms_89_350_sit_filing_status='head_of_household',
ms_89_350_sit_exemption_value=ms_89_350_exemption,
state_income_tax_additional_withholding=0.0,
schedule_pay='semi-monthly')
self._log('2020 Mississippi tax single first payslip:')
payslip = self._createPayslip(employee, '2020-01-01', '2020-01-31')
payslip.compute_sheet()
cats = self._getCategories(payslip)
STDED = 3400.0 # Head of Household
AGP = salary * 24 # Semi-Monthly
TI = AGP - (ms_89_350_exemption + STDED)
self.assertPayrollEqual(TI, 15600.0)
TAX = ((TI - 10000) * 0.05) + 260 # Over 10,000
self.assertPayrollEqual(TAX, 540.0)
ms_withhold = round(TAX / 24) # Semi-Monthly
self.assertPayrollEqual(cats['EE_US_SIT'], -ms_withhold)
def test_2020_taxes_one_exempt(self):
salary = 1250.0
ms_89_350_exemption = 11000.0
employee = self._createEmployee()
contract = self._createContract(employee,
wage=salary,
state_id=self.get_us_state('MS'),
ms_89_350_sit_filing_status='',
ms_89_350_sit_exemption_value=ms_89_350_exemption,
state_income_tax_additional_withholding=0.0,
schedule_pay='semi-monthly')
self._log('2020 Mississippi tax single first payslip:')
payslip = self._createPayslip(employee, '2020-01-01', '2020-01-31')
payslip.compute_sheet()
cats = self._getCategories(payslip)
self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), 0.0)
def test_2020_taxes_additional(self):
salary = 1250.0
ms_89_350_exemption = 11000.0
additional = 40.0
employee = self._createEmployee()
contract = self._createContract(employee,
wage=salary,
state_id=self.get_us_state('MS'),
ms_89_350_sit_filing_status='single',
ms_89_350_sit_exemption_value=ms_89_350_exemption,
state_income_tax_additional_withholding=additional,
schedule_pay='monthly')
self._log('2020 Mississippi tax single first payslip:')
payslip = self._createPayslip(employee, '2020-01-01', '2020-01-31')
payslip.compute_sheet()
cats = self._getCategories(payslip)
STDED = 2300.0 # Single
AGP = salary * 12 # Monthly
TI = AGP - (ms_89_350_exemption + STDED)
self.assertPayrollEqual(TI, 1700.0)
TAX = ((TI - 3000) * 0.03)
self.assertPayrollEqual(TAX, -39.0)
ms_withhold = round(TAX / 12) # Monthly
self.assertTrue(ms_withhold <= 0.0)
self.assertPayrollEqual(cats['EE_US_SIT'], -40.0) # only additional
# Test with higher wage
salary = 1700.0
employee = self._createEmployee()
contract = self._createContract(employee,
wage=salary,
state_id=self.get_us_state('MS'),
ms_89_350_sit_filing_status='single',
ms_89_350_sit_exemption_value=ms_89_350_exemption,
state_income_tax_additional_withholding=additional,
schedule_pay='monthly')
payslip = self._createPayslip(employee, '2020-01-01', '2020-01-31')
payslip.compute_sheet()
cats = self._getCategories(payslip)
STDED = 2300.0 # Single
AGP = salary * 12 # Monthly
TI = AGP - (ms_89_350_exemption + STDED)
self.assertPayrollEqual(TI, 7100.0)
TAX = ((TI - 5000) * 0.04) + 60.0
self.assertPayrollEqual(TAX, 144.0)
ms_withhold = round(TAX / 12) # Monthly
self.assertPayrollEqual(ms_withhold, 12.0)
self.assertPayrollEqual(cats['EE_US_SIT'], -(ms_withhold + additional))