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_tx_hr_payroll TX Texas including migration
This commit is contained in:
@@ -32,6 +32,7 @@ USA Payroll Rules.
|
||||
'data/state/mt_montana.xml',
|
||||
'data/state/oh_ohio.xml',
|
||||
'data/state/pa_pennsylvania.xml',
|
||||
'data/state/tx_texas.xml',
|
||||
'data/state/wa_washington.xml',
|
||||
'data/final.xml',
|
||||
'views/hr_contract_views.xml',
|
||||
|
||||
@@ -29,6 +29,10 @@
|
||||
ref('hr_payroll_rule_ee_us_pa_suta'),
|
||||
ref('hr_payroll_rule_ee_us_pa_sit'),
|
||||
|
||||
ref('hr_payroll_rule_er_us_tx_suta'),
|
||||
ref('hr_payroll_rule_er_us_tx_suta_oa'),
|
||||
ref('hr_payroll_rule_er_us_tx_suta_etia'),
|
||||
|
||||
ref('hr_payroll_rule_er_us_wa_suta'),
|
||||
ref('hr_payroll_rule_er_us_wa_fml'),
|
||||
ref('hr_payroll_rule_ee_us_wa_fml'),
|
||||
|
||||
117
l10n_us_hr_payroll/data/state/tx_texas.xml
Normal file
117
l10n_us_hr_payroll/data/state/tx_texas.xml
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<!-- Wage Base -->
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_tx_suta_wage_base_2019" model="hr.payroll.rate">
|
||||
<field name="name">US TX Texas SUTA Wage Base</field>
|
||||
<field name="code">us_tx_suta_wage_base</field>
|
||||
<field name="parameter_value">9000.0</field>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_tx_suta_wage_base_2020" model="hr.payroll.rate">
|
||||
<field name="name">US TX Texas SUTA Wage Base</field>
|
||||
<field name="code">us_tx_suta_wage_base</field>
|
||||
<field name="parameter_value">9000.0</field>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Rate -->
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_tx_suta_rate_2019" model="hr.payroll.rate">
|
||||
<field name="name">US TX Texas SUTA Rate</field>
|
||||
<field name="code">us_tx_suta_rate</field>
|
||||
<field name="parameter_value">2.7</field>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_tx_suta_rate_2020" model="hr.payroll.rate">
|
||||
<field name="name">US TX Texas SUTA Rate</field>
|
||||
<field name="code">us_tx_suta_rate</field>
|
||||
<field name="parameter_value">2.7</field>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_tx_suta_oa_rate_2019" model="hr.payroll.rate">
|
||||
<field name="name">US TX Texas Obligation Assessment Rate</field>
|
||||
<field name="code">us_tx_suta_oa_rate</field>
|
||||
<field name="parameter_value">0.0</field>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_tx_suta_oa_rate_2020" model="hr.payroll.rate">
|
||||
<field name="name">US TX Texas Obligation Assessment Rate</field>
|
||||
<field name="code">us_tx_suta_oa_rate</field>
|
||||
<field name="parameter_value">0.0</field>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_tx_suta_etia_rate_2019" model="hr.payroll.rate">
|
||||
<field name="name">US TX Texas Employment & Training Investment Assessment Rate</field>
|
||||
<field name="code">us_tx_suta_etia_rate</field>
|
||||
<field name="parameter_value">0.1</field>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_tx_suta_etia_rate_2020" model="hr.payroll.rate">
|
||||
<field name="name">US TX Texas Employment & Training Investment Assessment Rate</field>
|
||||
<field name="code">us_tx_suta_etia_rate</field>
|
||||
<field name="parameter_value">0.1</field>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Partners and Contribution Registers -->
|
||||
<record id="res_partner_us_tx_dor" model="res.partner">
|
||||
<field name="name">US Texas - Workforce Commission (Unemployment)</field>
|
||||
</record>
|
||||
|
||||
<record id="contrib_register_us_tx_dor" model="hr.contribution.register">
|
||||
<field name="name">US Texas - Workforce Commission (Unemployment)</field>
|
||||
<field name="partner_id" ref="res_partner_us_tx_dor"/>
|
||||
</record>
|
||||
|
||||
<!-- Categories -->
|
||||
|
||||
<!-- Rules -->
|
||||
<record id="hr_payroll_rule_er_us_tx_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 TX Texas State Unemployment (C-3)</field>
|
||||
<field name="code">ER_US_TX_SUTA</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_tx_suta_wage_base', rate='us_tx_suta_rate', state_code='TX')</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_tx_suta_wage_base', rate='us_tx_suta_rate', state_code='TX')</field>
|
||||
<field name="register_id" ref="contrib_register_us_tx_dor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_rule_er_us_tx_suta_oa" model="hr.salary.rule">
|
||||
<field name="sequence" eval="451"/>
|
||||
<field name="category_id" ref="hr_payroll_category_er_us_suta"/>
|
||||
<field name="name">ER: US TX Texas Obligation Assessment (C-3)</field>
|
||||
<field name="code">ER_US_TX_SUTA_OA</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_tx_suta_wage_base', rate='us_tx_suta_oa_rate', state_code='TX')</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_tx_suta_wage_base', rate='us_tx_suta_oa_rate', state_code='TX')</field>
|
||||
<field name="register_id" ref="contrib_register_us_tx_dor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_rule_er_us_tx_suta_etia" model="hr.salary.rule">
|
||||
<field name="sequence" eval="451"/>
|
||||
<field name="category_id" ref="hr_payroll_category_er_us_suta"/>
|
||||
<field name="name">ER: US TX Texas Employment & Training Investment Assessment (C-3)</field>
|
||||
<field name="code">ER_US_TX_SUTA_ETIA</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_tx_suta_wage_base', rate='us_tx_suta_etia_rate', state_code='TX')</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_tx_suta_wage_base', rate='us_tx_suta_etia_rate', state_code='TX')</field>
|
||||
<field name="register_id" ref="contrib_register_us_tx_dor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -59,6 +59,13 @@ XMLIDS_TO_REMOVE_2020 = [
|
||||
'l10n_us_pa_hr_payroll.hr_payroll_rules_pa_unemp_wages_2018',
|
||||
'l10n_us_pa_hr_payroll.hr_payroll_rules_pa_inc_withhold_add',
|
||||
|
||||
'l10n_us_tx_hr_payroll.contrib_register_txdor',
|
||||
'l10n_us_tx_hr_payroll.hr_payroll_tx_unemp_wages',
|
||||
'l10n_us_tx_hr_payroll.hr_payroll_tx_unemp',
|
||||
'l10n_us_tx_hr_payroll.hr_payroll_tx_oa',
|
||||
'l10n_us_tx_hr_payroll.hr_payroll_tx_etia',
|
||||
'l10n_us_tx_hr_payroll.hr_payroll_rules_tx_unemp_wages_2018',
|
||||
|
||||
'l10n_us_wa_hr_payroll.hr_payroll_wa_unemp_wages',
|
||||
'l10n_us_wa_hr_payroll.hr_payroll_wa_unemp',
|
||||
'l10n_us_wa_hr_payroll.hr_payroll_wa_lni',
|
||||
@@ -107,6 +114,12 @@ XMLIDS_TO_RENAME_2020 = {
|
||||
'l10n_us_pa_hr_payroll.hr_payroll_rules_pa_unemp_company_2018': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_pa_suta',
|
||||
'l10n_us_pa_hr_payroll.hr_payroll_rules_pa_inc_withhold_2018': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_pa_sit',
|
||||
|
||||
'l10n_us_tx_hr_payroll.res_partner_txdor': 'l10n_us_hr_payroll.res_partner_us_tx_dor',
|
||||
'l10n_us_tx_hr_payroll.contrib_register_txdor': 'l10n_us_hr_payroll.contrib_register_us_tx_dor',
|
||||
'l10n_us_tx_hr_payroll.hr_payroll_rules_tx_unemp_2018': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_tx_suta',
|
||||
'l10n_us_tx_hr_payroll.hr_payroll_rules_tx_oa_2018': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_tx_suta_oa',
|
||||
'l10n_us_tx_hr_payroll.hr_payroll_rules_tx_etia_2018': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_tx_suta_etia',
|
||||
|
||||
'l10n_us_wa_hr_payroll.res_partner_wador_unemp': 'l10n_us_hr_payroll.res_partner_us_wa_dor',
|
||||
'l10n_us_wa_hr_payroll.res_partner_wador_lni': 'l10n_us_hr_payroll.res_partner_us_wa_dor_lni',
|
||||
'l10n_us_wa_hr_payroll.contrib_register_wador_unemp': 'l10n_us_hr_payroll.contrib_register_us_wa_dor',
|
||||
|
||||
@@ -16,5 +16,8 @@ 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_tx_texas_payslip_2019
|
||||
from . import test_us_tx_texas_payslip_2020
|
||||
|
||||
from . import test_us_wa_washington_payslip_2019
|
||||
from . import test_us_wa_washington_payslip_2020
|
||||
|
||||
100
l10n_us_hr_payroll/tests/test_us_tx_texas_payslip_2019.py
Executable file
100
l10n_us_hr_payroll/tests/test_us_tx_texas_payslip_2019.py
Executable file
@@ -0,0 +1,100 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from .common import TestUsPayslip, process_payslip
|
||||
from odoo.addons.l10n_us_hr_payroll.models.hr_contract import USHRContract
|
||||
|
||||
class TestUsTXPayslip(TestUsPayslip):
|
||||
###
|
||||
# 2019 Taxes and Rates
|
||||
###
|
||||
TX_UNEMP_MAX_WAGE = 9000.0
|
||||
TX_UNEMP = -2.7 / 100.0
|
||||
TX_OA = 0.0
|
||||
TX_ETIA = -0.1 / 100.0
|
||||
|
||||
def test_2019_taxes(self):
|
||||
salary = 5000.0
|
||||
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=salary,
|
||||
state_id=self.get_us_state('TX'),
|
||||
)
|
||||
|
||||
self._log('2019 Texas tax first payslip:')
|
||||
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
rules = self._getRules(payslip)
|
||||
|
||||
self.assertPayrollEqual(rules['ER_US_TX_SUTA'], salary * self.TX_UNEMP)
|
||||
self.assertPayrollEqual(rules['ER_US_TX_SUTA_OA'], salary * self.TX_OA)
|
||||
self.assertPayrollEqual(rules['ER_US_TX_SUTA_ETIA'], salary * self.TX_ETIA)
|
||||
|
||||
process_payslip(payslip)
|
||||
|
||||
# Make a new payslip, this one will have maximums
|
||||
|
||||
remaining_tx_unemp_wages = self.TX_UNEMP_MAX_WAGE - salary if (self.TX_UNEMP_MAX_WAGE - 2*salary < salary) \
|
||||
else salary
|
||||
|
||||
self._log('2019 Texas tax second payslip:')
|
||||
payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
rules = self._getRules(payslip)
|
||||
|
||||
self.assertPayrollEqual(rules['ER_US_TX_SUTA'], remaining_tx_unemp_wages * self.TX_UNEMP)
|
||||
|
||||
def test_2019_taxes_with_external(self):
|
||||
salary = 5000.0
|
||||
external_wages = 6000.0
|
||||
|
||||
employee = self._createEmployee()
|
||||
|
||||
contract = self._createContract(employee,
|
||||
wage=salary,
|
||||
state_id=self.get_us_state('TX'),
|
||||
external_wages=external_wages,
|
||||
)
|
||||
|
||||
self._log('2019 Texas_external tax first payslip:')
|
||||
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
rules = self._getRules(payslip)
|
||||
|
||||
expected_wage = self.TX_UNEMP_MAX_WAGE - external_wages
|
||||
self.assertPayrollEqual(rules['ER_US_TX_SUTA'], expected_wage * self.TX_UNEMP)
|
||||
self.assertPayrollEqual(rules['ER_US_TX_SUTA_OA'], expected_wage * self.TX_OA)
|
||||
self.assertPayrollEqual(rules['ER_US_TX_SUTA_ETIA'], expected_wage * self.TX_ETIA)
|
||||
|
||||
def test_2019_taxes_with_state_exempt(self):
|
||||
salary = 5000.0
|
||||
external_wages = 6000.0
|
||||
|
||||
employee = self._createEmployee()
|
||||
|
||||
contract = self._createContract(employee,
|
||||
wage=salary,
|
||||
state_id=self.get_us_state('TX'),
|
||||
external_wages=external_wages,
|
||||
futa_type=USHRContract.FUTA_TYPE_BASIC)
|
||||
|
||||
self._log('2019 Texas_external tax first payslip:')
|
||||
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
rules = self._getRules(payslip)
|
||||
|
||||
self.assertPayrollEqual(rules.get('ER_US_TX_SUTA', 0.0), 0.0)
|
||||
self.assertPayrollEqual(rules.get('ER_US_TX_SUTA_OA', 0.0), 0.0)
|
||||
self.assertPayrollEqual(rules.get('ER_US_TX_SUTA_ETIA', 0.0), 0.0)
|
||||
17
l10n_us_hr_payroll/tests/test_us_tx_texas_payslip_2020.py
Executable file
17
l10n_us_hr_payroll/tests/test_us_tx_texas_payslip_2020.py
Executable file
@@ -0,0 +1,17 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from datetime import date
|
||||
from .common import TestUsPayslip
|
||||
|
||||
class TestUsTXPayslip(TestUsPayslip):
|
||||
###
|
||||
# 2020 Taxes and Rates
|
||||
###
|
||||
TX_UNEMP_MAX_WAGE = 9000.0
|
||||
TX_UNEMP = 2.7
|
||||
TX_OA = 0.0
|
||||
TX_ETIA = 0.1
|
||||
|
||||
def test_2020_taxes(self):
|
||||
combined_rate = self.TX_UNEMP + self.TX_OA + self.TX_ETIA
|
||||
self._test_er_suta('TX', combined_rate, date(2020, 1, 1), wage_base=self.TX_UNEMP_MAX_WAGE)
|
||||
@@ -63,6 +63,9 @@
|
||||
<field name="state_income_tax_exempt"/>
|
||||
<field name="state_income_tax_additional_withholding"/>
|
||||
</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>
|
||||
<group name="state_wa_washington" string="WA Washington" attrs="{'invisible':[('state_id', '!=', %(base.state_us_48)s)]}">
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user