Initial commit of l10n_us_nj_hr_payroll for 11.0.

This commit is contained in:
Kristen Marie Kulha
2018-05-22 13:31:06 -07:00
committed by Jared Kipe
parent 2cf8ebd801
commit 3bed3f161a
9 changed files with 1179 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import us_nj_hr_payroll

View File

@@ -0,0 +1,31 @@
{
'name': 'USA - New Jersey - Payroll',
'author': 'Hibou Corp. <hello@hibou.io>',
'license': 'AGPL-3',
'category': 'Localization',
'depends': ['l10n_us_hr_payroll'],
'version': '11.0.2018.0.0',
'description': """
USA::New Jersey Payroll Rules.
==============================
* New Jersey Division of Taxation partner
* Contribution register for New Jersey DoT
* Company level New Jersey Unemployment Rate
* Company level New Jersey State Disability Insurance Rate
* Contract level New Jersey Unemployment Rate
* Contract level New Jersey State Disability Insurance Rate
* Contract level New Jersey Family Leave Insurance Rate
* Contract level New Jersey Workforce Development/Supplemental Workforce Funds
""",
'auto_install': False,
'website': 'https://hibou.io/',
'data':[
'us_nj_hr_payroll_view.xml',
'data/base.xml',
'data/rules_2018.xml',
'data/final.xml',
],
'installable': True
}

View File

