mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
FIX Correct payslip wage base for payslips in two years. Add 2019 Ohio Tax Withholding rate.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<field name="amount_python_compute">
|
||||
###
|
||||
rate = payslip.dict.get_rate('US_CA_UNEMP')
|
||||
year = int(payslip.dict.date_from[:4])
|
||||
year = int(payslip.dict.date_to[:4])
|
||||
ytd = payslip.sum('WAGE_US_CA_UNEMP', str(year) + '-01-01', str(year+1) + '-01-01')
|
||||
ytd += contract.external_wages
|
||||
remaining = rate.wage_limit_year - ytd
|
||||
@@ -62,7 +62,7 @@ if result_rate == 0.0:
|
||||
<field name="amount_python_compute">
|
||||
###
|
||||
rate = payslip.dict.get_rate('US_CA_ETT')
|
||||
year = int(payslip.dict.date_from[:4])
|
||||
year = int(payslip.dict.date_to[:4])
|
||||
ytd = payslip.sum('WAGE_US_CA_ETT', str(year) + '-01-01', str(year+1) + '-01-01')
|
||||
ytd += contract.external_wages
|
||||
remaining = rate.wage_limit_year - ytd
|
||||
@@ -109,7 +109,7 @@ if result_rate == 0.0:
|
||||
<field name="amount_python_compute">
|
||||
###
|
||||
rate = payslip.dict.get_rate('US_CA_SDI')
|
||||
year = int(payslip.dict.date_from[:4])
|
||||
year = int(payslip.dict.date_to[:4])
|
||||
ytd = payslip.sum('WAGE_US_CA_SDI', str(year) + '-01-01', str(year+1) + '-01-01')
|
||||
ytd += contract.external_wages
|
||||
remaining = rate.wage_limit_year - ytd
|
||||
@@ -154,7 +154,7 @@ if result_rate == 0.0:
|
||||
<field name="condition_python">result = True</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">
|
||||
year = int(payslip.dict.date_from[:4])
|
||||
year = int(payslip.dict.date_to[:4])
|
||||
wages = categories.GROSS
|
||||
allowances = contract.ca_de4_allowances
|
||||
additional_allowances = contract.ca_additional_allowances
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">
|
||||
rate = payslip.dict.get_rate('US_NC_UNEMP')
|
||||
year = int(payslip.dict.date_from[:4])
|
||||
year = int(payslip.dict.date_to[:4])
|
||||
ytd = payslip.sum('NC_UNEMP_WAGES_2018', str(year) + '-01-01', str(year+1) + '-01-01')
|
||||
ytd += contract.external_wages
|
||||
remaining = rate.wage_limit_year - ytd
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">
|
||||
###
|
||||
year = int(payslip.dict.date_from[:4])
|
||||
year = int(payslip.dict.date_to[:4])
|
||||
rate = payslip.dict.get_rate('ER_US_NJ_UNEMP')
|
||||
ytd = payslip.sum('WAGE_US_NJ_UNEMP', str(year) + '-01-01', str(year+1) + '-01-01')
|
||||
ytd += contract.external_wages
|
||||
@@ -81,7 +81,7 @@ if result_rate == 0.0:
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">
|
||||
###
|
||||
year = int(payslip.dict.date_from[:4])
|
||||
year = int(payslip.dict.date_to[:4])
|
||||
rate = payslip.dict.get_rate('ER_US_NJ_SDI')
|
||||
ytd = payslip.sum('WAGE_US_NJ_SDI', str(year) + '-01-01', str(year+1) + '-01-01')
|
||||
ytd += contract.external_wages
|
||||
@@ -147,7 +147,7 @@ if result_rate == 0.0:
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">
|
||||
###
|
||||
year = int(payslip.dict.date_from[:4])
|
||||
year = int(payslip.dict.date_to[:4])
|
||||
rate = payslip.dict.get_rate('ER_US_NJ_FLI')
|
||||
ytd = payslip.sum('WAGE_US_NJ_FLI', str(year) + '-01-01', str(year+1) + '-01-01')
|
||||
ytd += contract.external_wages
|
||||
@@ -189,7 +189,7 @@ result = categories.BASIC
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">
|
||||
###
|
||||
year = int(payslip.dict.date_from[:4])
|
||||
year = int(payslip.dict.date_to[:4])
|
||||
rate = payslip.dict.get_rate('ER_US_NJ_WF')
|
||||
ytd = payslip.sum('WAGE_US_NJ_WF', str(year) + '-01-01', str(year+1) + '-01-01')
|
||||
ytd += contract.external_wages
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<field name="amount_python_compute">
|
||||
###
|
||||
rate = payslip.dict.get_rate('US_OH_UNEMP')
|
||||
year = int(payslip.dict.date_from[:4])
|
||||
year = int(payslip.dict.date_to[:4])
|
||||
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
|
||||
@@ -57,6 +57,7 @@ if result_rate == 0.0:
|
||||
<field name="condition_python">result = True</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">
|
||||
year = int(payslip.dict.date_to[:4])
|
||||
wages = categories.GROSS
|
||||
allowances = contract.oh_income_allowances
|
||||
schedule_pay = contract.schedule_pay
|
||||
@@ -80,24 +81,44 @@ elif 'annually' == schedule_pay:
|
||||
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
|
||||
# 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:
|
||||
WD = ((((TW - 100000.0) * 0.05) + 3100.0) / PP) * 1.112
|
||||
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"/>
|
||||
|
||||
@@ -17,7 +17,7 @@ class TestUsOhPayslip(TestUsPayslip):
|
||||
# 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
|
||||
wd = ((tw - 40000) * 0.035 + 900) / 12 * 1.075
|
||||
|
||||
employee = self._createEmployee()
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">
|
||||
###
|
||||
year = int(payslip.dict.date_from[:4])
|
||||
year = int(payslip.dict.date_to[:4])
|
||||
rate = payslip.dict.get_rate('ER_US_PA_UNEMP')
|
||||
ytd = payslip.sum('WAGE_ER_US_PA_UNEMP', str(year) + '-01-01', str(year+1) + '-01-01')
|
||||
ytd += contract.external_wages
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<field name="amount_python_compute">
|
||||
###
|
||||
rate = payslip.dict.get_rate('US_TX_UNEMP')
|
||||
year = int(payslip.dict.date_from[:4])
|
||||
year = int(payslip.dict.date_to[:4])
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user