mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
#31 Merge branch 'mig/12.0/l10n_us_tx_hr_payroll' into mig/12.0/us_payroll
This commit is contained in:
43
l10n_us_tx_hr_payroll/README.rst
Normal file
43
l10n_us_tx_hr_payroll/README.rst
Normal file
@@ -0,0 +1,43 @@
|
||||
***************************************
|
||||
Hibou - US Payroll - Texas State
|
||||
***************************************
|
||||
|
||||
Calculations and contribution registers for Texas State Payroll.
|
||||
|
||||
For more information and add-ons, visit `Hibou.io <https://hibou.io/>`_.
|
||||
|
||||
=============
|
||||
Main Features
|
||||
=============
|
||||
|
||||
* New Partner and Contribution Register for Texas Workforce Commission
|
||||
* Company level Texas Unemployment Rate
|
||||
* Company level Texas Obligation Assessment Rate
|
||||
* Company level Texas Employment & Training Investment Assessment
|
||||
|
||||
|
||||
.. image:: https://user-images.githubusercontent.com/15882954/41480987-2a50aa14-7085-11e8-99d4-24773869d2e3.png
|
||||
:alt: 'Employee Contract Detail'
|
||||
:width: 988
|
||||
:align: left
|
||||
|
||||
USA Texas Employee Added to Salary Structure Menu
|
||||
|
||||
.. image:: https://user-images.githubusercontent.com/15882954/41480994-330626f2-7085-11e8-8ca0-d41d621182ff.png
|
||||
:alt: 'Computed Pay Slip Detail'
|
||||
:width: 988
|
||||
:align: left
|
||||
|
||||
New Payslip Categories for:
|
||||
|
||||
* Texas Unemployment - Wages
|
||||
* Texas Unemployment
|
||||
* Texas Obligation Assessment
|
||||
* Texas Employment and Training Investment Assessment
|
||||
|
||||
|
||||
=======
|
||||
License
|
||||
=======
|
||||
Please see `LICENSE <https://github.com/hibou-io/hibou-odoo-suite/blob/master/LICENSE>`_.
|
||||
Copyright Hibou Corp. 2018
|
||||
1
l10n_us_tx_hr_payroll/__init__.py
Executable file
1
l10n_us_tx_hr_payroll/__init__.py
Executable file
@@ -0,0 +1 @@
|
||||
|
||||
29
l10n_us_tx_hr_payroll/__manifest__.py
Executable file
29
l10n_us_tx_hr_payroll/__manifest__.py
Executable file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
'name': 'USA - Texas - Payroll',
|
||||
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||
'license': 'AGPL-3',
|
||||
'category': 'Localization',
|
||||
'depends': ['l10n_us_hr_payroll'],
|
||||
'version': '12.0.2019.0.0',
|
||||
'description': """
|
||||
USA::Texas Payroll Rules.
|
||||
=========================
|
||||
|
||||
* Texas Workforce Commission partner
|
||||
* Contribution register for Texas Workforce Commission
|
||||
* Company level Texas Umemployment Rate
|
||||
* Company level Texas Obligation Assessment Rate
|
||||
* Company level Texas Employment & Training Investment Assessment
|
||||
""",
|
||||
|
||||
'auto_install': False,
|
||||
'website': 'https://hibou.io/',
|
||||
'data':[
|
||||
'views/us_tx_hr_payroll_views.xml',
|
||||
'data/base.xml',
|
||||
'data/rates.xml',
|
||||
'data/rules.xml',
|
||||
'data/final.xml',
|
||||
],
|
||||
'installable': True
|
||||
}
|
||||
53
l10n_us_tx_hr_payroll/data/base.xml
Executable file
53
l10n_us_tx_hr_payroll/data/base.xml
Executable file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- CONTRIBUTION REGISTERS -->
|
||||
<record id="res_partner_txdor" model="res.partner">
|
||||
<field name="name">Texas Workforce Commission</field>
|
||||
<field name="supplier">1</field>
|
||||
<field eval="0" name="customer"/>
|
||||
</record>
|
||||
<record id="contrib_register_txdor" model="hr.contribution.register">
|
||||
<field name="name">Texas Unemployment</field>
|
||||
<field name="note">Texas Workforce Commission - Unemployment</field>
|
||||
<field name="partner_id" ref="res_partner_txdor"/>
|
||||
</record>
|
||||
<record id="contrib_register_txdor" model="hr.contribution.register">
|
||||
<field name="name">Texas Obligation Assessment</field>
|
||||
<field name="note">Texas Workforce Commission - Obligation Assessment</field>
|
||||
<field name="partner_id" ref="res_partner_txdor"/>
|
||||
</record>
|
||||
<record id="contrib_register_txdor" model="hr.contribution.register">
|
||||
<field name="name">Texas Employment and Training Investment Assessment</field>
|
||||
<field name="note">Texas Workforce Commission - Employment and Trainging Investment Assessment</field>
|
||||
<field name="partner_id" ref="res_partner_txdor"/>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- HR SALARY RULE CATEGORIES-->
|
||||
<record id="hr_payroll_tx_unemp_wages" model="hr.salary.rule.category">
|
||||
<field name="name">Wage: US-TX Unemployment</field>
|
||||
<field name="code">WAGE_US_TX_UNEMP</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_tx_unemp" model="hr.salary.rule.category">
|
||||
<field name="name">ER: US-TX Unemployment</field>
|
||||
<field name="code">ER_US_TX_UNEMP</field>
|
||||
<field name="parent_id" ref="hr_payroll.COMP"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_tx_oa" model="hr.salary.rule.category">
|
||||
<field name="name">ER: US-TX Obligation Assessment</field>
|
||||
<field name="code">ER_US_TX_OA</field>
|
||||
<field name="parent_id" ref="hr_payroll.COMP"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_tx_etia" model="hr.salary.rule.category">
|
||||
<field name="name">ER: US-TX Employment & Training Investment Assessment</field>
|
||||
<field name="code">ER_US_TX_ETIA</field>
|
||||
<field name="parent_id" ref="hr_payroll.COMP"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
20
l10n_us_tx_hr_payroll/data/final.xml
Executable file
20
l10n_us_tx_hr_payroll/data/final.xml
Executable file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- HR PAYROLL STRUCTURE -->
|
||||
<record id="hr_payroll_salary_structure_us_tx_employee" model="hr.payroll.structure">
|
||||
<field name="code">US_TX_EMP</field>
|
||||
<field name="name">USA Texas Employee</field>
|
||||
<field eval="[(6, 0, [
|
||||
ref('hr_payroll_rules_tx_unemp_wages_2018'),
|
||||
ref('hr_payroll_rules_tx_unemp_2018'),
|
||||
ref('hr_payroll_rules_tx_oa_2018'),
|
||||
ref('hr_payroll_rules_tx_etia_2018'),
|
||||
])]" name="rule_ids"/>
|
||||
<field name="company_id" ref="base.main_company"/>
|
||||
<field name="parent_id" ref="l10n_us_hr_payroll.hr_payroll_salary_structure_us_employee"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
44
l10n_us_tx_hr_payroll/data/rates.xml
Executable file
44
l10n_us_tx_hr_payroll/data/rates.xml
Executable file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record id="hr_payroll_rates_tx_unemp_2018" model="hr.payroll.rate">
|
||||
<field name="name">US Texas Unemployment</field>
|
||||
<field name="code">US_TX_UNEMP</field>
|
||||
<field name="rate">2.7</field>
|
||||
<field name="date_from">2018-01-01</field>
|
||||
<field name="wage_limit_year" eval="9000.0"/>
|
||||
</record>
|
||||
<record id="hr_payroll_rates_tx_oa_2018" model="hr.payroll.rate">
|
||||
<field name="name">US Texas Obligation Assessment</field>
|
||||
<field name="code">US_TX_OA</field>
|
||||
<field name="rate">0.0</field>
|
||||
<field name="date_from">2018-01-01</field>
|
||||
</record>
|
||||
<record id="hr_payroll_rates_tx_etia_2018" model="hr.payroll.rate">
|
||||
<field name="name">US Texas Employment & Training Investment Assessment</field>
|
||||
<field name="code">US_TX_ETIA</field>
|
||||
<field name="rate">0.1</field>
|
||||
<field name="date_from">2018-01-01</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_rates_tx_unemp_2019" model="hr.payroll.rate">
|
||||
<field name="name">US Texas Unemployment</field>
|
||||
<field name="code">US_TX_UNEMP</field>
|
||||
<field name="rate">2.7</field>
|
||||
<field name="date_from">2019-01-01</field>
|
||||
<field name="wage_limit_year" eval="9000.0"/>
|
||||
</record>
|
||||
<record id="hr_payroll_rates_tx_oa_2019" model="hr.payroll.rate">
|
||||
<field name="name">US Texas Obligation Assessment</field>
|
||||
<field name="code">US_TX_OA</field>
|
||||
<field name="rate">0.0</field>
|
||||
<field name="date_from">2019-01-01</field>
|
||||
</record>
|
||||
<record id="hr_payroll_rates_tx_etia_2019" model="hr.payroll.rate">
|
||||
<field name="name">US Texas Employment & Training Investment Assessment</field>
|
||||
<field name="code">US_TX_ETIA</field>
|
||||
<field name="rate">0.1</field>
|
||||
<field name="date_from">2019-01-01</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
92
l10n_us_tx_hr_payroll/data/rules.xml
Executable file
92
l10n_us_tx_hr_payroll/data/rules.xml
Executable file
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- HR SALARY RULES-->
|
||||
<record id="hr_payroll_rules_tx_unemp_wages_2018" model="hr.salary.rule">
|
||||
<field name="sequence" eval="423"/>
|
||||
<field name="category_id" ref="hr_payroll_tx_unemp_wages"/>
|
||||
<field name="name">Wage: US-TX Unemployment</field>
|
||||
<field name="code">WAGE_US_TX_UNEMP</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result = (contract.futa_type != contract.FUTA_TYPE_BASIC)</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">
|
||||
###
|
||||
rate = payslip.dict.get_rate('US_TX_UNEMP')
|
||||
year = payslip.dict.date_to.year
|
||||
ytd = payslip.sum('WAGE_US_TX_UNEMP', str(year) + '-01-01', str(year+1) + '-01-01')
|
||||
ytd += contract.external_wages
|
||||
remaining = rate.wage_limit_year - ytd
|
||||
if remaining <= 0.0:
|
||||
result = 0
|
||||
elif remaining < categories.BASIC:
|
||||
result = remaining
|
||||
else:
|
||||
result = categories.BASIC
|
||||
</field>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
<record id="hr_payroll_rules_tx_unemp_2018" model="hr.salary.rule">
|
||||
<field name="sequence" eval="443"/>
|
||||
<field name="category_id" ref="hr_payroll_tx_unemp"/>
|
||||
<field name="name">ER: US-TX Unemployment</field>
|
||||
<field name="code">ER_US_TX_UNEMP</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result = (contract.futa_type != contract.FUTA_TYPE_BASIC)</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">
|
||||
rate = payslip.dict.get_rate('US_TX_UNEMP')
|
||||
result_rate = -rate.rate
|
||||
result = categories.WAGE_US_TX_UNEMP
|
||||
|
||||
# result_rate of 0 implies 100% due to bug
|
||||
if result_rate == 0.0:
|
||||
result = 0.0
|
||||
</field>
|
||||
<field name="register_id" ref="contrib_register_txdor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
<record id="hr_payroll_rules_tx_oa_2018" model="hr.salary.rule">
|
||||
<field name="sequence" eval="443"/>
|
||||
<field name="category_id" ref="hr_payroll_tx_oa"/>
|
||||
<field name="name">ER: US-TX Obligation Assessment</field>
|
||||
<field name="code">ER_US_TX_OA</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result = (contract.futa_type != contract.FUTA_TYPE_BASIC)</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">
|
||||
rate = payslip.dict.get_rate('US_TX_OA')
|
||||
result_rate = -rate.rate
|
||||
result = categories.WAGE_US_TX_UNEMP
|
||||
|
||||
# result_rate of 0 implies 100% due to bug
|
||||
if result_rate == 0.0:
|
||||
result = 0.0
|
||||
</field>
|
||||
<field name="register_id" ref="contrib_register_txdor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
<record id="hr_payroll_rules_tx_etia_2018" model="hr.salary.rule">
|
||||
<field name="sequence" eval="443"/>
|
||||
<field name="category_id" ref="hr_payroll_tx_etia"/>
|
||||
<field name="name">ER: US-TX Employment & Training Investment Assessment</field>
|
||||
<field name="code">ER_US_TX_ETIA</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result = (contract.futa_type != contract.FUTA_TYPE_BASIC)</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">
|
||||
rate = payslip.dict.get_rate('US_TX_ETIA')
|
||||
result_rate = -rate.rate
|
||||
result = categories.WAGE_US_TX_UNEMP
|
||||
|
||||
# result_rate of 0 implies 100% due to bug
|
||||
if result_rate == 0.0:
|
||||
result = 0.0
|
||||
</field>
|
||||
<field name="register_id" ref="contrib_register_txdor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
2
l10n_us_tx_hr_payroll/tests/__init__.py
Executable file
2
l10n_us_tx_hr_payroll/tests/__init__.py
Executable file
@@ -0,0 +1,2 @@
|
||||
from . import test_us_tx_payslip_2018
|
||||
from . import test_us_tx_payslip_2019
|
||||
128
l10n_us_tx_hr_payroll/tests/test_us_tx_payslip_2018.py
Executable file
128
l10n_us_tx_hr_payroll/tests/test_us_tx_payslip_2018.py
Executable file
@@ -0,0 +1,128 @@
|
||||
from odoo.addons.l10n_us_hr_payroll.tests.test_us_payslip import TestUsPayslip, process_payslip
|
||||
from odoo.addons.l10n_us_hr_payroll.models.l10n_us_hr_payroll import USHrContract
|
||||
|
||||
|
||||
class TestUsTXPayslip(TestUsPayslip):
|
||||
###
|
||||
# 2018 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_2018_taxes(self):
|
||||
salary = 5000.0
|
||||
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee, salary, struct_id=self.ref('l10n_us_tx_hr_payroll.hr_payroll_salary_structure_us_tx_employee'))
|
||||
|
||||
self._log('2018 Texas tax first payslip:')
|
||||
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['WAGE_US_TX_UNEMP'], salary)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_UNEMP'], cats['WAGE_US_TX_UNEMP'] * self.TX_UNEMP)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_OA'], cats['WAGE_US_TX_UNEMP'] * self.TX_OA)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_ETIA'], cats['WAGE_US_TX_UNEMP'] * 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('2018 Texas tax second payslip:')
|
||||
payslip = self._createPayslip(employee, '2018-02-01', '2018-02-28')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['WAGE_US_TX_UNEMP'], remaining_tx_unemp_wages)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_UNEMP'], remaining_tx_unemp_wages * self.TX_UNEMP)
|
||||
|
||||
def test_2018_taxes_with_external(self):
|
||||
salary = 5000.0
|
||||
external_wages = 6000.0
|
||||
|
||||
employee = self._createEmployee()
|
||||
|
||||
contract = self._createContract(employee, salary, external_wages=external_wages,
|
||||
struct_id=self.ref('l10n_us_tx_hr_payroll.hr_payroll_salary_structure_us_tx_employee'))
|
||||
|
||||
self._log('2018 Texas_external tax first payslip:')
|
||||
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['WAGE_US_TX_UNEMP'], self.TX_UNEMP_MAX_WAGE - external_wages)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_UNEMP'], cats['WAGE_US_TX_UNEMP'] * self.TX_UNEMP)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_OA'], cats['WAGE_US_TX_UNEMP'] * self.TX_OA)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_ETIA'], cats['WAGE_US_TX_UNEMP'] * self.TX_ETIA)
|
||||
|
||||
def test_2018_taxes_with_state_exempt(self):
|
||||
salary = 5000.0
|
||||
external_wages = 6000.0
|
||||
|
||||
employee = self._createEmployee()
|
||||
|
||||
contract = self._createContract(employee, salary, external_wages=external_wages, struct_id=self.ref(
|
||||
'l10n_us_tx_hr_payroll.hr_payroll_salary_structure_us_tx_employee'), futa_type=USHrContract.FUTA_TYPE_BASIC)
|
||||
|
||||
self._log('2018 Texas_external tax first payslip:')
|
||||
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats.get('WAGE_US_TX_UNEMP', 0.0), 0.0)
|
||||
self.assertPayrollEqual(cats.get('ER_US_TX_UNEMP', 0.0), 0.0)
|
||||
self.assertPayrollEqual(cats.get('ER_US_TX_OA', 0.0), 0.0)
|
||||
self.assertPayrollEqual(cats.get('ER_US_TX_ETIA', 0.0), 0.0)
|
||||
|
||||
def test_payslip_example(self):
|
||||
salary = 2916.67
|
||||
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee, salary, struct_id=self.ref(
|
||||
'l10n_us_tx_hr_payroll.hr_payroll_salary_structure_us_tx_employee'))
|
||||
contract.w4_allowances = 2
|
||||
contract.w4_filing_status = 'single'
|
||||
|
||||
self._log('2018 Texas tax first payslip:')
|
||||
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['WAGE_US_TX_UNEMP'], salary)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_UNEMP'], cats['WAGE_US_TX_UNEMP'] * self.TX_UNEMP)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_OA'], cats['WAGE_US_TX_UNEMP'] * self.TX_OA)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_ETIA'], cats['WAGE_US_TX_UNEMP'] * 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('2018 Texas tax second payslip:')
|
||||
payslip = self._createPayslip(employee, '2018-02-01', '2018-02-28')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['WAGE_US_TX_UNEMP'], remaining_tx_unemp_wages)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_UNEMP'], remaining_tx_unemp_wages * self.TX_UNEMP)
|
||||
|
||||
128
l10n_us_tx_hr_payroll/tests/test_us_tx_payslip_2019.py
Executable file
128
l10n_us_tx_hr_payroll/tests/test_us_tx_payslip_2019.py
Executable file
@@ -0,0 +1,128 @@
|
||||
from odoo.addons.l10n_us_hr_payroll.tests.test_us_payslip import TestUsPayslip, process_payslip
|
||||
from odoo.addons.l10n_us_hr_payroll.models.l10n_us_hr_payroll 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, salary, struct_id=self.ref('l10n_us_tx_hr_payroll.hr_payroll_salary_structure_us_tx_employee'))
|
||||
|
||||
self._log('2019 Texas tax first payslip:')
|
||||
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['WAGE_US_TX_UNEMP'], salary)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_UNEMP'], cats['WAGE_US_TX_UNEMP'] * self.TX_UNEMP)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_OA'], cats['WAGE_US_TX_UNEMP'] * self.TX_OA)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_ETIA'], cats['WAGE_US_TX_UNEMP'] * 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)
|
||||
|
||||
self.assertPayrollEqual(cats['WAGE_US_TX_UNEMP'], remaining_tx_unemp_wages)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_UNEMP'], 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, salary, external_wages=external_wages,
|
||||
struct_id=self.ref('l10n_us_tx_hr_payroll.hr_payroll_salary_structure_us_tx_employee'))
|
||||
|
||||
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)
|
||||
|
||||
self.assertPayrollEqual(cats['WAGE_US_TX_UNEMP'], self.TX_UNEMP_MAX_WAGE - external_wages)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_UNEMP'], cats['WAGE_US_TX_UNEMP'] * self.TX_UNEMP)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_OA'], cats['WAGE_US_TX_UNEMP'] * self.TX_OA)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_ETIA'], cats['WAGE_US_TX_UNEMP'] * 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, salary, external_wages=external_wages, struct_id=self.ref(
|
||||
'l10n_us_tx_hr_payroll.hr_payroll_salary_structure_us_tx_employee'), 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)
|
||||
|
||||
self.assertPayrollEqual(cats.get('WAGE_US_TX_UNEMP', 0.0), 0.0)
|
||||
self.assertPayrollEqual(cats.get('ER_US_TX_UNEMP', 0.0), 0.0)
|
||||
self.assertPayrollEqual(cats.get('ER_US_TX_OA', 0.0), 0.0)
|
||||
self.assertPayrollEqual(cats.get('ER_US_TX_ETIA', 0.0), 0.0)
|
||||
|
||||
def test_payslip_example(self):
|
||||
salary = 2916.67
|
||||
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee, salary, struct_id=self.ref(
|
||||
'l10n_us_tx_hr_payroll.hr_payroll_salary_structure_us_tx_employee'))
|
||||
contract.w4_allowances = 2
|
||||
contract.w4_filing_status = 'single'
|
||||
|
||||
self._log('2019 Texas tax first payslip:')
|
||||
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['WAGE_US_TX_UNEMP'], salary)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_UNEMP'], cats['WAGE_US_TX_UNEMP'] * self.TX_UNEMP)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_OA'], cats['WAGE_US_TX_UNEMP'] * self.TX_OA)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_ETIA'], cats['WAGE_US_TX_UNEMP'] * 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)
|
||||
|
||||
self.assertPayrollEqual(cats['WAGE_US_TX_UNEMP'], remaining_tx_unemp_wages)
|
||||
self.assertPayrollEqual(cats['ER_US_TX_UNEMP'], remaining_tx_unemp_wages * self.TX_UNEMP)
|
||||
|
||||
20
l10n_us_tx_hr_payroll/views/us_tx_hr_payroll_views.xml
Executable file
20
l10n_us_tx_hr_payroll/views/us_tx_hr_payroll_views.xml
Executable file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="hr_contract_form_l10n_us_tx_inherit" model="ir.ui.view">
|
||||
<field name="name">hr.contract.form.inherit</field>
|
||||
<field name="model">hr.contract</field>
|
||||
<field name="priority">110</field>
|
||||
<field name="inherit_id" ref="hr_contract.hr_contract_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//group[@name='state_filing']" position="inside">
|
||||
<group string="Texas" name="tx">
|
||||
<p>No additional fields.</p>
|
||||
</group>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user