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 Utah 13.0
This commit is contained in:
@@ -62,6 +62,7 @@ United States of America - Payroll Rules.
|
||||
'data/state/pa_pennsylvania.xml',
|
||||
'data/state/sc_south_carolina.xml',
|
||||
'data/state/tx_texas.xml',
|
||||
'data/state/ut_utah.xml',
|
||||
'data/state/vt_vermont.xml',
|
||||
'data/state/va_virginia.xml',
|
||||
'data/state/wa_washington.xml',
|
||||
|
||||
157
l10n_us_hr_payroll/data/state/ut_utah.xml
Normal file
157
l10n_us_hr_payroll/data/state/ut_utah.xml
Normal file
@@ -0,0 +1,157 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<!-- Wage Base -->
|
||||
<record id="rule_parameter_us_ut_suta_wage_base" model="hr.rule.parameter">
|
||||
<field name="name">US UT Utah SUTA Wage Base</field>
|
||||
<field name="code">us_ut_suta_wage_base</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_ut_suta_wage_base_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">36600.0</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_ut_suta_wage_base"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Rate -->
|
||||
<record id="rule_parameter_us_ut_suta_rate" model="hr.rule.parameter">
|
||||
<field name="name">US UT Utah SUTA Rate</field>
|
||||
<field name="code">us_ut_suta_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_ut_suta_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">1.5</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_ut_suta_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_ut_tax_rate" model="hr.rule.parameter">
|
||||
<field name="name">US UT Utah TAX Rate</field>
|
||||
<field name="code">us_ut_tax_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_ut_tax_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">0.0495</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_ut_tax_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_ut_sit_allowances_rate" model="hr.rule.parameter">
|
||||
<field name="name">US UT Utah Allowances Rate</field>
|
||||
<field name="code">us_ut_sit_allowances_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_ut_sit_allowances_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">{
|
||||
'single': {
|
||||
'weekly' : 7,
|
||||
'bi-weekly' : 14,
|
||||
'semi-monthly': 15,
|
||||
'monthly' : 30,
|
||||
'quarterly' : 90,
|
||||
'semi-annual': 180,
|
||||
'annually': 360,
|
||||
},
|
||||
'married': {
|
||||
'weekly' : 14,
|
||||
'bi-weekly' : 28,
|
||||
'semi-monthly': 30,
|
||||
'monthly' : 60,
|
||||
'quarterly' : 180,
|
||||
'semi-annual': 360,
|
||||
'annually': 720,
|
||||
},
|
||||
}</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_ut_sit_allowances_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_ut_sit_tax_rate" model="hr.rule.parameter">
|
||||
<field name="name">US UT Utah SIT Tax Rate</field>
|
||||
<field name="code">us_ut_sit_tax_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_ut_sit_tax_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">{
|
||||
'single': {
|
||||
'weekly': ((137, 1.3)),
|
||||
'bi-weekly': ((274, 1.3)),
|
||||
'semi-monthly': ((297, 1.3)),
|
||||
'monthly': ((594, 1.3)),
|
||||
'quarterly': ((1782, 1.3)),
|
||||
'semi-annual': ((3564, 1.3)),
|
||||
'annually': ((7128, 1.3)),
|
||||
},
|
||||
'married': {
|
||||
'weekly': ((274, 1.3)),
|
||||
'bi-weekly': (548, 1.3),
|
||||
'semi-monthly': ((594, 1.3)),
|
||||
'monthly': ((1188, 1.3)),
|
||||
'quarterly': ((3564, 1.3)),
|
||||
'semi-annual': ((7128, 1.3)),
|
||||
'annually': ((14256, 1.3)),
|
||||
},
|
||||
'head_household': {
|
||||
'weekly': ((137, 1.3)),
|
||||
'bi-weekly': ((274, 1.3)),
|
||||
'semi-monthly': ((297, 1.3)),
|
||||
'monthly': ((594, 1.3)),
|
||||
'quarterly': ((1782, 1.3)),
|
||||
'semi-annual': ((3564, 1.3)),
|
||||
'annually': ((7128, 1.3)),
|
||||
},
|
||||
}</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_ut_sit_tax_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Partners and Contribution Registers -->
|
||||
<record id="res_partner_us_ut_dor" model="res.partner">
|
||||
<field name="name">US Utah - Employment Security Commission - Unemployment Tax</field>
|
||||
</record>
|
||||
|
||||
<record id="res_partner_us_ut_dor_sit" model="res.partner">
|
||||
<field name="name">US Utah - Tax Commission - Income Tax</field>
|
||||
</record>
|
||||
|
||||
<!-- Categories -->
|
||||
|
||||
<!-- Rules -->
|
||||
<record id="hr_payroll_rule_er_us_ut_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 UT Utah State Unemployment</field>
|
||||
<field name="code">ER_US_UT_SUTA</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ut_suta_wage_base', rate='us_ut_suta_rate', state_code='UT')</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_ut_suta_wage_base', rate='us_ut_suta_rate', state_code='UT')</field>
|
||||
<field name="partner_id" ref="res_partner_us_ut_dor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_rule_ee_us_ut_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 UT Utah State Income Tax Withholding</field>
|
||||
<field name="code">EE_US_UT_SIT</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = ut_utah_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">result, result_rate = ut_utah_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="partner_id" ref="res_partner_us_ut_dor_sit"/>
|
||||
<field name="appears_on_payslip" eval="True"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -43,6 +43,7 @@ from .state.ny_new_york import ny_new_york_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.sc_south_carolina import sc_south_carolina_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.va_virginia import va_virginia_state_income_withholding
|
||||
from .state.wa_washington import wa_washington_fml_er, \
|
||||
@@ -109,6 +110,7 @@ class HRPayslip(models.Model):
|
||||
'oh_ohio_state_income_withholding': oh_ohio_state_income_withholding,
|
||||
'ok_oklahoma_state_income_withholding': ok_oklahoma_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,
|
||||
'vt_vermont_state_income_withholding': vt_vermont_state_income_withholding,
|
||||
'va_virginia_state_income_withholding': va_virginia_state_income_withholding,
|
||||
'wa_washington_fml_er': wa_washington_fml_er,
|
||||
|
||||
39
l10n_us_hr_payroll/models/state/ut_utah.py
Normal file
39
l10n_us_hr_payroll/models/state/ut_utah.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from .general import _state_applies, sit_wage
|
||||
|
||||
|
||||
def ut_utah_state_income_withholding(payslip, categories, worked_days, inputs):
|
||||
"""
|
||||
Returns SIT eligible wage and rate.
|
||||
|
||||
:return: result, result_rate (wage, percent)
|
||||
"""
|
||||
state_code = 'UT'
|
||||
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('ut_w4_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')
|
||||
tax_rate = payslip.rule_parameter('us_ut_tax_rate')
|
||||
allowances = payslip.rule_parameter('us_ut_sit_allowances_rate')[filing_status].get(schedule_pay)
|
||||
tax_table = payslip.rule_parameter('us_ut_sit_tax_rate')[filing_status].get(schedule_pay)
|
||||
|
||||
taxable_income = wage * tax_rate
|
||||
withholding = 0.0
|
||||
amt, rate = tax_table
|
||||
withholding = taxable_income - (allowances - ((wage - amt) * (rate / 100)))
|
||||
|
||||
withholding = max(withholding, 0.0)
|
||||
withholding += additional
|
||||
withholding = round(withholding)
|
||||
return wage, -((withholding / wage) * 100.0)
|
||||
@@ -244,6 +244,12 @@ class HRContractUSPayrollConfig(models.Model):
|
||||
ok_w4_sit_allowances = fields.Integer(string='Oklahoma OK-W-4 Allowances', help='OK-W-4 1.2.3.')
|
||||
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([
|
||||
('single', 'Single'),
|
||||
('married', 'Married'),
|
||||
('head_household', 'Head of Household')
|
||||
], string='Utah UT W-4 Filing Status', help='UT W-4 C.')
|
||||
|
||||
vt_w4vt_sit_filing_status = fields.Selection([
|
||||
('single', 'Single'),
|
||||
('married', 'Married'),
|
||||
|
||||
@@ -103,6 +103,8 @@ 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
|
||||
|
||||
from . import test_us_us_utah_payslip_2020
|
||||
|
||||
from . import test_us_vt_vermont_payslip_2020
|
||||
|
||||
from . import test_us_va_virginia_payslip_2019
|
||||
|
||||
37
l10n_us_hr_payroll/tests/test_us_us_utah_payslip_2020.py
Executable file
37
l10n_us_hr_payroll/tests/test_us_us_utah_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 TestUsUTPayslip(TestUsPayslip):
|
||||
###
|
||||
# 2020 Taxes and Rates
|
||||
###
|
||||
UT_UNEMP_MAX_WAGE = 36600.0
|
||||
UT_UNEMP = 1.5
|
||||
# Calculation based on example https://src.bna.com/MSO
|
||||
|
||||
def _test_sit(self, wage, filing_status, additional_withholding, schedule_pay, date_start, expected_withholding):
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=wage,
|
||||
state_id=self.get_us_state('UT'),
|
||||
ut_w4_sit_filing_status=filing_status,
|
||||
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('UT', self.UT_UNEMP, date(2020, 1, 1), wage_base=self.UT_UNEMP_MAX_WAGE)
|
||||
self._test_sit(400, 'single', 0, 'weekly', date(2020, 1, 1), 16.00)
|
||||
self._test_sit(1000, 'single', 0, 'bi-weekly', date(2020, 1, 1), 45.00)
|
||||
self._test_sit(855, 'married', 0, 'semi-monthly', date(2020, 1, 1), 16.00)
|
||||
self._test_sit(2500, 'married', 0, 'monthly', date(2020, 1, 1), 81.00)
|
||||
self._test_sit(8000, 'single', 0, 'quarterly', date(2020, 1, 1), 387.00)
|
||||
self._test_sit(8000, 'single', 10, 'quarterly', date(2020, 1, 1), 397.00)
|
||||
@@ -245,6 +245,11 @@
|
||||
<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>
|
||||
<group name="state_ut_utah" string="UT Utah" attrs="{'invisible':[('state_id', '!=', %(base.state_us_45)s)]}">
|
||||
<p colspan="2"><h3>Form UT W-4 - State Income Tax</h3></p>
|
||||
<field name="ut_w4_sit_filing_status" string="Filing Status 1(C)."/>
|
||||
<field name="state_income_tax_additional_withholding" string="Additional Withholding 4(C)."/>
|
||||
</group>
|
||||
<group name="state_vt_vermont" string="VT Vermont" attrs="{'invisible':[('state_id', '!=', %(base.state_us_46)s)]}">
|
||||
<p colspan="2"><h3>Form VT W-4VT - State Income Tax</h3></p>
|
||||
<field name="vt_w4vt_sit_filing_status" string="Filing Status"/>
|
||||
|
||||
Reference in New Issue
Block a user