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_oh_hr_payroll' into mig/12.0/us_payroll
This commit is contained in:
68
l10n_us_oh_hr_payroll/README.rst
Normal file
68
l10n_us_oh_hr_payroll/README.rst
Normal file
@@ -0,0 +1,68 @@
|
||||
*******************************
|
||||
Hibou - US Payroll - Ohio State
|
||||
*******************************
|
||||
|
||||
Calculations and contribution registers for Ohio State Payroll.
|
||||
|
||||
For more information and add-ons, visit `Hibou.io <https://hibou.io/>`_.
|
||||
|
||||
=============
|
||||
Main Features
|
||||
=============
|
||||
|
||||
* New Ohio Department of Revenue partner
|
||||
* Contribution Registers for:
|
||||
* Ohio Department of Revenue - Unemployment
|
||||
* Ohio Department of Revenue - Income Tax withholding
|
||||
* Contract level Ohio Withholding Allowance
|
||||
* Company level Ohio Unemployment Rate
|
||||
|
||||
.. image:: https://user-images.githubusercontent.com/15882954/41481725-e1cbd3c4-7087-11e8-8bf7-84843bb2f943.png
|
||||
:alt: 'Employee Contract Detail'
|
||||
:width: 988
|
||||
:align: left
|
||||
|
||||
USA Ohio Employee added to Contract Salary Structure Menu
|
||||
|
||||
.. image:: https://user-images.githubusercontent.com/15882954/41481743-f1eceb4e-7087-11e8-8d09-dd45551a3fa4.png
|
||||
:alt: 'Computed Pay Slip Detail'
|
||||
:width: 988
|
||||
:align: left
|
||||
|
||||
New Payslip Categories for:
|
||||
|
||||
* Ohio Income Withholding
|
||||
* Ohio Unemployment - Wages
|
||||
* Ohio Unemployment
|
||||
|
||||
Upgrading to 2019
|
||||
==========================
|
||||
|
||||
If you were using this prior to January 2019, then you will need to run the following
|
||||
migration script.
|
||||
|
||||
Odoo Shell code::
|
||||
|
||||
def migrate_rule_name(rule_id):
|
||||
main = env.ref(rule_id)
|
||||
old_2017 = env.ref(rule_id.replace('2018', '2017'))
|
||||
old_2016 = env.ref(rule_id.replace('2018', '2016'))
|
||||
lines = env['hr.payslip.line'].search([('salary_rule_id', 'in', [old_2017.id, old_2016.id,])])
|
||||
lines.write({'salary_rule_id': main.id})
|
||||
|
||||
rules = [
|
||||
'l10n_us_oh_hr_payroll.hr_payroll_rules_oh_unemp_wages_2018',
|
||||
'l10n_us_oh_hr_payroll.hr_payroll_rules_oh_unemp_2018',
|
||||
'l10n_us_oh_hr_payroll.hr_payroll_rules_oh_inc_withhold_2018',
|
||||
]
|
||||
for rule_id in rules:
|
||||
migrate_rule_name(rule_id)
|
||||
|
||||
env.cr.commit()
|
||||
|
||||
|
||||
=======
|
||||
License
|
||||
=======
|
||||
Please see `LICENSE <https://github.com/hibou-io/hibou-odoo-suite/blob/master/LICENSE>`_.
|
||||
Copyright Hibou Corp. 2018
|
||||
1
l10n_us_oh_hr_payroll/__init__.py
Executable file
1
l10n_us_oh_hr_payroll/__init__.py
Executable file
@@ -0,0 +1 @@
|
||||
from . import models
|
||||
29
l10n_us_oh_hr_payroll/__manifest__.py
Executable file
29
l10n_us_oh_hr_payroll/__manifest__.py
Executable file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
'name': 'USA - Ohio - 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::Ohio Payroll Rules.
|
||||
========================
|
||||
|
||||
* Ohio Department of Revenue partner
|
||||
* Contribution register for Ohio DoR Unemployment
|
||||
* Contribution register for Ohio DoR Income Tax Withholding
|
||||
* Contract level Ohio Withholding Allowance
|
||||
* Company level Ohio Unemployment Rate
|
||||
""",
|
||||
|
||||
'auto_install': False,
|
||||
'website': 'https://hibou.io/',
|
||||
'data':[
|
||||
'views/hr_payroll_views.xml',
|
||||
'data/base.xml',
|
||||
'data/rates.xml',
|
||||
'data/rules.xml',
|
||||
'data/final.xml',
|
||||
],
|
||||
'installable': True
|
||||
}
|
||||
46
l10n_us_oh_hr_payroll/data/base.xml
Executable file
46
l10n_us_oh_hr_payroll/data/base.xml
Executable file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- CONTRIBUTION REGISTERS -->
|
||||
<record id="res_partner_ohdor_unemp" model="res.partner">
|
||||
<field name="name">Ohio OBG - Unemployment</field>
|
||||
<field name="supplier">1</field>
|
||||
<field eval="0" name="customer"/>
|
||||
</record>
|
||||
<record id="res_partner_ohdor_withhold" model="res.partner">
|
||||
<field name="name">Ohio OBG - Income Withholding</field>
|
||||
<field name="supplier">1</field>
|
||||
<field eval="0" name="customer"/>
|
||||
</record>
|
||||
<record id="contrib_register_ohdor_unemp" model="hr.contribution.register">
|
||||
<field name="name">Ohio Unemployment</field>
|
||||
<field name="note">Ohio Treasurer of State - Unemployment</field>
|
||||
<field name="partner_id" ref="res_partner_ohdor_unemp"/>
|
||||
</record>
|
||||
<record id="contrib_register_ohdor_withhold" model="hr.contribution.register">
|
||||
<field name="name">Ohio Income Tax Withholding</field>
|
||||
<field name="note">Ohio Treasurer of State - Income Tax Withholding</field>
|
||||
<field name="partner_id" ref="res_partner_ohdor_withhold"/>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- HR SALARY RULE CATEGORIES-->
|
||||
<record id="hr_payroll_oh_unemp_wages" model="hr.salary.rule.category">
|
||||
<field name="name">Wage: US-OH Unemployment</field>
|
||||
<field name="code">WAGE_US_OH_UNEMP</field>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_oh_unemp" model="hr.salary.rule.category">
|
||||
<field name="name">ER: US-OH Unemployment</field>
|
||||
<field name="code">ER_US_OH_UNEMP</field>
|
||||
<field name="parent_id" ref="hr_payroll.COMP"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_oh_income_withhold" model="hr.salary.rule.category">
|
||||
<field name="name">EE: US-OH Income Withholding</field>
|
||||
<field name="code">EE_US_OH_INC_WITHHOLD</field>
|
||||
<field name="parent_id" ref="hr_payroll.DED"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
19
l10n_us_oh_hr_payroll/data/final.xml
Executable file
19
l10n_us_oh_hr_payroll/data/final.xml
Executable file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- HR PAYROLL STRUCTURE -->
|
||||
<record id="hr_payroll_salary_structure_us_oh_employee" model="hr.payroll.structure">
|
||||
<field name="code">US_OH_EMP</field>
|
||||
<field name="name">USA Ohio Employee</field>
|
||||
<field eval="[(6, 0, [
|
||||
ref('hr_payroll_rules_oh_unemp_wages_2018'),
|
||||
ref('hr_payroll_rules_oh_unemp_2018'),
|
||||
ref('hr_payroll_rules_oh_inc_withhold_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>
|
||||
19
l10n_us_oh_hr_payroll/data/rates.xml
Executable file
19
l10n_us_oh_hr_payroll/data/rates.xml
Executable file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record id="hr_payroll_rates_oh_unemp_2018" model="hr.payroll.rate">
|
||||
<field name="name">US Ohio Unemployment</field>
|
||||
<field name="code">US_OH_UNEMP</field>
|
||||
<field name="rate">2.7</field>
|
||||
<field name="date_from">2018-01-01</field>
|
||||
<field name="wage_limit_year" eval="9500.0"/>
|
||||
</record>
|
||||
<record id="hr_payroll_rates_oh_unemp_2019" model="hr.payroll.rate">
|
||||
<field name="name">US Ohio Unemployment</field>
|
||||
<field name="code">US_OH_UNEMP</field>
|
||||
<field name="rate">2.7</field>
|
||||
<field name="date_from">2019-01-01</field>
|
||||
<field name="wage_limit_year" eval="9500.0"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
128
l10n_us_oh_hr_payroll/data/rules.xml
Executable file
128
l10n_us_oh_hr_payroll/data/rules.xml
Executable file
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<!-- HR SALARY RULES-->
|
||||
<record id="hr_payroll_rules_oh_unemp_wages_2018" model="hr.salary.rule">
|
||||
<field name="sequence" eval="423"/>
|
||||
<field name="category_id" ref="hr_payroll_oh_unemp_wages"/>
|
||||
<field name="name">Wage: US-OH Unemployment</field>
|
||||
<field name="code">WAGE_US_OH_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_OH_UNEMP')
|
||||
year = payslip.dict.date_to.year
|
||||
ytd = payslip.sum('WAGE_US_OH_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_oh_unemp_2018" model="hr.salary.rule">
|
||||
<field name="sequence" eval="443"/>
|
||||
<field name="category_id" ref="hr_payroll_oh_unemp"/>
|
||||
<field name="name">ER: US-OH Unemployment</field>
|
||||
<field name="code">ER_US_OH_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_OH_UNEMP')
|
||||
result_rate = -rate.rate
|
||||
result = categories.WAGE_US_OH_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_ohdor_unemp"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_rules_oh_inc_withhold_2018" model="hr.salary.rule">
|
||||
<field name="sequence" eval="145"/>
|
||||
<field name="category_id" ref="hr_payroll_oh_income_withhold"/>
|
||||
<field name="name">EE: US-OH Income Withholding</field>
|
||||
<field name="code">EE_US_OH_INC_WITHHOLD</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result = True</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">
|
||||
year = payslip.dict.date_to.year
|
||||
wages = categories.GROSS
|
||||
allowances = contract.oh_income_allowances
|
||||
schedule_pay = contract.schedule_pay
|
||||
val = 0.00
|
||||
|
||||
PP = 0
|
||||
if 'weekly' == schedule_pay:
|
||||
PP = 52
|
||||
elif 'bi-weekly' == schedule_pay:
|
||||
PP = 26
|
||||
elif 'semi-monthly' == schedule_pay: # impossible
|
||||
PP = 24
|
||||
elif 'monthly' == schedule_pay:
|
||||
PP = 12
|
||||
elif 'quarterly' == schedule_pay:
|
||||
PP = 4
|
||||
elif 'semi-annually' == schedule_pay:
|
||||
PP = 2
|
||||
elif 'annually' == schedule_pay:
|
||||
PP = 1
|
||||
else:
|
||||
raise Exception('Invalid schedule_pay="' + schedule_pay + '" for OH Income Withholding calculation')
|
||||
|
||||
# Algorithm from https://www.tax.ohio.gov/Portals/0/employer_withholding/2019%20tables/WTH_OptionalComputerFormula_2019.pdf
|
||||
if year == 2018:
|
||||
TW = (wages * PP) - (650 * allowances)
|
||||
if TW <= 5000.0:
|
||||
WD = ((TW * 0.005) / PP) * 1.112
|
||||
elif TW <= 10000.0:
|
||||
WD = ((((TW - 5000.0) * 0.01) + 25.0) / PP) * 1.112
|
||||
elif TW <= 15000.0:
|
||||
WD = ((((TW - 10000.0) * 0.02) + 75.0) / PP) * 1.112
|
||||
elif TW <= 20000.0:
|
||||
WD = ((((TW - 15000.0) * 0.025) + 175.0) / PP) * 1.112
|
||||
elif TW <= 40000.0:
|
||||
WD = ((((TW - 20000.0) * 0.03) + 300.0) / PP) * 1.112
|
||||
elif TW <= 80000.0:
|
||||
WD = ((((TW - 40000.0) * 0.035) + 900.0) / PP) * 1.112
|
||||
elif TW <= 100000.0:
|
||||
WD = ((((TW - 80000.0) * 0.04) + 2300.0) / PP) * 1.112
|
||||
else:
|
||||
WD = ((((TW - 100000.0) * 0.05) + 3100.0) / PP) * 1.112
|
||||
else:
|
||||
TW = (wages * PP) - (650 * allowances)
|
||||
if TW <= 5000.0:
|
||||
WD = ((TW * 0.005) / PP) * 1.112
|
||||
elif TW <= 10000.0:
|
||||
WD = ((((TW - 5000.0) * 0.01) + 25.0) / PP) * 1.075
|
||||
elif TW <= 15000.0:
|
||||
WD = ((((TW - 10000.0) * 0.02) + 75.0) / PP) * 1.075
|
||||
elif TW <= 20000.0:
|
||||
WD = ((((TW - 15000.0) * 0.025) + 175.0) / PP) * 1.075
|
||||
elif TW <= 40000.0:
|
||||
WD = ((((TW - 20000.0) * 0.03) + 300.0) / PP) * 1.075
|
||||
elif TW <= 80000.0:
|
||||
WD = ((((TW - 40000.0) * 0.035) + 900.0) / PP) * 1.075
|
||||
elif TW <= 100000.0:
|
||||
WD = ((((TW - 80000.0) * 0.04) + 2300.0) / PP) * 1.075
|
||||
else:
|
||||
WD = ((((TW - 100000.0) * 0.05) + 3100.0) / PP) * 1.075
|
||||
|
||||
result = -WD
|
||||
</field>
|
||||
<field name="register_id" ref="contrib_register_ohdor_withhold"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
1
l10n_us_oh_hr_payroll/models/__init__.py
Normal file
1
l10n_us_oh_hr_payroll/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import hr_payroll
|
||||
8
l10n_us_oh_hr_payroll/models/hr_payroll.py
Executable file
8
l10n_us_oh_hr_payroll/models/hr_payroll.py
Executable file
@@ -0,0 +1,8 @@
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class USOHHrContract(models.Model):
|
||||
_inherit = 'hr.contract'
|
||||
|
||||
oh_income_allowances = fields.Integer(string='Ohio Income Allowances', default=0)
|
||||
oh_additional_withholding = fields.Float(string="Additional Withholding", default=0.0)
|
||||
2
l10n_us_oh_hr_payroll/tests/__init__.py
Executable file
2
l10n_us_oh_hr_payroll/tests/__init__.py
Executable file
@@ -0,0 +1,2 @@
|
||||
from . import test_us_oh_payslip_2018
|
||||
from . import test_us_oh_payslip_2019
|
||||
93
l10n_us_oh_hr_payroll/tests/test_us_oh_payslip_2018.py
Executable file
93
l10n_us_oh_hr_payroll/tests/test_us_oh_payslip_2018.py
Executable file
@@ -0,0 +1,93 @@
|
||||
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 TestUsOhPayslip(TestUsPayslip):
|
||||
###
|
||||
# Taxes and Rates
|
||||
###
|
||||
OH_UNEMP_MAX_WAGE = 9500.0
|
||||
OH_UNEMP = -2.7 / 100.0
|
||||
|
||||
def test_2018_taxes(self):
|
||||
salary = 5000.0
|
||||
|
||||
# For formula here
|
||||
# http://www.tax.ohio.gov/Portals/0/employer_withholding/August2015Rates/WTH_OptionalComputerFormula_073015.pdf
|
||||
tw = salary * 12 # = 60000
|
||||
wd = ((tw - 40000) * 0.035 + 900) / 12 * 1.112
|
||||
|
||||
employee = self._createEmployee()
|
||||
|
||||
contract = self._createContract(employee, salary, struct_id=self.ref('l10n_us_oh_hr_payroll.hr_payroll_salary_structure_us_oh_employee'))
|
||||
|
||||
self._log('2017 Ohio tax last payslip:')
|
||||
payslip = self._createPayslip(employee, '2017-12-01', '2017-12-31')
|
||||
payslip.compute_sheet()
|
||||
process_payslip(payslip)
|
||||
|
||||
self._log('2018 Ohio 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_OH_UNEMP'], salary)
|
||||
self.assertPayrollEqual(cats['ER_US_OH_UNEMP'], cats['WAGE_US_OH_UNEMP'] * self.OH_UNEMP)
|
||||
self.assertPayrollEqual(cats['EE_US_OH_INC_WITHHOLD'], -wd)
|
||||
|
||||
process_payslip(payslip)
|
||||
|
||||
# Make a new payslip, this one will have maximums
|
||||
|
||||
remaining_oh_unemp_wages = self.OH_UNEMP_MAX_WAGE - salary if (self.OH_UNEMP_MAX_WAGE - 2*salary < salary) \
|
||||
else salary
|
||||
|
||||
self._log('2018 Ohio 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_OH_UNEMP'], remaining_oh_unemp_wages)
|
||||
self.assertPayrollEqual(cats['ER_US_OH_UNEMP'], remaining_oh_unemp_wages * self.OH_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_oh_hr_payroll.hr_payroll_salary_structure_us_oh_employee'))
|
||||
|
||||
self._log('2018 Ohio_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_OH_UNEMP'], self.OH_UNEMP_MAX_WAGE - external_wages)
|
||||
self.assertPayrollEqual(cats['ER_US_OH_UNEMP'], cats['WAGE_US_OH_UNEMP'] * self.OH_UNEMP)
|
||||
|
||||
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_oh_hr_payroll.hr_payroll_salary_structure_us_oh_employee'), futa_type=USHrContract.FUTA_TYPE_BASIC)
|
||||
|
||||
self._log('2018 Ohio exempt tax first payslip:')
|
||||
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
# FUTA_TYPE_BASIC
|
||||
self.assertPayrollEqual(cats.get('WAGE_US_OH_UNEMP', 0.0), 0.0)
|
||||
self.assertPayrollEqual(cats.get('ER_US_OH_UNEMP', 0.0), cats.get('WAGE_US_OH_UNEMP', 0.0) * 0.0)
|
||||
93
l10n_us_oh_hr_payroll/tests/test_us_oh_payslip_2019.py
Executable file
93
l10n_us_oh_hr_payroll/tests/test_us_oh_payslip_2019.py
Executable file
@@ -0,0 +1,93 @@
|
||||
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 TestUsOhPayslip(TestUsPayslip):
|
||||
###
|
||||
# Taxes and Rates
|
||||
###
|
||||
OH_UNEMP_MAX_WAGE = 9500.0
|
||||
OH_UNEMP = -2.7 / 100.0
|
||||
|
||||
def test_2019_taxes(self):
|
||||
salary = 5000.0
|
||||
|
||||
# For formula here
|
||||
# http://www.tax.ohio.gov/Portals/0/employer_withholding/August2015Rates/WTH_OptionalComputerFormula_073015.pdf
|
||||
tw = salary * 12 # = 60000
|
||||
wd = ((tw - 40000) * 0.035 + 900) / 12 * 1.075
|
||||
|
||||
employee = self._createEmployee()
|
||||
|
||||
contract = self._createContract(employee, salary, struct_id=self.ref('l10n_us_oh_hr_payroll.hr_payroll_salary_structure_us_oh_employee'))
|
||||
|
||||
self._log('2018 Ohio tax last payslip:')
|
||||
payslip = self._createPayslip(employee, '2018-12-01', '2018-12-31')
|
||||
payslip.compute_sheet()
|
||||
process_payslip(payslip)
|
||||
|
||||
self._log('2019 Ohio 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_OH_UNEMP'], salary)
|
||||
self.assertPayrollEqual(cats['ER_US_OH_UNEMP'], cats['WAGE_US_OH_UNEMP'] * self.OH_UNEMP)
|
||||
self.assertPayrollEqual(cats['EE_US_OH_INC_WITHHOLD'], -wd)
|
||||
|
||||
process_payslip(payslip)
|
||||
|
||||
# Make a new payslip, this one will have maximums
|
||||
|
||||
remaining_oh_unemp_wages = self.OH_UNEMP_MAX_WAGE - salary if (self.OH_UNEMP_MAX_WAGE - 2*salary < salary) \
|
||||
else salary
|
||||
|
||||
self._log('2019 Ohio 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_OH_UNEMP'], remaining_oh_unemp_wages)
|
||||
self.assertPayrollEqual(cats['ER_US_OH_UNEMP'], remaining_oh_unemp_wages * self.OH_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_oh_hr_payroll.hr_payroll_salary_structure_us_oh_employee'))
|
||||
|
||||
self._log('2019 Ohio_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_OH_UNEMP'], self.OH_UNEMP_MAX_WAGE - external_wages)
|
||||
self.assertPayrollEqual(cats['ER_US_OH_UNEMP'], cats['WAGE_US_OH_UNEMP'] * self.OH_UNEMP)
|
||||
|
||||
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_oh_hr_payroll.hr_payroll_salary_structure_us_oh_employee'), futa_type=USHrContract.FUTA_TYPE_BASIC)
|
||||
|
||||
self._log('2019 Ohio exempt tax first payslip:')
|
||||
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||
|
||||
payslip.compute_sheet()
|
||||
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
# FUTA_TYPE_BASIC
|
||||
self.assertPayrollEqual(cats.get('WAGE_US_OH_UNEMP', 0.0), 0.0)
|
||||
self.assertPayrollEqual(cats.get('ER_US_OH_UNEMP', 0.0), cats.get('WAGE_US_OH_UNEMP', 0.0) * 0.0)
|
||||
21
l10n_us_oh_hr_payroll/views/hr_payroll_views.xml
Executable file
21
l10n_us_oh_hr_payroll/views/hr_payroll_views.xml
Executable file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="hr_contract_form_l10n_us_oh_inherit" model="ir.ui.view">
|
||||
<field name="name">hr.contract.form.inherit</field>
|
||||
<field name="model">hr.contract</field>
|
||||
<field name="priority">130</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="Ohio" name="oh">
|
||||
<field name="oh_income_allowances" string="Allowances"/>
|
||||
<field name="oh_additional_withholding" string="Additional Withholding"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user