mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[IMP] l10n_us_hr_payroll: For Rhode Island 13.0
This commit is contained in:
@@ -60,6 +60,7 @@ United States of America - Payroll Rules.
|
|||||||
'data/state/oh_ohio.xml',
|
'data/state/oh_ohio.xml',
|
||||||
'data/state/ok_oklahoma.xml',
|
'data/state/ok_oklahoma.xml',
|
||||||
'data/state/pa_pennsylvania.xml',
|
'data/state/pa_pennsylvania.xml',
|
||||||
|
'data/state/ri_rhode_island.xml',
|
||||||
'data/state/sc_south_carolina.xml',
|
'data/state/sc_south_carolina.xml',
|
||||||
'data/state/sd_south_dakota.xml',
|
'data/state/sd_south_dakota.xml',
|
||||||
'data/state/tn_tennessee.xml',
|
'data/state/tn_tennessee.xml',
|
||||||
|
|||||||
113
l10n_us_hr_payroll/data/state/ri_rhode_island.xml
Normal file
113
l10n_us_hr_payroll/data/state/ri_rhode_island.xml
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<!-- Wage Base -->
|
||||||
|
<record id="rule_parameter_us_ri_suta_wage_base" model="hr.rule.parameter">
|
||||||
|
<field name="name">US RI Rhode Island SUTA Wage Base</field>
|
||||||
|
<field name="code">us_ri_suta_wage_base</field>
|
||||||
|
<field name="country_id" ref="base.us"/>
|
||||||
|
</record>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="rule_parameter_us_ri_suta_wage_base_2020" model="hr.rule.parameter.value">
|
||||||
|
<field name="parameter_value">24000.0</field>
|
||||||
|
<field name="rule_parameter_id" ref="rule_parameter_us_ri_suta_wage_base"/>
|
||||||
|
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<!-- Rate -->
|
||||||
|
<record id="rule_parameter_us_ri_suta_rate" model="hr.rule.parameter">
|
||||||
|
<field name="name">US RI Rhode Island SUTA Rate</field>
|
||||||
|
<field name="code">us_ri_suta_rate</field>
|
||||||
|
<field name="country_id" ref="base.us"/>
|
||||||
|
</record>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="rule_parameter_us_ri_suta_rate_2020" model="hr.rule.parameter.value">
|
||||||
|
<field name="parameter_value">1.3</field>
|
||||||
|
<field name="rule_parameter_id" ref="rule_parameter_us_ri_suta_rate"/>
|
||||||
|
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<record id="rule_parameter_us_ri_sit_exemption_rate" model="hr.rule.parameter">
|
||||||
|
<field name="name">US RI Rhode Island Exemption Rate</field>
|
||||||
|
<field name="code">us_ri_sit_exemption_rate</field>
|
||||||
|
<field name="country_id" ref="base.us"/>
|
||||||
|
</record>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="rule_parameter_us_ri_sit_exemption_rate_2020" model="hr.rule.parameter.value">
|
||||||
|
<field name="parameter_value">{
|
||||||
|
'weekly' : (( 0.00, 19.23), ( 4451.92, 0.00)),
|
||||||
|
'bi-weekly' : (( 0.00, 38.46), ( 8903.85, 0.00)),
|
||||||
|
'semi-monthly': (( 0.00, 41.67), ( 9645.83, 0.00)),
|
||||||
|
'monthly' : (( 0.00, 83.33), ( 19291.67, 0.00)),
|
||||||
|
'quarterly' : (( 0.00, 250.00), ( 57875.00, 0.00)),
|
||||||
|
'semi-annually': (( 0.00, 500.00), ( 115750.00, 0.00)),
|
||||||
|
'annually': (( 0.00, 1000.0), ( 231500.00, 0000)),
|
||||||
|
}</field>
|
||||||
|
<field name="rule_parameter_id" ref="rule_parameter_us_ri_sit_exemption_rate"/>
|
||||||
|
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<record id="rule_parameter_us_ri_sit_tax_rate" model="hr.rule.parameter">
|
||||||
|
<field name="name">US RI Rhode Island SIT Tax Rate</field>
|
||||||
|
<field name="code">us_ri_sit_tax_rate</field>
|
||||||
|
<field name="country_id" ref="base.us"/>
|
||||||
|
</record>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="rule_parameter_us_ri_sit_tax_rate_2020" model="hr.rule.parameter.value">
|
||||||
|
<field name="parameter_value">{
|
||||||
|
'weekly': ((1255, 0.00, 3.75), (2853, 47.06, 4.75), ('inf', 122.97, 5.99)),
|
||||||
|
'bi-weekly': ((2510, 0.00, 3.75), (5706, 94.13, 4.75), ('inf', 245.94, 5.99)),
|
||||||
|
'semi-monthly': ((2719, 0.00, 3.75), (6181, 101.96, 4.75), ('inf', 266.41, 5.99)),
|
||||||
|
'monthly': ((5438, 0.00, 3.75), (12363, 203.93, 4.75), ('inf', 532.87, 5.99)),
|
||||||
|
'quarterly': ((16313, 0.00, 3.75), (37088, 611.74, 4.75), ('inf', 1598.55, 5.99)),
|
||||||
|
'semi-annually': ((32625, 0.00, 3.75), (74175, 1223.44, 4.75), ('inf', 3197.07, 5.99)),
|
||||||
|
'annually': ((65250, 0.00, 3.75), (148350, 2446.88, 4.75), ('inf', 6394.13, 5.99)),
|
||||||
|
}</field>
|
||||||
|
<field name="rule_parameter_id" ref="rule_parameter_us_ri_sit_tax_rate"/>
|
||||||
|
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<!-- Partners and Contribution Registers -->
|
||||||
|
<record id="res_partner_us_ri_dor" model="res.partner">
|
||||||
|
<field name="name">US Rhode Island - Department of Labor and Training - Unemployment Tax</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="res_partner_us_ri_dor_sit" model="res.partner">
|
||||||
|
<field name="name">US Rhode Island - Division of Taxations - Income Tax</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- Categories -->
|
||||||
|
|
||||||
|
<!-- Rules -->
|
||||||
|
<record id="hr_payroll_rule_er_us_ri_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 RI Rhode Island State Unemployment</field>
|
||||||
|
<field name="code">ER_US_RI_SUTA</field>
|
||||||
|
<field name="condition_select">python</field>
|
||||||
|
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ri_suta_wage_base', rate='us_ri_suta_rate', state_code='RI')</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_ri_suta_wage_base', rate='us_ri_suta_rate', state_code='RI')</field>
|
||||||
|
<field name="partner_id" ref="res_partner_us_ri_dor"/>
|
||||||
|
<field name="appears_on_payslip" eval="False"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_payroll_rule_ee_us_ri_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 RI Rhode Island State Income Tax Withholding</field>
|
||||||
|
<field name="code">EE_US_RI_SIT</field>
|
||||||
|
<field name="condition_select">python</field>
|
||||||
|
<field name="condition_python">result, _ = ri_rhode_island_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||||
|
<field name="amount_select">code</field>
|
||||||
|
<field name="amount_python_compute">result, result_rate = ri_rhode_island_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||||
|
<field name="partner_id" ref="res_partner_us_ri_dor_sit"/>
|
||||||
|
<field name="appears_on_payslip" eval="True"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
@@ -42,6 +42,7 @@ from .state.nm_new_mexico import nm_new_mexico_state_income_withholding
|
|||||||
from .state.ny_new_york import ny_new_york_state_income_withholding
|
from .state.ny_new_york import ny_new_york_state_income_withholding
|
||||||
from .state.oh_ohio import oh_ohio_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.ok_oklahoma import ok_oklahoma_state_income_withholding
|
||||||
|
from .state.ri_rhode_island import ri_rhode_island_state_income_withholding
|
||||||
from .state.sc_south_carolina import sc_south_carolina_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.ut_utah import ut_utah_state_income_withholding
|
||||||
from .state.vt_vermont import vt_vermont_state_income_withholding
|
from .state.vt_vermont import vt_vermont_state_income_withholding
|
||||||
@@ -111,6 +112,7 @@ class HRPayslip(models.Model):
|
|||||||
'ny_new_york_state_income_withholding': ny_new_york_state_income_withholding,
|
'ny_new_york_state_income_withholding': ny_new_york_state_income_withholding,
|
||||||
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
|
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
|
||||||
'ok_oklahoma_state_income_withholding': ok_oklahoma_state_income_withholding,
|
'ok_oklahoma_state_income_withholding': ok_oklahoma_state_income_withholding,
|
||||||
|
'ri_rhode_island_state_income_withholding': ri_rhode_island_state_income_withholding,
|
||||||
'sc_south_carolina_state_income_withholding': sc_south_carolina_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,
|
'ut_utah_state_income_withholding': ut_utah_state_income_withholding,
|
||||||
'vt_vermont_state_income_withholding': vt_vermont_state_income_withholding,
|
'vt_vermont_state_income_withholding': vt_vermont_state_income_withholding,
|
||||||
|
|||||||
48
l10n_us_hr_payroll/models/state/ri_rhode_island.py
Normal file
48
l10n_us_hr_payroll/models/state/ri_rhode_island.py
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||||
|
|
||||||
|
from .general import _state_applies, sit_wage
|
||||||
|
|
||||||
|
|
||||||
|
def ri_rhode_island_state_income_withholding(payslip, categories, worked_days, inputs):
|
||||||
|
"""
|
||||||
|
Returns SIT eligible wage and rate.
|
||||||
|
|
||||||
|
:return: result, result_rate (wage, percent)
|
||||||
|
"""
|
||||||
|
state_code = 'RI'
|
||||||
|
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
|
||||||
|
|
||||||
|
if payslip.contract_id.us_payroll_config_value('state_income_tax_exempt'):
|
||||||
|
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')
|
||||||
|
allowances = payslip.contract_id.us_payroll_config_value('ri_w4_sit_allowances')
|
||||||
|
exemption_rate = payslip.rule_parameter('us_ri_sit_exemption_rate')[schedule_pay]
|
||||||
|
tax_table = payslip.rule_parameter('us_ri_sit_tax_rate')[schedule_pay]
|
||||||
|
|
||||||
|
exemption_amt = 0.0
|
||||||
|
for row in exemption_rate:
|
||||||
|
amt, flat_fee = row
|
||||||
|
if wage > amt:
|
||||||
|
exemption_amt = flat_fee
|
||||||
|
|
||||||
|
taxable_income = wage - (allowances * exemption_amt)
|
||||||
|
withholding = 0.0
|
||||||
|
last = 0.0
|
||||||
|
for row in tax_table:
|
||||||
|
amt, flat_fee, rate = row
|
||||||
|
if wage <= float(amt):
|
||||||
|
withholding = ((taxable_income - last) * (rate / 100)) + flat_fee
|
||||||
|
break
|
||||||
|
last = amt
|
||||||
|
|
||||||
|
withholding = max(withholding, 0.0)
|
||||||
|
withholding += additional
|
||||||
|
return wage, -((withholding / wage) * 100.0)
|
||||||
@@ -242,6 +242,9 @@ class HRContractUSPayrollConfig(models.Model):
|
|||||||
('head_household', 'Head of Household')
|
('head_household', 'Head of Household')
|
||||||
], string='Oklahoma OK-W-4 Filing Status', help='OK-W-4')
|
], string='Oklahoma OK-W-4 Filing Status', help='OK-W-4')
|
||||||
ok_w4_sit_allowances = fields.Integer(string='Oklahoma OK-W-4 Allowances', help='OK-W-4 1.2.3.')
|
ok_w4_sit_allowances = fields.Integer(string='Oklahoma OK-W-4 Allowances', help='OK-W-4 1.2.3.')
|
||||||
|
|
||||||
|
ri_w4_sit_allowances = fields.Integer(string='Rhode Island RI W-4 Allowances', help='RI W-4 1.')
|
||||||
|
|
||||||
sc_w4_sit_allowances = fields.Integer(string='South Carolina SC W-4 Allowances', help='SC W-4 5.')
|
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([
|
ut_w4_sit_filing_status = fields.Selection([
|
||||||
|
|||||||
@@ -97,6 +97,8 @@ from . import test_us_ok_oklahoma_payslip_2020
|
|||||||
from . import test_us_pa_pennsylvania_payslip_2019
|
from . import test_us_pa_pennsylvania_payslip_2019
|
||||||
from . import test_us_pa_pennsylvania_payslip_2020
|
from . import test_us_pa_pennsylvania_payslip_2020
|
||||||
|
|
||||||
|
from . import test_us_ri_rhode_island_payslip_2020
|
||||||
|
|
||||||
from . import test_us_sc_south_carolina_payslip_2019
|
from . import test_us_sc_south_carolina_payslip_2019
|
||||||
from . import test_us_sc_south_carolina_payslip_2020
|
from . import test_us_sc_south_carolina_payslip_2020
|
||||||
|
|
||||||
|
|||||||
37
l10n_us_hr_payroll/tests/test_us_ri_rhode_island_payslip_2020.py
Executable file
37
l10n_us_hr_payroll/tests/test_us_ri_rhode_island_payslip_2020.py
Executable file
@@ -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 TestUsRIPayslip(TestUsPayslip):
|
||||||
|
###
|
||||||
|
# 2020 Taxes and Rates
|
||||||
|
###
|
||||||
|
RI_UNEMP_MAX_WAGE = 24000.0
|
||||||
|
RI_UNEMP = 1.3
|
||||||
|
# Calculation based on example http://www.tax.ri.gov/forms/2020/Withholding/2020%20Withhholding%20Tax%20Booklet.pdf
|
||||||
|
|
||||||
|
def _test_sit(self, wage, allowances, additional_withholding, exempt, schedule_pay, date_start, expected_withholding):
|
||||||
|
employee = self._createEmployee()
|
||||||
|
contract = self._createContract(employee,
|
||||||
|
wage=wage,
|
||||||
|
state_id=self.get_us_state('RI'),
|
||||||
|
ri_w4_sit_allowances=allowances,
|
||||||
|
state_income_tax_additional_withholding=additional_withholding,
|
||||||
|
state_income_tax_exempt=exempt,
|
||||||
|
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('RI', self.RI_UNEMP, date(2020, 1, 1), wage_base=self.RI_UNEMP_MAX_WAGE)
|
||||||
|
self._test_sit(2195, 1, 0, False, 'weekly', date(2020, 1, 1), 90.80)
|
||||||
|
self._test_sit(1800, 2, 10, True, 'weekly', date(2020, 1, 1), 0.00)
|
||||||
|
self._test_sit(10000, 1, 0, False, 'bi-weekly', date(2020, 1, 1), 503.15)
|
||||||
|
self._test_sit(18000, 2, 0, False, 'monthly', date(2020, 1, 1), 860.54)
|
||||||
|
self._test_sit(18000, 2, 10, False, 'monthly', date(2020, 1, 1), 870.55)
|
||||||
@@ -237,6 +237,12 @@
|
|||||||
<field name="state_income_tax_exempt"/>
|
<field name="state_income_tax_exempt"/>
|
||||||
<field name="state_income_tax_additional_withholding"/>
|
<field name="state_income_tax_additional_withholding"/>
|
||||||
</group>
|
</group>
|
||||||
|
<group name="state_rhode_island" string="RI Rhode Island" attrs="{'invisible':[('state_id', '!=', %(base.state_us_40)s)]}">
|
||||||
|
<p colspan="2"><h3>Form RI W-4 - State Income Tax</h3></p>
|
||||||
|
<field name="ri_w4_sit_allowances" string="Allowances 1."/>
|
||||||
|
<field name="state_income_tax_additional_withholding" string="Additional Withholding 2."/>
|
||||||
|
<field name="state_income_tax_exempt" string="Exempt 3."/>
|
||||||
|
</group>
|
||||||
<group name="state_sc_south_carolina" string="SC South Carolina" attrs="{'invisible':[('state_id', '!=', %(base.state_us_41)s)]}">
|
<group name="state_sc_south_carolina" string="SC South Carolina" attrs="{'invisible':[('state_id', '!=', %(base.state_us_41)s)]}">
|
||||||
<p colspan="2"><h3>Form SC W-4 - State Income Tax</h3></p>
|
<p colspan="2"><h3>Form SC W-4 - State Income Tax</h3></p>
|
||||||
<field name="sc_w4_sit_allowances" string="Allowances 5."/>
|
<field name="sc_w4_sit_allowances" string="Allowances 5."/>
|
||||||
|
|||||||
Reference in New Issue
Block a user