[IMP] l10n_us_hr_payroll: For West Virginia 13.0

This commit is contained in:
Bhoomi Vaishnani
2020-05-28 15:08:30 -04:00
parent f9a7107740
commit f4916a0af5
8 changed files with 224 additions and 1 deletions

View File

@@ -69,6 +69,7 @@ United States of America - Payroll Rules.
'data/state/va_virginia.xml',
'data/state/wa_washington.xml',
'data/state/wi_wisconsin.xml',
'data/state/wv_west_virginia.xml',
'data/state/wy_wyoming.xml',
'views/hr_contract_views.xml',
'views/us_payroll_config_views.xml',

View File

@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- Wage Base -->
<record id="rule_parameter_us_wv_suta_wage_base" model="hr.rule.parameter">
<field name="name">US WV West Virginia SUTA Wage Base</field>
<field name="code">us_wv_suta_wage_base</field>
<field name="country_id" ref="base.us"/>
</record>
<data noupdate="1">
<record id="rule_parameter_us_wv_suta_wage_base_2020" model="hr.rule.parameter.value">
<field name="parameter_value">12000.0</field>
<field name="rule_parameter_id" ref="rule_parameter_us_wv_suta_wage_base"/>
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
</record>
</data>
<!-- Rate -->
<record id="rule_parameter_us_wv_suta_rate" model="hr.rule.parameter">
<field name="name">US WV West Virginia SUTA Rate</field>
<field name="code">us_wv_suta_rate</field>
<field name="country_id" ref="base.us"/>
</record>
<data noupdate="1">
<record id="rule_parameter_us_wv_suta_rate_2020" model="hr.rule.parameter.value">
<field name="parameter_value">2.7</field>
<field name="rule_parameter_id" ref="rule_parameter_us_wv_suta_rate"/>
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
</record>
</data>
<record id="rule_parameter_us_wv_sit_exemption_rate" model="hr.rule.parameter">
<field name="name">US WV West Virginia Exemption Rate</field>
<field name="code">us_wv_sit_exemption_rate</field>
<field name="country_id" ref="base.us"/>
</record>
<data noupdate="1">
<record id="rule_parameter_us_wv_sit_exemption_rate_2020" model="hr.rule.parameter.value">
<field name="parameter_value">{
'weekly' : 38.46,
'bi-weekly' : 76.92,
'semi-monthly': 83.33,
'monthly' : 166.67,
'annually': 2000.00,
}</field>
<field name="rule_parameter_id" ref="rule_parameter_us_wv_sit_exemption_rate"/>
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
</record>
</data>
<record id="rule_parameter_us_wv_sit_tax_rate" model="hr.rule.parameter">
<field name="name">US WV West Virginia SIT Tax Rate</field>
<field name="code">us_wv_sit_tax_rate</field>
<field name="country_id" ref="base.us"/>
</record>
<data noupdate="1">
<record id="rule_parameter_us_wv_sit_tax_rate_2020" model="hr.rule.parameter.value">
<field name="parameter_value">{
'single': {
'weekly':((192, 0.00, 3.0), (481, 5.76, 4.0), (769, 17.32, 4.5), (1154, 30.28, 6.0), ('inf', 53.38, 6.5)),
'bi-weekly':((385, 0.00, 3.0), (962, 11.55, 4.0), (1538, 34.63, 4.5), (2308, 60.55, 6.0), ('inf', 106.75, 6.5)),
'semi-monthly':((417, 0.00, 3.0), (1042, 12.51, 4.0), (1667, 37.51, 4.5), (2500, 65.64, 6.0), ('inf', 115.62, 6.5)),
'monthly':((833, 0.00, 3.0), (2083, 24.99, 4.0), (3333, 74.99, 4.5), (5000, 131.24, 6.0), ('inf', 231.26, 6.5)),
'annually':((10000, 0.00, 3.0), (25000, 300.00, 4.0), (40000, 900.00, 4.5), (60000, 1575.00, 6.0), ('inf', 2775.00, 6.5)),
},
'married': {
'weekly':((115, 0.00, 3.0), (288, 3.45, 4.0), (462, 10.37, 4.5), (692, 18.20, 6.0), ('inf', 32.00, 6.5)),
'bi-weekly':((231, 0.00, 3.0), (577, 6.93, 4.0), (923, 20.77, 4.5), (1385, 36.34, 6.0), ('inf', 64.06, 6.5)),
'semi-monthly':((250, 0.00, 3.0), (625, 7.50, 4.0), (1000, 22.50, 4.5), (1500, 39.38, 6.0), ('inf', 69.38, 6.5)),
'monthly':((500, 0.00, 3.0), (1250, 15.00, 4.0), (2000, 45.00, 4.5), (3000, 78.75, 6.0), ('inf', 138.75, 6.5)),
'annually':((6000, 0.00, 3.0), (15000, 180.00, 4.0), (24000, 540.00, 4.5), (36000, 945.00, 6.0), ('inf', 1665.00, 6.5)),
},
'head_household': {
'weekly':((192, 0.00, 3.0), (481, 5.76, 4.0), (769, 17.32, 4.5), (1154, 30.28, 6.0), ('inf', 53.38, 6.5)),
'bi-weekly':((385, 0.00, 3.0), (962, 11.55, 4.0), (1538, 34.63, 4.5), (2308, 60.55, 6.0), ('inf', 106.75, 6.5)),
'semi-monthly':((417, 0.00, 3.0), (1042, 12.51, 4.0), (1667, 37.51, 4.5), (2500, 65.64, 6.0), ('inf', 115.62, 6.5)),
'monthly':((833, 0.00, 3.0), (2083, 24.99, 4.0), (3333, 74.99, 4.5), (5000, 131.24, 6.0), ('inf', 231.26, 6.5)),
'annually':((10000, 0.00, 3.0), (25000, 300.00, 4.0), (40000, 900.00, 4.5), (60000, 1575.00, 6.0), ('inf', 2775.00, 6.5)),
},
}</field>
<field name="rule_parameter_id" ref="rule_parameter_us_wv_sit_tax_rate"/>
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
</record>
</data>
<!-- Partners and Contribution Registers -->
<record id="res_partner_us_wv_dor" model="res.partner">
<field name="name">US West Virginia - WorkForce - Unemployment Tax</field>
</record>
<record id="res_partner_us_wv_dor_sit" model="res.partner">
<field name="name">US West Virginia - Department of Revenue - Income Tax</field>
</record>
<!-- Categories -->
<!-- Rules -->
<record id="hr_payroll_rule_er_us_wv_suta" model="hr.salary.rule">
<field name="sequence" eval="450"/>
<field name="struct_id" ref="hr_payroll_structure"/>
<field name="category_id" ref="hr_payroll_category_er_us_suta"/>
<field name="name">ER: US WV West Virginia State Unemployment</field>
<field name="code">ER_US_WV_SUTA</field>
<field name="condition_select">python</field>
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_wv_suta_wage_base', rate='us_wv_suta_rate', state_code='WV')</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_wv_suta_wage_base', rate='us_wv_suta_rate', state_code='WV')</field>
<field name="partner_id" ref="res_partner_us_wv_dor"/>
<field name="appears_on_payslip" eval="False"/>
</record>
<record id="hr_payroll_rule_ee_us_wv_sit" model="hr.salary.rule">
<field name="sequence" eval="195"/>
<field name="struct_id" ref="hr_payroll_structure"/>
<field name="category_id" ref="hr_payroll_category_ee_us_sit"/>
<field name="name">EE: US WV West Virginia State Income Tax Withholding</field>
<field name="code">EE_US_WV_SIT</field>
<field name="condition_select">python</field>
<field name="condition_python">result, _ = wv_west_virginia_state_income_withholding(payslip, categories, worked_days, inputs)</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result, result_rate = wv_west_virginia_state_income_withholding(payslip, categories, worked_days, inputs)</field>
<field name="partner_id" ref="res_partner_us_wv_dor_sit"/>
<field name="appears_on_payslip" eval="True"/>
</record>
</odoo>

