mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
This refactor bases all/most 'wage' categories off of BASIC instead of GROSS to allow all 'Income Tax' rules to continue to be based on GROSS.
105 lines
3.8 KiB
XML
Executable File
105 lines
3.8 KiB
XML
Executable File
<?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">Ohio Unemployment - Wages (2018)</field>
|
|
<field name="code">OH_UNEMP_WAGES_2018</field>
|
|
<field name="condition_select">python</field>
|
|
<field name="condition_python">result = (payslip.date_to[:4] == '2018')</field>
|
|
<field name="amount_select">code</field>
|
|
<field name="amount_python_compute">
|
|
###
|
|
ytd = payslip.sum('OH_UNEMP_WAGES_2018', '2018-01-01', '2019-01-01')
|
|
ytd += contract.external_wages
|
|
remaining = 9500.0 - 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">Ohio Unemployment (2018)</field>
|
|
<field name="code">OH_UNEMP_2018</field>
|
|
<field name="condition_select">python</field>
|
|
<field name="condition_python">result = (payslip.date_to[:4] == '2018')</field>
|
|
<field name="amount_select">code</field>
|
|
<field name="amount_python_compute">
|
|
result_rate = -contract.oh_unemp_rate(2018)
|
|
result = categories.OH_UNEMP_WAGES
|
|
|
|
# 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">Ohio Income Withholding</field>
|
|
<field name="code">OH_INC_WITHHOLD_2018</field>
|
|
<field name="condition_select">python</field>
|
|
<field name="condition_python">result = (payslip.date_to[:4] == '2018')</field>
|
|
<field name="amount_select">code</field>
|
|
<field name="amount_python_compute">
|
|
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 http://www.tax.ohio.gov/Portals/0/employer_withholding/August2015Rates/WTH_OptionalComputerFormula_073015.pdf
|
|
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
|
|
result = -WD
|
|
</field>
|
|
<field name="register_id" ref="contrib_register_ohdor_withhold"/>
|
|
</record>
|
|
|
|
</data>
|
|
</odoo>
|