IMP l10n_us_hr_payroll Port l10n_us_ms_hr_payroll MS Mississippi including migration

This commit is contained in:
Jared Kipe
2020-01-09 13:23:34 -08:00
parent 865080c9da
commit b2e610c746
11 changed files with 421 additions and 0 deletions

View File

@@ -30,6 +30,7 @@ USA Payroll Rules.
'data/federal/fed_941_fit_rules.xml',
'data/state/fl_florida.xml',
'data/state/ga_georgia.xml',
'data/state/ms_mississippi.xml',
'data/state/mt_montana.xml',
'data/state/oh_ohio.xml',
'data/state/pa_pennsylvania.xml',

View File

@@ -21,6 +21,9 @@
ref('hr_payroll_rule_er_us_ga_suta'),
ref('hr_payroll_rule_ee_us_ga_sit'),
ref('hr_payroll_rule_er_us_ms_suta'),
ref('hr_payroll_rule_ee_us_ms_sit'),
ref('hr_payroll_rule_er_us_mt_suta'),
ref('hr_payroll_rule_er_us_mt_suta_aft'),
ref('hr_payroll_rule_ee_us_mt_sit'),

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- Wage Base -->
<data noupdate="1">
<record id="rule_parameter_us_ms_suta_wage_base_2019" model="hr.payroll.rate">
<field name="name">US MS Mississippi SUTA Wage Base</field>
<field name="code">us_ms_suta_wage_base</field>
<field name="parameter_value">14000.0</field>
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
</record>
<record id="rule_parameter_us_ms_suta_wage_base_2020" model="hr.payroll.rate">
<field name="name">US MS Mississippi SUTA Wage Base</field>
<field name="code">us_ms_suta_wage_base</field>
<field name="parameter_value">14000.0</field>
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
</record>
</data>
<!-- Rate -->
<data noupdate="1">
<record id="rule_parameter_us_ms_suta_rate_2019" model="hr.payroll.rate">
<field name="name">US MS Mississippi SUTA Rate</field>
<field name="code">us_ms_suta_rate</field>
<field name="parameter_value">1.2</field>
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
</record>
<record id="rule_parameter_us_ms_suta_rate_2020" model="hr.payroll.rate">
<field name="name">US MS Mississippi SUTA Rate</field>
<field name="code">us_ms_suta_rate</field>
<field name="parameter_value">1.2</field>
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
</record>
</data>
<data noupdate="1">
<record id="rule_parameter_us_ms_sit_rate_2019" model="hr.payroll.rate">
<field name="name">US MS Mississippi SIT Rate Table</field>
<field name="code">us_ms_sit_rate</field>
<field name="parameter_value">[
( 10000.00, 290.0, 0.05),
( 5000.00, 90.0, 0.04),
( 2000.00, 0.0, 0.03),
]</field>
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
</record>
<record id="rule_parameter_us_ms_sit_rate_2020" model="hr.payroll.rate">
<field name="name">US MS Mississippi SIT Rate Table</field>
<field name="code">us_ms_sit_rate</field>
<field name="parameter_value">[
( 10000.00, 260.0, 0.05),
( 5000.00, 60.0, 0.04),
( 3000.00, 0.0, 0.03),
]</field>
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
</record>
</data>
<data noupdate="1">
<record id="rule_parameter_us_ms_sit_deduction_2019" model="hr.payroll.rate">
<field name="name">US MS Mississippi SIT Deduction</field>
<field name="code">us_ms_sit_deduction</field>
<field name="parameter_value">{
'single': 2300.0,
'head_of_household': 3400.0,
'married_dual': 2300.0,
'married': 4600.0,
}</field>
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
</record>
</data>
<!-- Partners and Contribution Registers -->
<record id="res_partner_us_ms_dor" model="res.partner">
<field name="name">US Mississippi - Department of Employment Security (Unemployment)</field>
</record>
<record id="contrib_register_us_ms_dor" model="hr.contribution.register">
<field name="name">US Mississippi - Department of Employment Security (Unemployment)</field>
<field name="partner_id" ref="res_partner_us_ms_dor"/>
</record>
<record id="res_partner_us_ms_dor_sit" model="res.partner">
<field name="name">US Mississippi - Mississippi Department of Revenue (Income Tax)</field>
</record>
<record id="contrib_register_us_ms_dor_sit" model="hr.contribution.register">
<field name="name">US Mississippi - Mississippi Department of Revenue (Income Tax)</field>
<field name="partner_id" ref="res_partner_us_ms_dor_sit"/>
</record>
<!-- Categories -->
<!-- Rules -->
<record id="hr_payroll_rule_er_us_ms_suta" model="hr.salary.rule">
<field name="sequence" eval="450"/>
<field name="category_id" ref="hr_payroll_category_er_us_suta"/>
<field name="name">ER: US MS Mississippi State Unemployment</field>
<field name="code">ER_US_MS_SUTA</field>
<field name="condition_select">python</field>
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ms_suta_wage_base', rate='us_ms_suta_rate', state_code='MS')</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ms_suta_wage_base', rate='us_ms_suta_rate', state_code='MS')</field>
<field name="register_id" ref="contrib_register_us_ms_dor"/>
<field name="appears_on_payslip" eval="False"/>
</record>
<record id="hr_payroll_rule_ee_us_ms_sit" model="hr.salary.rule">
<field name="sequence" eval="195"/>
<field name="category_id" ref="hr_payroll_category_ee_us_sit"/>
<field name="name">EE: US MS Mississippi State Income Tax Withholding</field>
<field name="code">EE_US_MS_SIT</field>
<field name="condition_select">python</field>
<field name="condition_python">result, _ = ms_mississippi_state_income_withholding(payslip, categories, worked_days, inputs)</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result, result_rate = ms_mississippi_state_income_withholding(payslip, categories, worked_days, inputs)</field>
<field name="register_id" ref="contrib_register_us_ms_dor_sit"/>
<field name="appears_on_payslip" eval="True"/>
</record>
</odoo>

