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 Port l10n_us_sc_hr_payroll SC South Carolina including migration
This commit is contained in:
@@ -52,6 +52,7 @@ United States of America - Payroll Rules.
|
||||
'data/state/nm_new_mexico.xml',
|
||||
'data/state/oh_ohio.xml',
|
||||
'data/state/pa_pennsylvania.xml',
|
||||
'data/state/sc_south_carolina.xml',
|
||||
'data/state/tx_texas.xml',
|
||||
'data/state/va_virginia.xml',
|
||||
'data/state/wa_washington.xml',
|
||||
|
||||
149
l10n_us_hr_payroll/data/state/sc_south_carolina.xml
Normal file
149
l10n_us_hr_payroll/data/state/sc_south_carolina.xml
Normal file
@@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<!-- Wage Base -->
|
||||
<record id="rule_parameter_us_sc_suta_wage_base" model="hr.rule.parameter">
|
||||
<field name="name">US SC South Carolina SUTA Wage Base</field>
|
||||
<field name="code">us_sc_suta_wage_base</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_sc_suta_wage_base_2019" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">14000.0</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_sc_suta_wage_base"/>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_sc_suta_wage_base_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">14000.0</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_sc_suta_wage_base"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Rate -->
|
||||
<record id="rule_parameter_us_sc_suta_rate" model="hr.rule.parameter">
|
||||
<field name="name">US SC South Carolina SUTA Rate</field>
|
||||
<field name="code">us_sc_suta_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_sc_suta_rate_2019" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">1.09</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_sc_suta_rate"/>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_sc_suta_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">1.09</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_sc_suta_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_sc_sit_tax_rate" model="hr.rule.parameter">
|
||||
<field name="name">US SC South Carolina SIT Tax Rate</field>
|
||||
<field name="code">us_sc_sit_tax_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_sc_sit_tax_rate_2019" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">[
|
||||
( 2450, 1.1, 0.0),
|
||||
( 4900, 3.0, 26.95),
|
||||
( 7350, 4.0, 100.45),
|
||||
( 9800, 5.0, 198.45),
|
||||
(12250, 6.0, 320.95),
|
||||
('inf', 7.0, 467.95),
|
||||
]</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_sc_sit_tax_rate"/>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_sc_sit_tax_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">[
|
||||
( 2620, 0.8, 0.0),
|
||||
( 5240, 3.0, 57.64),
|
||||
( 7860, 4.0, 110.04),
|
||||
(10490, 5.0, 188.64),
|
||||
(13110, 6.0, 293.54),
|
||||
('inf', 7.0, 424.64),
|
||||
]</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_sc_sit_tax_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_sc_sit_personal_exemption_rate" model="hr.rule.parameter">
|
||||
<field name="name">US SC South Carolina Personal Exemption Rate</field>
|
||||
<field name="code">us_sc_sit_personal_exemption_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_sc_sit_personal_exemption_rate_2019" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">2510</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_sc_sit_personal_exemption_rate"/>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_sc_sit_personal_exemption_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">2590</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_sc_sit_personal_exemption_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_sc_sit_standard_deduction_rate" model="hr.rule.parameter">
|
||||
<field name="name">US SC South Carolina Standard Deduction Rate</field>
|
||||
<field name="code">us_sc_sit_standard_deduction_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_sc_sit_standard_deduction_rate_2019" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">3470.0</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_sc_sit_standard_deduction_rate"/>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_sc_sit_standard_deduction_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">3820.0</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_sc_sit_standard_deduction_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Partners and Contribution Registers -->
|
||||
<record id="res_partner_us_sc_dor" model="res.partner">
|
||||
<field name="name">US South Carolina - Department of Labor and Industrial Relations - Unemployment Tax</field>
|
||||
</record>
|
||||
|
||||
<record id="res_partner_us_sc_dor_sit" model="res.partner">
|
||||
<field name="name">US South Carolina - Department of Taxation - Income Tax</field>
|
||||
</record>
|
||||
|
||||
<!-- Categories -->
|
||||
|
||||
<!-- Rules -->
|
||||
<record id="hr_payroll_rule_er_us_sc_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 SC South Carolina State Unemployment</field>
|
||||
<field name="code">ER_US_SC_SUTA</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_sc_suta_wage_base', rate='us_sc_suta_rate', state_code='SC')</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_sc_suta_wage_base', rate='us_sc_suta_rate', state_code='SC')</field>
|
||||
<field name="partner_id" ref="res_partner_us_sc_dor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_rule_ee_us_sc_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 SC South Carolina State Income Tax Withholding</field>
|
||||
<field name="code">EE_US_SC_SIT</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = sc_south_carolina_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">result, result_rate = sc_south_carolina_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="partner_id" ref="res_partner_us_sc_dor_sit"/>
|
||||
<field name="appears_on_payslip" eval="True"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -35,6 +35,7 @@ from .state.nc_northcarolina import nc_northcarolina_state_income_withholding
|
||||
from .state.nj_newjersey import nj_newjersey_state_income_withholding
|
||||
from .state.nm_new_mexico import nm_new_mexico_state_income_withholding
|
||||
from .state.oh_ohio import oh_ohio_state_income_withholding
|
||||
from .state.sc_south_carolina import sc_south_carolina_state_income_withholding
|
||||
from .state.va_virginia import va_virginia_state_income_withholding
|
||||
from .state.wa_washington import wa_washington_fml_er, \
|
||||
wa_washington_fml_ee
|
||||
@@ -92,6 +93,7 @@ class HRPayslip(models.Model):
|
||||
'nj_newjersey_state_income_withholding': nj_newjersey_state_income_withholding,
|
||||
'nm_new_mexico_state_income_withholding': nm_new_mexico_state_income_withholding,
|
||||
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
|
||||
'sc_south_carolina_state_income_withholding': sc_south_carolina_state_income_withholding,
|
||||
'va_virginia_state_income_withholding': va_virginia_state_income_withholding,
|
||||
'wa_washington_fml_er': wa_washington_fml_er,
|
||||
'wa_washington_fml_ee': wa_washington_fml_ee,
|
||||
|
||||
48
l10n_us_hr_payroll/models/state/sc_south_carolina.py
Normal file
48
l10n_us_hr_payroll/models/state/sc_south_carolina.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 sc_south_carolina_state_income_withholding(payslip, categories, worked_days, inputs):
|
||||
"""
|
||||
Returns SIT eligible wage and rate.
|
||||
WAGE = GROSS + DED_FIT_EXEMPT
|
||||
|
||||
:return: result, result_rate (wage, percent)
|
||||
"""
|
||||
state_code = 'SC'
|
||||
if not _state_applies(payslip, state_code):
|
||||
return 0.0, 0.0
|
||||
|
||||
personal_exempt = payslip.contract_id.us_payroll_config_value('state_income_tax_exempt')
|
||||
if personal_exempt:
|
||||
return 0.0, 0.0
|
||||
|
||||
# Determine Wage
|
||||
wage = sit_wage(payslip, categories)
|
||||
if not wage:
|
||||
return 0.0, 0.0
|
||||
|
||||
pay_periods = payslip.dict.get_pay_periods_in_year()
|
||||
allowances = payslip.contract_id.us_payroll_config_value('sc_w4_sit_allowances')
|
||||
tax_rate = payslip.rule_parameter('us_sc_sit_tax_rate')
|
||||
personal_exemption = payslip.rule_parameter('us_sc_sit_personal_exemption_rate')
|
||||
deduction = payslip.rule_parameter('us_sc_sit_standard_deduction_rate')
|
||||
|
||||
annual_wage = wage * pay_periods
|
||||
personal_exemption_amt = allowances * personal_exemption
|
||||
standard_deduction = 0.0
|
||||
if allowances > 0:
|
||||
if (annual_wage * 0.1) > deduction:
|
||||
standard_deduction = deduction
|
||||
else:
|
||||
standard_deduction = annual_wage * (10 / 100)
|
||||
taxable_income = annual_wage - personal_exemption_amt - standard_deduction
|
||||
withholding = 0.0
|
||||
last = 0.0
|
||||
for cap, rate, flat_amt in tax_rate:
|
||||
if float(cap) > taxable_income:
|
||||
withholding = (taxable_income * (rate / 100.0) - flat_amt)
|
||||
break
|
||||
withholding /= pay_periods
|
||||
return wage, -((withholding / wage) * 100.0)
|
||||
@@ -202,6 +202,7 @@ class HRContractUSPayrollConfig(models.Model):
|
||||
# Ohio will use generic SIT exempt and additional fields
|
||||
oh_it4_sit_exemptions = fields.Integer(string='Ohio IT-4 Exemptions',
|
||||
help='Line 4')
|
||||
sc_w4_sit_allowances = fields.Integer(string='South Carolina SC W-4 Allowances', help='SC W-4 5.')
|
||||
|
||||
va_va4_sit_exemptions = fields.Integer(string='Virginia VA-4(P) Personal Exemptions',
|
||||
help='VA-4(P) 1(a)')
|
||||
|
||||
@@ -80,6 +80,9 @@ from . import test_us_oh_ohio_payslip_2020
|
||||
from . import test_us_pa_pennsylvania_payslip_2019
|
||||
from . import test_us_pa_pennsylvania_payslip_2020
|
||||
|
||||
from . import test_us_sc_south_carolina_payslip_2019
|
||||
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
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from .common import TestUsPayslip, process_payslip
|
||||
|
||||
|
||||
class TestUsSCPayslip(TestUsPayslip):
|
||||
|
||||
# Taxes and Rates
|
||||
SC_UNEMP_MAX_WAGE = 14000.0
|
||||
US_SC_UNEMP = -1.09 / 100
|
||||
US_SC_exemption_amount = 2510.00
|
||||
|
||||
def test_2019_taxes_weekly(self):
|
||||
# We will hand calculate the amount to test for state withholding.
|
||||
schedule_pay = 'weekly'
|
||||
salary = 50000.00 # Employee is paid 50000 per week to be in top tax bracket
|
||||
allowances = 2
|
||||
# Calculate annual wages
|
||||
annual = 50000 * 52.0
|
||||
# From our annual we deduct personal exemption amounts.
|
||||
# We deduct 2510.00 per exemption. Since we have two exemptions:
|
||||
personal_exemption = self.US_SC_exemption_amount * allowances # 5020.0
|
||||
# From annual, we will also deduct a standard_deduction of 3470.00 or .1 of salary, which ever
|
||||
# is small -> if 1 or more exemptions, else 0
|
||||
standard_deduction = 3470.00
|
||||
taxable_income = annual - personal_exemption - standard_deduction # 2591510.0
|
||||
# We then calculate the amounts off the SC tax pdf tables.
|
||||
# 2591478.0 is in the highest bracket
|
||||
test_amt = (taxable_income * (7.0 / 100.0)) - 467.95
|
||||
test_amt = 180935.51
|
||||
# Make it per period then negative
|
||||
test_amt = (test_amt / 52.0) # Divided by 52 since it is weekly.
|
||||
# test_amt = 3479.52
|
||||
test_amt = -test_amt
|
||||
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=salary,
|
||||
state_id=self.get_us_state('SC'),
|
||||
state_income_tax_exempt=False,
|
||||
sc_w4_sit_allowances=allowances,
|
||||
schedule_pay=schedule_pay)
|
||||
|
||||
self._log('2019 South Carolina tax first payslip:')
|
||||
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||
payslip.compute_sheet()
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollAlmostEqual(cats['ER_US_SUTA'], self.SC_UNEMP_MAX_WAGE * self.US_SC_UNEMP)
|
||||
self.assertPayrollAlmostEqual(cats['EE_US_SIT'], test_amt)
|
||||
|
||||
process_payslip(payslip)
|
||||
|
||||
remaining_SC_UNEMP_wages = self.SC_UNEMP_MAX_WAGE - annual if (annual < self.SC_UNEMP_MAX_WAGE) \
|
||||
else 0.00
|
||||
|
||||
self._log('2019 South Carolina tax second payslip:')
|
||||
|
||||
payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
|
||||
payslip.compute_sheet()
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertEqual(0.0, remaining_SC_UNEMP_wages)
|
||||
self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_SC_UNEMP_wages * self.US_SC_UNEMP)
|
||||
|
||||
def test_2019_taxes_filing_status(self):
|
||||
salary = 20000.00 # Wages per pay period
|
||||
schedule_pay = 'monthly'
|
||||
annual = salary * 12
|
||||
allowances = 1
|
||||
# Hand Calculations
|
||||
personal_exemption = 2510.00
|
||||
standard_deduction = min(3470.00, .1 * annual) # 3470.0 but min is shown for the process
|
||||
taxable = annual - personal_exemption - standard_deduction
|
||||
# taxable = 234020
|
||||
test_amt = ((taxable) * (7.0 / 100.0)) - 467.95 # 15991.850000000002
|
||||
test_amt = test_amt / 12.0 # Put it into monthly -> 1332.654166666667
|
||||
# Make it negative
|
||||
test_amt = -test_amt
|
||||
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=salary,
|
||||
state_id=self.get_us_state('SC'),
|
||||
state_income_tax_exempt=False,
|
||||
sc_w4_sit_allowances=allowances,
|
||||
schedule_pay=schedule_pay)
|
||||
|
||||
self._log('2019 South Carolina tax 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'], self.SC_UNEMP_MAX_WAGE * self.US_SC_UNEMP)
|
||||
self.assertPayrollAlmostEqual(cats['EE_US_SIT'], test_amt)
|
||||
|
||||
process_payslip(payslip)
|
||||
@@ -0,0 +1,34 @@
|
||||
# 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 TestUsSCPayslip(TestUsPayslip):
|
||||
###
|
||||
# 2020 Taxes and Rates
|
||||
###
|
||||
SC_UNEMP_MAX_WAGE = 14000.0
|
||||
SC_UNEMP = 1.09
|
||||
# Calculation based on https://dor.sc.gov/forms-site/Forms/WH1603F_2020.pdf
|
||||
|
||||
def _test_sit(self, wage, exempt, allowances, schedule_pay, date_start, expected_withholding):
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=wage,
|
||||
state_id=self.get_us_state('SC'),
|
||||
state_income_tax_exempt=exempt,
|
||||
sc_w4_sit_allowances=allowances,
|
||||
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('SC', self.SC_UNEMP, date(2020, 1, 1), wage_base=self.SC_UNEMP_MAX_WAGE)
|
||||
self._test_sit(750.0, False, 3.0, 'weekly', date(2020, 1, 1), 28.73)
|
||||
self._test_sit(800.0, True, 0.0, 'weekly', date(2020, 1, 1), 0.00)
|
||||
self._test_sit(9000.0, False, 0.0, 'monthly', date(2020, 1, 1), 594.61)
|
||||
@@ -191,6 +191,11 @@
|
||||
<field name="state_income_tax_exempt"/>
|
||||
<field name="state_income_tax_additional_withholding"/>
|
||||
</group>
|
||||
<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>
|
||||
<field name="sc_w4_sit_allowances" string="Allowances 5."/>
|
||||
<field name="state_income_tax_exempt" string="Exempt 7."/>
|
||||
</group>
|
||||
<group name="state_tx_texas" string="TX Texas" attrs="{'invisible':[('state_id', '!=', %(base.state_us_44)s)]}">
|
||||
<p colspan="2"><h3>No additional fields.</h3></p>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user