View File

@@ -49,6 +49,7 @@ from .state.va_virginia import va_virginia_state_income_withholding
from .state.wa_washington import wa_washington_fml_er, \
wa_washington_fml_ee
from .state.wi_wisconsin import wi_wisconsin_state_income_withholding
from .state.wv_west_virginia import wv_west_virginia_state_income_withholding
class HRPayslip(models.Model):
@@ -117,6 +118,7 @@ class HRPayslip(models.Model):
'wa_washington_fml_er': wa_washington_fml_er,
'wa_washington_fml_ee': wa_washington_fml_ee,
'wi_wisconsin_state_income_withholding': wi_wisconsin_state_income_withholding,
'wv_west_virginia_state_income_withholding': wv_west_virginia_state_income_withholding,
})
return res

View File

@@ -0,0 +1,44 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from .general import _state_applies, sit_wage
def wv_west_virginia_state_income_withholding(payslip, categories, worked_days, inputs):
"""
Returns SIT eligible wage and rate.
:return: result, result_rate (wage, percent)
"""
state_code = 'WV'
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('wv_it104_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')
exemptions = payslip.contract_id.us_payroll_config_value('wv_it104_sit_exemptions')
exemption_amt = payslip.rule_parameter('us_wv_sit_exemption_rate')[schedule_pay]
tax_table = payslip.rule_parameter('us_wv_sit_tax_rate')[filing_status].get(schedule_pay)
taxable_income = wage - (exemptions * exemption_amt)
withholding = 0.0
last = 0.0
for row in tax_table:
amt, flat_fee, rate = row
if taxable_income <= float(amt):
withholding = ((taxable_income - last) * (rate / 100)) + flat_fee
break
last = amt
withholding = max(withholding, 0.0)
withholding += additional
withholding = round(withholding)
return wage, -((withholding / wage) * 100.0)