@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- CONTRIBUTION REGISTERS -->
<record id="res_partner_njdor_unemp_employee" model="res.partner">
<field name="name">New Jersey Division of Taxation - Unemployment Insurance Tax(Employee)</field>
<field name="supplier">1</field>
<field eval="0" name="customer"/>
</record>
<record id="res_partner_njdor_unemp_company" model="res.partner">
<field name="name">New Jersey Division of Taxation - Unemployment Insurance Tax(Employer)</field>
<field name="supplier">1</field>
<field eval="0" name="customer"/>
</record>
<record id="res_partner_njdor_sdi_employee" model="res.partner">
<field name="name">New Jersey Division of Taxation - State Disability Insurance Tax(Employee)</field>
<field name="supplier">1</field>
<field eval="0" name="customer"/>
</record>
<record id="res_partner_njdor_sdi_company" model="res.partner">
<field name="name">New Jersey Division of Taxation - State Disability Insurance Tax(Employer)</field>
<field name="supplier">1</field>
<field eval="0" name="customer"/>
</record>
<record id="res_partner_njdor_fli" model="res.partner">
<field name="name">New Jersey Division of Taxation - Family Leave Insurance Tax</field>
<field name="supplier">1</field>
<field eval="0" name="customer"/>
</record>
<record id="res_partner_njdor_wf" model="res.partner">
<field name="name">New Jersey Division of Taxation - Workforce Development/Supplemental Workforce Funds Tax</field>
<field name="supplier">1</field>
<field eval="0" name="customer"/>
</record>
<record id="res_partner_njdor_withhold" model="res.partner">
<field name="name">New Jersey Division of Taxation - Income Tax Withholding</field>
<field name="supplier">1</field>
<field eval="0" name="customer"/>
</record>
<record id="contrib_register_njdor_unemp_employee" model="hr.contribution.register">
<field name="name">New Jersey Unemployment Insurance Tax</field>
<field name="note">New Jersey Division of Taxation - Unemployment Insurance Tax(Employee)</field>
<field name="partner_id" ref="res_partner_njdor_unemp_employee"/>
</record>
<record id="contrib_register_njdor_unemp_company" model="hr.contribution.register">
<field name="name">New Jersey Unemployment Insurance Tax</field>
<field name="note">New Jersey Division of Taxation - Unemployment Insurance Tax(Employer)</field>
<field name="partner_id" ref="res_partner_njdor_unemp_company"/>
</record>
<record id="contrib_register_njdor_sdi_employee" model="hr.contribution.register">
<field name="name">New Jersey State Disability Insurance</field>
<field name="note">New Jersey Division of Taxation - State Disability Insurance Tax(Employee)</field>
<field name="partner_id" ref="res_partner_njdor_sdi_employee"/>
</record>
<record id="contrib_register_njdor_sdi_company" model="hr.contribution.register">
<field name="name">New Jersey State Disability Insurance</field>
<field name="note">New Jersey Division of Taxation - State Disability Insurance Tax(Employer)</field>
<field name="partner_id" ref="res_partner_njdor_sdi_company"/>
</record>
<record id="contrib_register_njdor_fli" model="hr.contribution.register">
<field name="name">New Jersey State Family Leave Insurance</field>
<field name="note">New Jersey Division of Taxation - Family Leave Insurance Tax</field>
<field name="partner_id" ref="res_partner_njdor_fli"/>
</record>
<record id="contrib_register_njdor_wf" model="hr.contribution.register">
<field name="name">New Jersey State Workforce Development/Supplemental Workforce Funds</field>
<field name="note">New Jersey Division of Taxation - Workforce Development/Supplemental Workforce Funds Tax</field>
<field name="partner_id" ref="res_partner_njdor_wf"/>
</record>
<record id="contrib_register_njdor_withhold" model="hr.contribution.register">
<field name="name">New Jersey Income Tax Withholding</field>
<field name="note">New Jersey Division of Taxation - Income Tax Withholding</field>
<field name="partner_id" ref="res_partner_njdor_withhold"/>
</record>
<!-- HR SALARY RULE CATEGORIES-->
<record id="hr_payroll_nj_unemp_wages" model="hr.salary.rule.category">
<field name="name">New Jersey Unemployment Insurance Tax - Wages</field>
<field name="code">NJ_UNEMP_WAGES</field>
</record>
<record id="hr_payroll_nj_sdi_wages" model="hr.salary.rule.category">
<field name="name">New Jersey State Disability Insurance Tax - Wages</field>
<field name="code">NJ_SDI_WAGES</field>
</record>
<record id="hr_payroll_nj_fli_wages" model="hr.salary.rule.category">
<field name="name">New Jersey Family Leave Insurance Tax - Wages</field>
<field name="code">NJ_FLI_WAGES</field>
</record>
<record id="hr_payroll_nj_wf_wages" model="hr.salary.rule.category">
<field name="name">New Jersey Work Force Development - Wages</field>
<field name="code">NJ_WF_WAGES</field>
</record>
<record id="hr_payroll_nj_unemp_employee" model="hr.salary.rule.category">
<field name="name">New Jersey Unemployment Insurance Tax - Employee</field>
<field name="code">NJ_UNEMP_EMPLOYEE</field>
<field name="parent_id" ref="hr_payroll.DED"/>
</record>
<record id="hr_payroll_nj_unemp_company" model="hr.salary.rule.category">
<field name="name">New Jersey Unemployment Insurance Tax - Employer</field>
<field name="code">NJ_UNEMP_COMPANY</field>
<field name="parent_id" ref="hr_payroll.COMP"/>
</record>
<record id="hr_payroll_nj_sdi_company" model="hr.salary.rule.category">
<field name="name">New Jersey State Disability Insurance - Employer</field>
<field name="code">NJ_SDI_COMPANY</field>
<field name="parent_id" ref="hr_payroll.COMP"/>
</record>
<record id="hr_payroll_nj_sdi_employee" model="hr.salary.rule.category">
<field name="name">New Jersey State Disability Insurance - Employee</field>
<field name="code">NJ_SDI_EMPLOYEE</field>
<field name="parent_id" ref="hr_payroll.DED"/>
</record>
<record id="hr_payroll_nj_fli" model="hr.salary.rule.category">
<field name="name">New Jersey State Family Leave Insurance Tax</field>
<field name="code">NJ_FLI</field>
<field name="parent_id" ref="hr_payroll.DED"/>
</record>
<record id="hr_payroll_nj_wf" model="hr.salary.rule.category">
<field name="name">New Jersey State Workforce Development/Suppllemental Tax</field>
<field name="code">NJ_WF</field>
<field name="parent_id" ref="hr_payroll.DED"/>
</record>
<record id="hr_payroll_nj_income_withhold" model="hr.salary.rule.category">
<field name="name">New Jersey Income Withholding</field>
<field name="code">NJ_WITHHOLD</field>
<field name="parent_id" ref="hr_payroll.DED"/>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- HR PAYROLL STRUCTURE -->
<record id="hr_payroll_salary_structure_us_nj_employee" model="hr.payroll.structure">
<field name="code">US_NJ_EMP</field>
<field name="name">USA New Jersey Employee</field>
<field eval="[(6, 0, [
ref('hr_payroll_rules_nj_unemp_wages_2018'),
ref('hr_payroll_rules_nj_unemp_company_2018'),
ref('hr_payroll_rules_nj_unemp_employee_2018'),
ref('hr_payroll_rules_nj_inc_withhold_2018'),
ref('hr_payroll_rules_nj_sdi_wages_2018'),
ref('hr_payroll_rules_nj_sdi_company_2018'),
ref('hr_payroll_rules_nj_sdi_employee_2018'),
ref('hr_payroll_rules_nj_fli_wages_2018'),
ref('hr_payroll_rules_nj_fli_2018'),
ref('hr_payroll_rules_nj_wf_wages_2018'),
ref('hr_payroll_rules_nj_wf_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>

View File

@@ -0,0 +1,697 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- HR SALARY RULES-->
<!-- UNEMPLOYMENT -->
<record id="hr_payroll_rules_nj_unemp_wages_2018" model="hr.salary.rule">
<field name="sequence" eval="423"/>
<field name="category_id" ref="hr_payroll_nj_unemp_wages"/>
<field name="name">New Jersey Unemployment Insurance Tax - Wages (2018)</field>
<field name="code">NJ_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('NJ_UNEMP_WAGES_2018', '2018-01-01', '2019-01-01')
ytd += contract.external_wages
remaining = 33700.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
result = remaining
else:
result = categories.GROSS
</field>
<field name="appears_on_payslip" eval="False"/>
</record>
<record id="hr_payroll_rules_nj_unemp_employee_2018" model="hr.salary.rule">
<field name="sequence" eval="443"/>
<field name="category_id" ref="hr_payroll_nj_unemp_employee"/>
<field name="name">New Jersey Unemployment - Employee(2018)</field>
<field name="code">NJ_UNEMP_EMPLOYEE_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.nj_unemp_employee_rate(2018)
result = categories.NJ_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_njdor_unemp_employee"/>
<field name="appears_on_payslip" eval="False"/>
</record>
<record id="hr_payroll_rules_nj_unemp_company_2018" model="hr.salary.rule">
<field name="sequence" eval="443"/>
<field name="category_id" ref="hr_payroll_nj_unemp_company"/>
<field name="name">New Jersey Unemployment - Employer(2018)</field>
<field name="code">NJ_UNEMP_COMPANY_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.nj_unemp_company_rate(2018)
result = categories.NJ_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_njdor_unemp_employee"/>
<field name="appears_on_payslip" eval="False"/>
</record>
<!-- STATE DISABILITY INSURANCE -->
<record id="hr_payroll_rules_nj_sdi_wages_2018" model="hr.salary.rule">
<field name="sequence" eval="423"/>
<field name="category_id" ref="hr_payroll_nj_sdi_wages"/>
<field name="name">New Jersey State Disability Tax - Wages (2018)</field>
<field name="code">NJ_SDI_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('NJ_SDI_WAGES_2018', '2018-01-01', '2019-01-01')
ytd += contract.external_wages
remaining = 33700.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
result = remaining
else:
result = categories.GROSS
</field>
<field name="appears_on_payslip" eval="False"/>
</record>
<record id="hr_payroll_rules_nj_sdi_employee_2018" model="hr.salary.rule">
<field name="sequence" eval="443"/>
<field name="category_id" ref="hr_payroll_nj_sdi_employee"/>
<field name="name">New Jersey State Disability Insurance - Employee(2018)</field>
<field name="code">NJ_SDI_EMPLOYEE_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.nj_sdi_employee_rate(2018)
result = categories.NJ_SDI_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_njdor_sdi_employee"/>
<field name="appears_on_payslip" eval="False"/>
</record>
<record id="hr_payroll_rules_nj_sdi_company_2018" model="hr.salary.rule">
<field name="sequence" eval="443"/>
<field name="category_id" ref="hr_payroll_nj_sdi_company"/>
<field name="name">New Jersey State Disability Insurance - Employer(2018)</field>
<field name="code">NJ_SDI_COMPANY_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.nj_sdi_company_rate(2018)
result = categories.NJ_SDI_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_njdor_unemp_company"/>
<field name="appears_on_payslip" eval="False"/>
</record>
<!-- FAMILY LEAVE INSURANCE -->
<record id="hr_payroll_rules_nj_fli_wages_2018" model="hr.salary.rule">
<field name="sequence" eval="423"/>
<field name="category_id" ref="hr_payroll_nj_fli_wages"/>
<field name="name">New Jersey Family Leave Insurance Tax - Wages (2018)</field>
<field name="code">NJ_FLI_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('NJ_FLI_WAGES_2018', '2018-01-01', '2019-01-01')
ytd += contract.external_wages
remaining = 33700.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
result = remaining
else:
result = categories.GROSS
</field>
<field name="appears_on_payslip" eval="False"/>
</record>
<record id="hr_payroll_rules_nj_fli_2018" model="hr.salary.rule">
<field name="sequence" eval="443"/>
<field name="category_id" ref="hr_payroll_nj_fli"/>
<field name="name">New Jersey Family Leave Insurance(2018)</field>
<field name="code">NJ_FLI_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.nj_fli_rate(2018)
result = categories.NJ_FLI_WAGES
</field>
<field name="register_id" ref="contrib_register_njdor_fli"/>
<field name="appears_on_payslip" eval="False"/>
</record>
<!-- WORKFORCE DEVELOPMENT/SUPPLEMENTAL WORKFORCE FUNDS -->
<record id="hr_payroll_rules_nj_wf_wages_2018" model="hr.salary.rule">
<field name="sequence" eval="423"/>
<field name="category_id" ref="hr_payroll_nj_wf_wages"/>
<field name="name">New Jersey Workforce Development/Supplemental Workforce Funds Tax - Wages (2018)</field>
<field name="code">NJ_WF_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('NJ_WF_WAGES_2018', '2018-01-01', '2019-01-01')
ytd += contract.external_wages
remaining = 33700.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
result = remaining
else:
result = categories.GROSS
</field>
<field name="appears_on_payslip" eval="False"/>
</record>
<record id="hr_payroll_rules_nj_wf_2018" model="hr.salary.rule">
<field name="sequence" eval="443"/>
<field name="category_id" ref="hr_payroll_nj_wf"/>
<field name="name">New Jersey Workforce Development/Supplemental Workforce Funds(2018)</field>
<field name="code">NJ_WF_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.nj_wf_rate(2018)
result = categories.NJ_WF_WAGES
</field>
<field name="register_id" ref="contrib_register_njdor_wf"/>
<field name="appears_on_payslip" eval="False"/>
</record>
<!-- STATE INCOME WITHHOLDING -->
<record id="hr_payroll_rules_nj_inc_withhold_2018" model="hr.salary.rule">
<field name="sequence" eval="145"/>
<field name="category_id" ref="hr_payroll_nj_income_withhold"/>
<field name="name">New Jersey Income Withholding</field>
<field name="code">NJ_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.nj_njw4_allowances
additional_withholding = contract.nj_additional_withholding
schedule_pay = contract.schedule_pay
filing_status = contract.nj_njw4_filing_status
rate_table = contract.nj_njw4_rate_table
# Determine which rate table to use
if not rate_table:
if filing_status == 'single' or filing_status == 'married_separate':
rate_table = 'A'
elif filing_status == 'married_joint' or filing_status == 'widower' or filing_status == 'head_household':
rate_table = 'B'
# Tables are found in http://www.state.nj.us/treasury/taxation/pdf/current/njwt.pdf
# Tax Rate Tables to calculate income withholding
#### RATE 'A' ####
if rate_table == 'A':
### WEEKLY ###
if schedule_pay == 'weekly':
wages -= 19.20 * allowances
tax_rate_table = [
(384, 0.015, 0.0),
(673, 0.02, 5.76),
(769, 0.039, 11.54),
(1442, 0.061, 15.28),
(9615, 0.07, 56.34),
(float('inf'), 0.099, 628.45),
]
### BI-WEEKLY ###
elif schedule_pay == 'bi-weekly':
wages -= 38.40 * allowances
tax_rate_table = [
(769, 0.015, 0.0),
(1346, 0.02, 11.54),
(1538, 0.039, 23.08),
(2884, 0.061, 30.56),
(19231, 0.07, 112.67),
(float('inf'), 0.099, 1256.96),
]
### SEMI-MONTHLY ###
elif schedule_pay == 'semi-monthly':
wages -= 41.60 * allowances
tax_rate_table = [
(833, 0.015, 0.0),
(1458, 0.02, 12.50),
(1666, 0.039, 25.00),
(3125, 0.061, 33.11),
(20833, 0.07, 112.11),
(float('inf'), 0.099, 1361.67),
]
### MONTHLY ###
elif schedule_pay == 'monthly':
wages -= 83.30 * allowances
tax_rate_table = [
(1666, 0.015, 0.0),
(2916, 0.02, 24.99),
(3333, 0.039, 49.99),
(6250, 0.061, 66.25),
(41667, 0.07, 244.19),
(float('inf'), 0.099, 2723.38),
]
### QUARTERLY ###
elif schedule_pay == 'quarterly':
wages -= 250.00 * allowances
tax_rate_table = [
(5000, 0.015, 0.0),
(8750, 0.02, 75.00),
(10000, 0.039, 150.00),
(18750, 0.061, 198.75),
(125000, 0.07, 732.50),
(float('inf'), 0.099, 8170.00),
]
### SEMI-ANNUAL ###
elif schedule_pay == 'semi-annual':
wages -= 500 * allowances
tax_rate_table = [
(10000, 0.015, 0.0),
(17500, 0.02, 150.00),
(20000, 0.039, 300.00),
(37500, 0.061, 397.50),
(250000, 0.07, 1465.00),
(float('inf'), 0.099, 16340.00),
]
### ANNUAL ###
elif schedule_pay == 'annually':
wages -= 1000.00 * allowances
tax_rate_table = [
(20000, 0.015, 0.0),
(35000, 0.02, 300.00),
(40000, 0.039, 600.00),
(75000, 0.061, 795.00),
(500000, 0.07, 2930.00),
(float('inf'), 0.099, 32680.00),
]
#### RATE 'B' ####
elif rate_table == 'B':
### WEEKLY ###
if schedule_pay == 'weekly':
wages -= 19.20 * allowances
tax_rate_table = [
(384, 0.015, 0.0),
(961, 0.02, 5.76),
(1346, 0.027, 17.30),
(1538, 0.039, 27.70),
(2884, 0.061, 35.18),
(9615, 0.07, 117.29),
(float('inf'), 0.099, 588.46),
]
### BI-WEEKLY ###
elif schedule_pay == 'bi-weekly':
wages -= 38.40 * allowances
tax_rate_table = [
(769, 0.015, 0.0),
(1923, 0.02, 11.54),
(2692, 0.027, 34.62),
(3076, 0.039, 55.38),
(5769, 0.061, 70.35),
(19231, 0.07, 234.63),
(float('inf'), 0.099, 1176.97),
]
### SEMI-MONTHLY ###
elif schedule_pay == 'semi-monthly':
wages -= 41.60 * allowances
tax_rate_table = [
(833, 0.015, 0.0),
(2083, 0.02, 12.50),
(2916, 0.027, 37.50),
(3333, 0.039, 59.99),
(6250, 0.061, 76.25),
(20833, 0.07, 254.19),
(float('inf'), 0.099, 1275),
]
### MONTHLY ###
elif schedule_pay == 'monthly':
wages -= 83.30 * allowances
tax_rate_table = [
(1666, 0.015, 0.0),
(4166, 0.02, 24.99),
(5833, 0.027, 74.99),
(6666, 0.039, 120.00),
(12500, 0.061, 152.49),
(41667, 0.07, 508.36),
(float('inf'), 0.099, 2550.05),
]
### QUARTERLY ###
elif schedule_pay == 'quarterly':
wages -= 250.00 * allowances
tax_rate_table = [
(5000, 0.015, 0.0),
(12500, 0.02, 75.00),
(17500, 0.027, 225.00),
(20000, 0.039, 360.00),
(37500, 0.061, 457.50),
(125000, 0.07, 1525.00),
(float('inf'), 0.099, 7650.00),
]
### SEMI-ANNUAL ###
elif schedule_pay == 'semi-annual':
wages -= 500.00 * allowances
tax_rate_table = [
(10000, 0.015, 0.0),
(25000, 0.02, 150.00),
(35000, 0.027, 450.00),
(40000, 0.039, 720.00),
(75000, 0.061, 915.00),
(250000, 0.07, 3050.00),
(float('inf'), 0.099, 15300.00),
]
### ANNUAL ###
elif schedule_pay == 'annually':
wages -= 1000.00 * allowances
tax_rate_table = [
(20000, 0.015, 0.0),
(50000, 0.02, 300.00),
(70000, 0.027, 900.00),
(80000, 0.039, 1440.00),
(150000, 0.061, 1830.00),
(500000, 0.07, 6100.00),
(float('inf'), 0.099, 30600.00),
]
#### RATE 'C' ####
elif rate_table == 'C':
### WEEKLY ###
if schedule_pay == 'weekly':
wages -= 19.20 * allowances
tax_rate_table = [
(384, 0.015, 0.0),
(769, 0.023, 5.76),
(961, 0.028, 14.62),
(1153, 0.035, 19.99),
(2884, 0.056, 26.71),
(9615, 0.066, 123.65),
(float('inf'), 0.099, 567.90),
]
### BI-WEEKLY ###
elif schedule_pay == 'bi-weekly':
wages -= 38.40 * allowances
tax_rate_table = [
(769, 0.015, 0.0),
(1538, 0.023, 11.54),
(1923, 0.028, 29.22),
(2307, 0.035, 40.00),
(5769, 0.056, 53.44),
(19231, 0.066, 247.31),
(float('inf'), 0.099, 1135.80),
]
### SEMI-MONTHLY ###
elif schedule_pay == 'semi-monthly':
wages -= 41.60 * allowances
tax_rate_table = [
(833, 0.015, 0.0),
(1666, 0.023, 12.50),
(2083, 0.028, 31.65),
(2500, 0.035, 43.33),
(6250, 0.056, 57.93),
(20833, 0.066, 26793),
(float('inf'), 0.099, 1230.41),
]
### MONTHLY ###
elif schedule_pay == 'monthly':
wages -= 83.30 * allowances
tax_rate_table = [
(1666, 0.015, 0.0),
(3333, 0.023, 24.99),
(4166, 0.028, 63.33),
(5000, 0.035, 86.66),
(12500, 0.056, 115.85),
(41667, 0.066, 535.85),
(float('inf'), 0.099, 2460.87),
]
### QUARTERLY ###
elif schedule_pay == 'quarterly':
wages -= 250.00 * allowances
tax_rate_table = [
(5000, 0.015, 0.0),
(10000, 0.023, 75.00),
(12500, 0.028, 190.00),
(15000, 0.035, 260.00),
(37500, 0.056, 347.50),
(125000, 0.066, 1607.50),
(float('inf'), 0.099, 7382.50),
]
### SEMI-ANNUAL ###
elif schedule_pay == 'semi-annual':
wages -= 500.00 * allowances
tax_rate_table = [
(10000, 0.015, 0.0),
(20000, 0.023, 150.00),
(25000, 0.028, 380.00),
(30000, 0.035, 520.00),
(75000, 0.056, 695.00),
(250000, 0.066, 3215.00),
(float('inf'), 0.099, 14765.00),
]
### ANNUAL ###
elif schedule_pay == 'annually':
wages -= 1000.00 * allowances
tax_rate_table = [
(20000, 0.015, 0.0),
(40000, 0.023, 300.00),
(50000, 0.028, 760.00),
(60000, 0.035, 1040.00),
(150000, 0.056, 1390.00),
(500000, 0.066, 6430.00),
(float('inf'), 0.099, 29530.00),
]
#### RATE 'D' ####
elif rate_table == 'D':
### WEEKLY ###
if schedule_pay == 'weekly':
wages -= 19.20 * allowances
tax_rate_table = [
(384, 0.015, 0.0),
(769, 0.027, 5.76),
(961, 0.034, 16.16),
(1153, 0.043, 22.68),
(2884, 0.056, 30.94),
(9615, 0.065, 127.88),
(float('inf'), 0.099, 565.40),
]
### BI-WEEKLY ###
elif schedule_pay == 'bi-weekly':
wages -= 38.40 * allowances
tax_rate_table = [
(769, 0.015, 0.0),
(1538, 0.027, 11.54),
(1923, 0.034, 32.30),
(2307, 0.043, 45.39),
(5769, 0.056, 61.90),
(19231, 0.065, 255.77),
(float('inf'), 0.099, 1130.80),
]
### SEMI-MONTHLY ###
elif schedule_pay == 'semi-monthly':
wages -= 41.60 * allowances
tax_rate_table = [
(833, 0.015, 0.0),
(1666, 0.027, 12.50),
(2083, 0.034, 34.99),
(2500, 0.043, 49.16),
(6250, 0.056, 67.10),
(20833, 0.065, 277.10),
(float('inf'), 0.099, 1225.00),
]
### MONTHLY ###
elif schedule_pay == 'monthly':
wages -= 83.30 * allowances
tax_rate_table = [
(1666, 0.015, 0.0),
(3333, 0.027, 24.99),
(4166, 0.034, 70.00),
(5000, 0.043, 98.32),
(12500, 0.056, 134.18),
(41667, 0.065, 554.18),
(float('inf'), 0.099, 2450.04),
]
### QUARTERLY ###
elif schedule_pay == 'quarterly':
wages -= 250.00 * allowances
tax_rate_table = [
(5000, 0.015, 0.0),
(10000, 0.027, 75.00),
(12500, 0.034, 210.00),
(15000, 0.043, 295.00),
(37500, 0.056, 402.50),
(125000, 0.065, 1662.50),
(float('inf'), 0.099, 7350.00),
]
### SEMI-ANNUAL ###
elif schedule_pay == 'semi-annual':
wages -= 500.00 * allowances
tax_rate_table = [
(10000, 0.015, 0.0),
(20000, 0.027, 150.00),
(25000, 0.034, 420.00),
(30000, 0.043, 590.00),
(75000, 0.056, 805.00),
(250000, 0.065, 3325.00),
(float('inf'), 0.099, 14700.00),
]
### ANNUAL ###
elif schedule_pay == 'annually':
wages -= 1000.00 * allowances
tax_rate_table = [
(20000, 0.015, 0.0),
(40000, 0.027, 300.00),
(50000, 0.034, 840.00),
(60000, 0.043, 1180.00),
(150000, 0.056, 1610.00),
(250000, 0.065, 6650.00),
(float('inf'), 0.099, 29400.00),
]
#### RATE 'E' ####
elif rate_table == 'E':
### WEEKLY ###
if schedule_pay == 'weekly':
wages -= 19.20 * allowances
tax_rate_table = [
(384, 0.015, 0.0),
(673, 0.02, 5.76),
(1923, 0.058, 11.54),
(9615, 0.065, 84.04),
(float('inf'), 0.099, 584.02),
]
### BI-WEEKLY ###
elif schedule_pay == 'bi-weekly':
wages -= 38.40 * allowances
tax_rate_table = [
(769, 0.015, 0.0),
(1346, 0.02, 11.54),
(3846, 0.058, 23.08),
(19231, 0.065, 168.08),
(float('inf'), 0.099, 1168.11),
]
### SEMI-MONTHLY ###
elif schedule_pay == 'semi-monthly':
wages -= 41.60 * allowances
tax_rate_table = [
(833, 0.015, 0.0),
(1458, 0.02, 12.50),
(4166, 0.058, 25.00),
(20833, 0.065, 182.06),
(float('inf'), 0.099, 1265.42),
]
### MONTHLY ###
elif schedule_pay == 'monthly':
wages -= 83.30 * allowances
tax_rate_table = [
(1666, 0.015, 0.0),
(2916, 0.02, 24.99),
(8333, 0.058, 49.99),
(41667, 0.065, 364.18),
(float('inf'), 0.099, 2530.89),
]
### QUARTERLY ###
elif schedule_pay == 'quarterly':
wages -= 250.00 * allowances
tax_rate_table = [
(5000, 0.015, 0.0),
(8750, 0.02, 75.00),
(25000, 0.058, 150.00),
(125000, 0.065, 1092.50),
(float('inf'), 0.099, 7592.50),
]
### SEMI-ANNUAL ###
elif schedule_pay == 'semi-annual':
wages -= 500.00 * allowances
tax_rate_table = [
(10000, 0.015, 0.0),
(17500, 0.02, 150.00),
(50000, 0.058, 300.00),
(250000, 0.065, 2185.00),
(float('inf'), 0.099, 15,185.00),
]
### ANNUAL ###
elif schedule_pay == 'annually':
wages -= 1000.00 * allowances
tax_rate_table = [
(20000, 0.015, 0.0),
(35000, 0.02, 300.00),
(100000, 0.058, 600.00),
(500000, 0.065, 4370.00),
(float('inf'), 0.099, 30370.00),
]
over = 0.0
tax = 0.0
for row in tax_rate_table:
if wages &lt;= row[0]:
tax = ((wages - over) * row[1]) + row[2]
tax += additional_withholding
break
over = row[0]
result = -tax
</field>
<field name="register_id" ref="contrib_register_njdor_withhold"/>
</record>
</data>
</odoo>

View File

@@ -0,0 +1 @@
from . import test_us_nj_payslip_2018

View File

@@ -0,0 +1,135 @@
from odoo.addons.l10n_us_hr_payroll.tests.test_us_payslip import TestUsPayslip, process_payslip
from odoo.addons.l10n_us_hr_payroll.l10n_us_hr_payroll import USHrContract
class TestUsNJPayslip(TestUsPayslip):
###
# 2018 Taxes and Rates
###
NJ_UNEMP_MAX_WAGE = 33700.0
# Examples found on page 24 of http://www.state.nj.us/treasury/taxation/pdf/current/njwt.pdf
def test_2018_taxes_example1(self):
salary = 300
schedule_pay = 'weekly'
allowances = 1
additional_withholding = 0
# Tax Percentage Method for Single, taxable pay over $58, under $346
wh = -4.21
employee = self._createEmployee()
employee.company_id.nj_unemp_employee = 0.3825
employee.company_id.nj_unemp_company = 3.4
employee.company_id.nj_sdi_employee = 0.19
employee.company_id.nj_sdi_company = 0.5
employee.company_id.nj_fli = 0.09
employee.company_id.nj_wf = 0.0
contract = self._createContract(employee,
salary,
struct_id=self.ref(
'l10n_us_nj_hr_payroll.hr_payroll_salary_structure_us_nj_employee'),
schedule_pay=schedule_pay)
contract.nj_njw4_allowances = allowances
contract.nj_additional_withholding = additional_withholding
contract.nj_njw4_filing_status = 'single'
contract.nj_njw4_rate_table = 'A'
# tax rates
nj_unemp_employee = contract.nj_unemp_employee_rate(2018) / -100.0
nj_unemp_company = contract.nj_unemp_company_rate(2018) / -100.0
nj_sdi_employee = contract.nj_sdi_employee_rate(2018) / -100.0
nj_sdi_company = contract.nj_sdi_company_rate(2018) / -100.0
nj_fli = contract.nj_fli_rate(2018) / -100.0
nj_wf = contract.nj_wf_rate(2018) / -100.0
self.assertEqual(contract.schedule_pay, 'weekly')
self._log('2018 New Jersey tax first payslip:')
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
payslip.compute_sheet()
cats = self._getCategories(payslip)
self.assertPayrollEqual(cats['NJ_UNEMP_WAGES'], salary)
self.assertPayrollEqual(cats['NJ_UNEMP_EMPLOYEE'], round(cats['NJ_UNEMP_WAGES'] * nj_unemp_employee, 2))
self.assertPayrollEqual(cats['NJ_UNEMP_COMPANY'], cats['NJ_UNEMP_WAGES'] * nj_unemp_company)
self.assertPayrollEqual(cats['NJ_SDI_EMPLOYEE'], cats['NJ_SDI_WAGES'] * nj_sdi_employee)
self.assertPayrollEqual(cats['NJ_SDI_COMPANY'], cats['NJ_SDI_WAGES'] * nj_sdi_company)
self.assertPayrollEqual(cats['NJ_FLI'], cats['NJ_FLI_WAGES'] * nj_fli)
self.assertPayrollEqual(cats['NJ_WF'], cats['NJ_WF_WAGES'] * nj_wf)
self.assertPayrollEqual(cats['NJ_WITHHOLD'], wh)
process_payslip(payslip)
# Make a new payslip, this one will have maximums
remaining_nj_unemp_wages = self.NJ_UNEMP_MAX_WAGE - salary if (self.NJ_UNEMP_MAX_WAGE - 2 * salary < salary) \
else salary
self._log('2018 New Jersey tax second payslip:')
payslip = self._createPayslip(employee, '2018-02-01', '2018-02-28')
payslip.compute_sheet()
cats = self._getCategories(payslip)
self.assertPayrollEqual(cats['NJ_UNEMP_WAGES'], remaining_nj_unemp_wages)
self.assertPayrollEqual(cats['NJ_UNEMP_COMPANY'], remaining_nj_unemp_wages * nj_unemp_company)
self.assertPayrollEqual(cats['NJ_UNEMP_EMPLOYEE'], remaining_nj_unemp_wages * nj_unemp_employee)
def test_2018_taxes_example2(self):
salary = 1400.00
schedule_pay = 'weekly'
allowances = 3
additional_withholding = 0
# Tax Percentage Method for Single, taxable pay over $58, under $346
wh = -27.60
employee = self._createEmployee()
employee.company_id.nj_unemp_employee = 0.3825
employee.company_id.nj_unemp_company = 3.4
employee.company_id.nj_sdi_employee = 0.19
employee.company_id.nj_sdi_company = 0.5
employee.company_id.nj_fli = 0.09
employee.company_id.nj_wf = 0.0
contract = self._createContract(employee,
salary,
struct_id=self.ref(
'l10n_us_nj_hr_payroll.hr_payroll_salary_structure_us_nj_employee'),
schedule_pay=schedule_pay)
contract.nj_njw4_allowances = allowances
contract.nj_additional_withholding = additional_withholding
contract.nj_njw4_filing_status = 'married_joint'
# tax rates
nj_unemp_employee = contract.nj_unemp_employee_rate(2018) / -100.0
nj_unemp_company = contract.nj_unemp_company_rate(2018) / -100.0
nj_sdi_employee = contract.nj_sdi_employee_rate(2018) / -100.0
nj_sdi_company = contract.nj_sdi_company_rate(2018) / -100.0
nj_fli = contract.nj_fli_rate(2018) / -100.0
nj_wf = contract.nj_wf_rate(2018) / -100.0
self.assertEqual(contract.schedule_pay, 'weekly')
self._log('2018 New Jersey tax first payslip:')
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
payslip.compute_sheet()
cats = self._getCategories(payslip)
self.assertPayrollEqual(cats['NJ_UNEMP_WAGES'], salary)
self.assertPayrollEqual(cats['NJ_UNEMP_EMPLOYEE'], round((cats['NJ_UNEMP_WAGES'] * nj_unemp_employee), 2))
self.assertPayrollEqual(cats['NJ_UNEMP_COMPANY'], cats['NJ_UNEMP_WAGES'] * nj_unemp_company)
self.assertPayrollEqual(cats['NJ_SDI_EMPLOYEE'], cats['NJ_SDI_WAGES'] * nj_sdi_employee)
self.assertPayrollEqual(cats['NJ_SDI_COMPANY'], cats['NJ_SDI_WAGES'] * nj_sdi_company)
self.assertPayrollEqual(cats['NJ_FLI'], cats['NJ_FLI_WAGES'] * nj_fli)
self.assertPayrollEqual(cats['NJ_WF'], cats['NJ_WF_WAGES'] * nj_wf)
self.assertPayrollEqual(cats['NJ_WITHHOLD'], wh)
process_payslip(payslip)

View File

@@ -0,0 +1,92 @@
from odoo import models, fields, api
class USNJHrContract(models.Model):
_inherit = 'hr.contract'
nj_njw4_allowances = fields.Integer(string="New Jersey NJ-W4 Allowances",
default=0,
help="Allowances claimed on NJ W-4")
nj_additional_withholding = fields.Float(string="Additional Withholding",
default=0.0,
help='Additional withholding from line 5 of form NJ-W4')
nj_njw4_filing_status = fields.Selection([
('single', 'Single'),
('married_separate', 'Married/Civil Union partner Separate'),
('married_joint', 'Married/Civil Union Couple Joint'),
('widower', 'Widower/Surviving Civil Union Partner'),
('head_household', 'Head of Household')
], string='NJ Filing Status', default='single')
nj_njw4_rate_table = fields.Char(string='Wage Chart Letter',
help='Wage Chart Letter from line 3 of form NJ-W4.')
def nj_unemp_employee_rate(self, year):
self.ensure_one()
if self.futa_type == self.FUTA_TYPE_BASIC:
return 0.0
if hasattr(self.employee_id.company_id, 'nj_unemp_employee_rate_' + str(year)):
return self.employee_id.company_id['nj_unemp_employee_rate_' + str(year)]
raise NotImplemented('Year (' + str(year) + ') Not implemented for US New Jersey.')
def nj_unemp_company_rate(self, year):
self.ensure_one()
if self.futa_type == self.FUTA_TYPE_BASIC:
return 0.0
if hasattr(self.employee_id.company_id, 'nj_unemp_company_rate_' + str(year)):
return self.employee_id.company_id['nj_unemp_company_rate_' + str(year)]
raise NotImplemented('Year (' + str(year) + ') Not implemented for US New Jersey.')
def nj_sdi_company_rate(self, year):
self.ensure_one()
if self.futa_type == self.FUTA_TYPE_BASIC:
return 0.0
if hasattr(self.employee_id.company_id, 'nj_sdi_company_rate_' + str(year)):
return self.employee_id.company_id['nj_sdi_company_rate_' + str(year)]
raise NotImplemented('Year (' + str(year) + ') Not implemented for US New Jersey.')
def nj_sdi_employee_rate(self, year):
self.ensure_one()
if self.futa_type == self.FUTA_TYPE_BASIC:
return 0.0
if hasattr(self.employee_id.company_id, 'nj_sdi_employee_rate_' + str(year)):
return self.employee_id.company_id['nj_sdi_employee_rate_' + str(year)]
raise NotImplemented('Year (' + str(year) + ') Not implemented for US New Jersey.')
def nj_fli_rate(self, year):
self.ensure_one()
if self.futa_type == self.FUTA_TYPE_BASIC:
return 0.0
if hasattr(self.employee_id.company_id, 'nj_fli_rate_' + str(year)):
return self.employee_id.company_id['nj_fli_rate_' + str(year)]
raise NotImplemented('Year (' + str(year) + ') Not implemented for US New Jersey.')
def nj_wf_rate(self, year):
self.ensure_one()
if self.futa_type == self.FUTA_TYPE_BASIC:
return 0.0
if hasattr(self.employee_id.company_id, 'nj_wf_rate_' + str(year)):
return self.employee_id.company_id['nj_wf_rate_' + str(year)]
raise NotImplemented('Year (' + str(year) + ') Not implemented for US New Jersey.')
class NJCompany(models.Model):
_inherit = 'res.company'
nj_unemp_company_rate_2018 = fields.Float(string="New Jersey Employer State Unemployment Insurance Rate 2018", default=3.4)
nj_unemp_employee_rate_2018 = fields.Float(string="New Jersey Employee State Unemployment Insurance Rate 2018", default=0.3825)
nj_sdi_company_rate_2018 = fields.Float(string="New Jersey Employer State Disability Insurance Rate 2018", default=0.5)
nj_sdi_employee_rate_2018 = fields.Float(string="New Jersey Employee State Disability Insurance Rate 2018", default=0.19)
nj_fli_rate_2018 = fields.Float(string="New Jersey Family Leave Insurance Rate 2018", default=0.09)
nj_wf_rate_2018 = fields.Float(string="New Jersey Workforce Development Rate 2018", default=0.0)

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="us_nj_view_company_form" model="ir.ui.view">
<field name="name">res.company.form</field>
<field name="model">res.company</field>
<field name="priority">20</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='currency_id']" position="after">
<field name="nj_unemp_company_rate_2018"/>
<field name="nj_unemp_employee_rate_2018"/>
<field name="nj_sdi_company_rate_2018"/>
<field name="nj_sdi_employee_rate_2018"/>
<field name="nj_fli_rate_2018"/>
<field name="nj_wf_rate_2018"/>
</xpath>
</data>
</field>
</record>
<record id="hr_contract_form_l10n_us_nj_inherit" model="ir.ui.view">
<field name="name">hr.contract.form.inherit</field>
<field name="model">hr.contract</field>
<field name="priority">147</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="New Jersey" name="nj">
<field name="nj_njw4_allowances" string="NJ-W4 Allowances"/>
<field name="nj_additional_withholding" string="Additional Withholding"/>
</group>
</xpath>
</data>
</field>
</record>
</data>
</odoo>