View File

@@ -14,6 +14,10 @@ FIELDS_CONTRACT_TO_US_PAYROLL_FORMS_2020 = {
'ga_g4_additional_allowances': 'ga_g4_sit_additional_allowances',
'ga_g4_additional_wh': 'state_income_tax_additional_withholding',
'ms_89_350_filing_status': 'ms_89_350_sit_filing_status',
'ms_89_350_exemption': 'ms_89_350_sit_exemption_value',
'ms_89_350_additional_withholding': 'state_income_tax_additional_withholding',
'mt_mw4_additional_withholding': 'state_income_tax_additional_withholding',
'mt_mw4_exemptions': 'mt_mw4_sit_exemptions',
'mt_mw4_exempt': 'mt_mw4_sit_exempt',
@@ -53,6 +57,11 @@ XMLIDS_TO_REMOVE_2020 = [
'l10n_us_ga_hr_payroll.hr_payroll_ga_income_withhold',
'l10n_us_ga_hr_payroll.hr_payroll_rules_ga_unemp_wages',
'l10n_us_ms_hr_payroll.hr_payroll_ms_unemp_wages',
'l10n_us_ms_hr_payroll.hr_payroll_ms_unemp',
'l10n_us_ms_hr_payroll.hr_payroll_ms_income_withhold',
'l10n_us_ms_hr_payroll.hr_payroll_rules_ms_unemp_wages',
'l10n_us_mt_hr_payroll.hr_payroll_mt_unemp_wages',
'l10n_us_mt_hr_payroll.hr_payroll_mt_unemp',
'l10n_us_mt_hr_payroll.hr_payroll_mt_income_withhold',
@@ -117,6 +126,13 @@ XMLIDS_TO_RENAME_2020 = {
'l10n_us_ga_hr_payroll.hr_payroll_rules_ga_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_ga_suta',
'l10n_us_ga_hr_payroll.hr_payroll_rules_ga_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_ga_sit',
'l10n_us_ms_hr_payroll.res_partner_msdor_unemp': 'l10n_us_hr_payroll.res_partner_us_ms_dor',
'l10n_us_ms_hr_payroll.res_partner_msdor_withhold': 'l10n_us_hr_payroll.res_partner_us_ms_dor_sit',
'l10n_us_ms_hr_payroll.contrib_register_msdor_unemp': 'l10n_us_hr_payroll.contrib_register_us_ms_dor',
'l10n_us_ms_hr_payroll.contrib_register_msdor_withhold': 'l10n_us_hr_payroll.contrib_register_us_ms_dor_sit',
'l10n_us_ms_hr_payroll.hr_payroll_rules_ms_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_ms_suta',
'l10n_us_ms_hr_payroll.hr_payroll_rules_ms_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_ms_sit',
'l10n_us_mt_hr_payroll.res_partner_mtdor_unemp': 'l10n_us_hr_payroll.res_partner_us_mt_dor',
'l10n_us_mt_hr_payroll.res_partner_mtdor_withhold': 'l10n_us_hr_payroll.res_partner_us_mt_dor_sit',
'l10n_us_mt_hr_payroll.contrib_register_mtdor_unemp': 'l10n_us_hr_payroll.contrib_register_us_mt_dor',

View File

@@ -15,6 +15,7 @@ from .state.general import general_state_unemployment, \
general_state_income_withholding, \
is_us_state
from .state.ga_georgia import ga_georgia_state_income_withholding
from .state.ms_mississippi import ms_mississippi_state_income_withholding
from .state.mt_montana import mt_montana_state_income_withholding
from .state.oh_ohio import oh_ohio_state_income_withholding
from .state.va_virginia import va_virginia_state_income_withholding
@@ -53,6 +54,7 @@ class HRPayslip(models.Model):
'general_state_income_withholding': general_state_income_withholding,
'is_us_state': is_us_state,
'ga_georgia_state_income_withholding': ga_georgia_state_income_withholding,
'ms_mississippi_state_income_withholding': ms_mississippi_state_income_withholding,
'mt_montana_state_income_withholding': mt_montana_state_income_withholding,
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
'va_virginia_state_income_withholding': va_virginia_state_income_withholding,

View File

@@ -0,0 +1,46 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from .general import _state_applies
def ms_mississippi_state_income_withholding(payslip, categories, worked_days, inputs):
"""
Returns SIT eligible wage and rate.
WAGE = GROSS - WAGE_US_941_FIT_EXEMPT
:return: result, result_rate (wage, percent)
"""
state_code = 'MS'
if not _state_applies(payslip, state_code):
return 0.0, 0.0
filing_status = payslip.dict.contract_id.us_payroll_config_value('ms_89_350_sit_filing_status')
if not filing_status:
return 0.0, 0.0
# Determine Wage
wage = categories.GROSS - categories.WAGE_US_941_FIT_EXEMPT
if wage == 0.0:
return 0.0, 0.0
pay_periods = payslip.dict.get_pay_periods_in_year()
additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
exemptions = payslip.dict.contract_id.us_payroll_config_value('ms_89_350_sit_exemption_value')
standard_deduction = payslip.dict.rule_parameter('us_ms_sit_deduction').get(filing_status)
withholding_rate = payslip.dict.rule_parameter('us_ms_sit_rate')
wage_annual = wage * pay_periods
taxable_income = wage_annual - (exemptions + standard_deduction)
if taxable_income <= 0.01:
return wage, 0.0
withholding = 0.0
for row in withholding_rate:
wage_base, base, rate = row
if taxable_income >= wage_base:
withholding = base + ((taxable_income - wage_base) * rate)
break
withholding /= pay_periods
withholding = round(withholding)
withholding += round(additional)
return wage, -((withholding / wage) * 100.0)

View File

@@ -64,6 +64,16 @@ class HRContractUSPayrollConfig(models.Model):
ga_g4_sit_additional_allowances = fields.Integer(string='Georgia G-4 Additional Allowances',
help='G-4 5.')
ms_89_350_sit_filing_status = fields.Selection([
('', 'Exempt'),
('single', 'Single'),
('married', 'Married (spouse NOT employed)'),
('married_dual', 'Married (spouse IS employed)'),
('head_of_household', 'Head of Household'),
], string='Mississippi 89-350 Filing Status', help='89-350 1. 2. 3. 8.')
ms_89_350_sit_exemption_value = fields.Float(string='Mississippi 89-350 Exemption Total',
help='89-350 Box 6 (including filing status amounts)')
mt_mw4_sit_exemptions = fields.Integer(string='Montana MW-4 Exemptions',
help='MW-4 Box G')
# Don't use the main state_income_tax_exempt because of special meaning and reporting

View File

@@ -10,6 +10,9 @@ from . import test_us_fl_florida_payslip_2020
from . import test_us_ga_georgia_payslip_2019
from . import test_us_ga_georgia_payslip_2020
from . import test_us_ms_mississippi_payslip_2019
from . import test_us_ms_mississippi_payslip_2020
from . import test_us_mt_montana_payslip_2019
from . import test_us_mt_montana_payslip_2020

View File

@@ -0,0 +1,94 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from .common import TestUsPayslip
class TestUsMsPayslip(TestUsPayslip):
# Calculations from https://www.dor.ms.gov/Documents/Computer%20Payroll%20Accounting%201-2-19.pdf
MS_UNEMP = -1.2 / 100.0
def test_2019_taxes_one(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='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('2019 Mississippi 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.MS_UNEMP)
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) + 290 # Over 10,000
self.assertPayrollEqual(TAX, 570.0)
ms_withhold = round(TAX / 24) # Semi-Monthly
self.assertPayrollEqual(cats['EE_US_SIT'], -ms_withhold)
def test_2019_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('2019 Mississippi 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_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='head_of_household',
ms_89_350_sit_exemption_value=ms_89_350_exemption,
state_income_tax_additional_withholding=additional,
schedule_pay='semi-monthly')
self._log('2019 Mississippi 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.MS_UNEMP)
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) + 290 # Over 10,000
self.assertPayrollEqual(TAX, 570.0)
ms_withhold = round(TAX / 24) # Semi-Monthly
self.assertPayrollEqual(cats['EE_US_SIT'], -ms_withhold + -additional)

View File

@@ -0,0 +1,120 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from datetime import date
from .common import TestUsPayslip
class TestUsMsPayslip(TestUsPayslip):
# Calculations from https://www.dor.ms.gov/Documents/Computer%20Payroll%20Accounting%201-2-19.pdf
MS_UNEMP = 1.2
MS_UNEMP_MAX_WAGE = 14000.0
def test_2020_taxes_one(self):
self._test_er_suta('MS', self.MS_UNEMP, date(2020, 1, 1), wage_base=self.MS_UNEMP_MAX_WAGE)
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))

View File

@@ -55,6 +55,12 @@
<field name="state_income_tax_additional_withholding" string="Additional Withholding 6."/>
<field name="state_income_tax_exempt" string="Exempt 8."/>
</group>
<group name="state_ms_mississippi" string="MS Mississippi" attrs="{'invisible':[('state_id', '!=', %(base.state_us_37)s)]}">
<p colspan="2"><h3>Form 89-350 - State Income Tax</h3></p>
<field name="ms_89_350_sit_filing_status" string="Marital Status 1. 2. 3. 8."/>
<field name="ms_89_350_sit_exemption_value" string="Exemptions (Total) 6."/>
<field name="state_income_tax_additional_withholding" string="Additional Withholding 7."/>
</group>
<group name="state_mt_montana" string="MT Montana" attrs="{'invisible':[('state_id', '!=', %(base.state_us_21)s)]}">
<p colspan="2"><h3>Form MT-4 - State Income Tax</h3></p>
<field name="mt_mw4_sit_exempt" string="Exempt"/>