View File

@@ -266,4 +266,11 @@ class HRContractUSPayrollConfig(models.Model):
('single', 'Single'),
('married', 'Married'),
], string='Wisconsin WT-4 Filing Status', help='WI WT-4')
wi_wt4_sit_exemptions = fields.Integer(string='Wisconsin Exemptions', help='WI WT-4 1.(d)')
wi_wt4_sit_exemptions = fields.Integer(string='Wisconsin Exemptions', help='WI WT-4 1.(d)')
wv_it104_sit_filing_status = fields.Selection([
('single', 'Single'),
('married', 'Married'),
('head_household', 'Head of Household')
], string='West Virginia WV/IT-104 Filing Status', help='WV WV/IT-104')
wv_it104_sit_exemptions = fields.Integer(string='West Virginia Exemptions', help='WV WV/IT-104 4.')

View File

@@ -117,6 +117,8 @@ from . import test_us_va_virginia_payslip_2020
from . import test_us_wa_washington_payslip_2019
from . import test_us_wa_washington_payslip_2020
from . import test_us_wv_west_virginia_payslip_2020
from . import test_us_wi_wisconsin_payslip_2020
from . import test_us_wy_wyoming_payslip_2019

View File

@@ -0,0 +1,36 @@
# 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 TestUsWVPayslip(TestUsPayslip):
###
# 2020 Taxes and Rates
###
WV_UNEMP_MAX_WAGE = 12000.0
WV_UNEMP = 2.7
# Calculation based on example https://tax.wv.gov/Documents/TaxForms/it100.1a.pdf
def _test_sit(self, wage, filing_status, exemption, additional_withholding, schedule_pay, date_start, expected_withholding):
employee = self._createEmployee()
contract = self._createContract(employee,
wage=wage,
state_id=self.get_us_state('WV'),
wv_it104_sit_filing_status=filing_status,
wv_it104_sit_exemptions=exemption,
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('WV', self.WV_UNEMP, date(2020, 1, 1), wage_base=self.WV_UNEMP_MAX_WAGE)
self._test_sit(1250, 'married', 2, 0, 'semi-monthly', date(2020, 1, 1), 44.00)
self._test_sit(1300, 'single', 1, 0, 'bi-weekly', date(2020, 1, 1), 46.00)
self._test_sit(1300, 'single', 1, 10, 'bi-weekly', date(2020, 1, 1), 56.00)
self._test_sit(15000, 'single', 2, 0, 'monthly', date(2020, 1, 1), 860.00)

View File

@@ -274,6 +274,12 @@
<p colspan="2"><h3>No additional fields.</h3></p>
<p colspan="2">Ensure that your Employee and Employer workers' comp code fields are filled in for WA LNI withholding.</p>
</group>
<group name="state_wv_west_virginia" string="WV West Virginia" attrs="{'invisible':[('state_id', '!=', %(base.state_us_49)s)]}">
<p colspan="2"><h3>Form WV/IT-104 - State Income Tax</h3></p>
<field name="wv_it104_sit_filing_status" string="Filing Status"/>
<field name="wv_it104_sit_exemptions" string="Exemptions 4."/>
<field name="state_income_tax_additional_withholding" string="Additional Withholding 6."/>
</group>
<group name="state_wi_wisconsin" string="WI Wisconsin" attrs="{'invisible':[('state_id', '!=', %(base.state_us_50)s)]}">
<p colspan="2"><h3>Form WT-4 - State Income Tax</h3></p>
<field name="wi_wt4_sit_filing_status" string="Filing Status"/>