mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
FIX l10n_us_nj_hr_payroll Rates for 2019 and improved test coverage.
This commit is contained in:
@@ -145,6 +145,12 @@
|
|||||||
<field name="parent_id" ref="hr_payroll.DED"/>
|
<field name="parent_id" ref="hr_payroll.DED"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_payroll_nj_wf_company" model="hr.salary.rule.category">
|
||||||
|
<field name="name">ER: US-NJ Workforce Development</field>
|
||||||
|
<field name="code">ER_US_NJ_WF</field>
|
||||||
|
<field name="parent_id" ref="hr_payroll.COMP"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="hr_payroll_nj_income_withhold" model="hr.salary.rule.category">
|
<record id="hr_payroll_nj_income_withhold" model="hr.salary.rule.category">
|
||||||
<field name="name">EE: US-NJ Income Withholding</field>
|
<field name="name">EE: US-NJ Income Withholding</field>
|
||||||
<field name="code">EE_US_NJ_INC_WITHHOLD</field>
|
<field name="code">EE_US_NJ_INC_WITHHOLD</field>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
ref('hr_payroll_rules_nj_fli_2018'),
|
ref('hr_payroll_rules_nj_fli_2018'),
|
||||||
ref('hr_payroll_rules_nj_wf_wages_2018'),
|
ref('hr_payroll_rules_nj_wf_wages_2018'),
|
||||||
ref('hr_payroll_rules_nj_wf_2018'),
|
ref('hr_payroll_rules_nj_wf_2018'),
|
||||||
|
ref('hr_payroll_rules_nj_wf_er'),
|
||||||
])]" name="rule_ids"/>
|
])]" name="rule_ids"/>
|
||||||
<field name="company_id" ref="base.main_company"/>
|
<field name="company_id" ref="base.main_company"/>
|
||||||
<field name="parent_id" ref="l10n_us_hr_payroll.hr_payroll_salary_structure_us_employee"/>
|
<field name="parent_id" ref="l10n_us_hr_payroll.hr_payroll_salary_structure_us_employee"/>
|
||||||
|
|||||||
@@ -52,5 +52,67 @@
|
|||||||
<field name="rate">0.0425</field>
|
<field name="rate">0.0425</field>
|
||||||
<field name="date_from">2018-01-01</field>
|
<field name="date_from">2018-01-01</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- 2019 -->
|
||||||
|
<!-- https://www.njbia.org/get-njbias-tax-changes-for-2019/ -->
|
||||||
|
<!-- https://www.nj.gov/labor/ea/rates/ea2019.html -->
|
||||||
|
<record id="hr_payroll_rates_nj_er_unemp_2019" model="hr.payroll.rate">
|
||||||
|
<field name="name">US NJ Unemployment (Company)</field>
|
||||||
|
<field name="code">ER_US_NJ_UNEMP</field>
|
||||||
|
<field name="rate">2.6825</field>
|
||||||
|
<field name="date_from">2019-01-01</field>
|
||||||
|
<field name="wage_limit_year" eval="34400.0"/>
|
||||||
|
</record>
|
||||||
|
<record id="hr_payroll_rates_nc_ee_unemp_2019" model="hr.payroll.rate">
|
||||||
|
<field name="name">US NJ Unemployment (Employee)</field>
|
||||||
|
<field name="code">EE_US_NJ_UNEMP</field>
|
||||||
|
<field name="rate">0.3825</field>
|
||||||
|
<field name="date_from">2019-01-01</field>
|
||||||
|
<field name="wage_limit_year" eval="34400.0"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_payroll_rates_nc_er_sdi_2019" model="hr.payroll.rate">
|
||||||
|
<field name="name">US NJ State Disability Insurance (Company)</field>
|
||||||
|
<field name="code">ER_US_NJ_SDI</field>
|
||||||
|
<field name="rate">0.5000</field>
|
||||||
|
<field name="date_from">2019-01-01</field>
|
||||||
|
<field name="wage_limit_year" eval="34400.0"/>
|
||||||
|
</record>
|
||||||
|
<record id="hr_payroll_rates_nc_ee_sdi_2019" model="hr.payroll.rate">
|
||||||
|
<field name="name">US NJ State Disability Insurance (Employee)</field>
|
||||||
|
<field name="code">EE_US_NJ_SDI</field>
|
||||||
|
<field name="rate">0.17</field>
|
||||||
|
<field name="date_from">2019-01-01</field>
|
||||||
|
<field name="wage_limit_year" eval="34400.0"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_payroll_rates_nc_er_wf_2019" model="hr.payroll.rate">
|
||||||
|
<field name="name">US NJ Workforce Development (Company)</field>
|
||||||
|
<field name="code">ER_US_NJ_WF</field>
|
||||||
|
<field name="rate">0.1175</field>
|
||||||
|
<field name="date_from">2019-01-01</field>
|
||||||
|
</record>
|
||||||
|
<record id="hr_payroll_rates_nc_ee_wf_2019" model="hr.payroll.rate">
|
||||||
|
<field name="name">US NJ Workforce Development (Employee)</field>
|
||||||
|
<field name="code">EE_US_NJ_WF</field>
|
||||||
|
<field name="rate">0.0425</field>
|
||||||
|
<field name="date_from">2019-01-01</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_payroll_rates_nc_er_fli_2019" model="hr.payroll.rate">
|
||||||
|
<field name="name">US NJ Family Leave Insurance (Company)</field>
|
||||||
|
<field name="code">ER_US_NJ_FLI</field>
|
||||||
|
<field name="rate">0.00</field>
|
||||||
|
<field name="date_from">2019-01-01</field>
|
||||||
|
<field name="wage_limit_year" eval="34400.0"/>
|
||||||
|
</record>
|
||||||
|
<record id="hr_payroll_rates_nc_ee_fli_2019" model="hr.payroll.rate">
|
||||||
|
<field name="name">US NJ Family Leave Insurance (Employee)</field>
|
||||||
|
<field name="code">EE_US_NJ_FLI</field>
|
||||||
|
<field name="rate">0.08</field>
|
||||||
|
<field name="date_from">2019-01-01</field>
|
||||||
|
<field name="wage_limit_year" eval="34400.0"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1 +1,2 @@
|
|||||||
from . import test_us_nj_payslip_2018
|
from . import test_us_nj_payslip_2018
|
||||||
|
from . import test_us_nj_payslip_2019
|
||||||
|
|||||||
179
l10n_us_nj_hr_payroll/tests/test_us_nj_payslip_2019.py
Executable file
179
l10n_us_nj_hr_payroll/tests/test_us_nj_payslip_2019.py
Executable file
@@ -0,0 +1,179 @@
|
|||||||
|
from odoo.addons.l10n_us_hr_payroll.tests.test_us_payslip import TestUsPayslip, process_payslip
|
||||||
|
|
||||||
|
|
||||||
|
class TestUsNJPayslip(TestUsPayslip):
|
||||||
|
###
|
||||||
|
# 2018 Taxes and Rates
|
||||||
|
###
|
||||||
|
NJ_UNEMP_MAX_WAGE = 34400.0 # Note that this is used for SDI and FLI as well
|
||||||
|
|
||||||
|
ER_NJ_UNEMP = -2.6825 / 100.0
|
||||||
|
EE_NJ_UNEMP = -0.3825 / 100.0
|
||||||
|
|
||||||
|
ER_NJ_SDI = -0.5 / 100.0
|
||||||
|
EE_NJ_SDI = -0.17 / 100.0
|
||||||
|
|
||||||
|
ER_NJ_WF = -0.1175 / 100.0
|
||||||
|
EE_NJ_WF = -0.0425 / 100.0
|
||||||
|
|
||||||
|
ER_NJ_FLI = 0.0
|
||||||
|
EE_NJ_FLI = -0.08 / 100.0
|
||||||
|
|
||||||
|
# Examples found on page 24 of http://www.state.nj.us/treasury/taxation/pdf/current/njwt.pdf
|
||||||
|
def test_2019_taxes_example1(self):
|
||||||
|
salary = 300
|
||||||
|
schedule_pay = 'weekly'
|
||||||
|
allowances = 1
|
||||||
|
additional_withholding = 0
|
||||||
|
|
||||||
|
# Tax Percentage Method for Single, taxable under $385
|
||||||
|
wh = -4.21
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
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'
|
||||||
|
|
||||||
|
self.assertEqual(contract.schedule_pay, 'weekly')
|
||||||
|
|
||||||
|
self._log('2019 New Jersey 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_NJ_UNEMP'], salary)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_UNEMP'], round(cats['BASIC'] * self.EE_NJ_UNEMP, 2))
|
||||||
|
self.assertPayrollEqual(cats['ER_US_NJ_UNEMP'], round(cats['WAGE_US_NJ_UNEMP'] * self.ER_NJ_UNEMP, 2))
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_SDI'], cats['WAGE_US_NJ_SDI'] * self.EE_NJ_SDI)
|
||||||
|
self.assertPayrollEqual(cats['ER_US_NJ_SDI'], cats['WAGE_US_NJ_SDI'] * self.ER_NJ_SDI)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_FLI'], cats['WAGE_US_NJ_FLI'] * self.EE_NJ_FLI)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_WF'], cats['WAGE_US_NJ_WF'] * self.EE_NJ_WF)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_INC_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('2019 New Jersey 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_NJ_UNEMP'], remaining_nj_unemp_wages)
|
||||||
|
self.assertPayrollEqual(cats['ER_US_NJ_UNEMP'], round(remaining_nj_unemp_wages * self.ER_NJ_UNEMP, 2))
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_UNEMP'], round(cats['BASIC'] * self.EE_NJ_UNEMP, 2))
|
||||||
|
|
||||||
|
def test_2019_taxes_example2(self):
|
||||||
|
salary = 1400.00
|
||||||
|
schedule_pay = 'weekly'
|
||||||
|
allowances = 3
|
||||||
|
additional_withholding = 0
|
||||||
|
|
||||||
|
# Tax Percentage Method for Single, taxable pay over $769, under $1442
|
||||||
|
wh = -27.58
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
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'
|
||||||
|
|
||||||
|
self.assertEqual(contract.schedule_pay, 'weekly')
|
||||||
|
|
||||||
|
self._log('2019 New Jersey 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_NJ_UNEMP'], salary)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_UNEMP'], cats['WAGE_US_NJ_UNEMP'] * self.EE_NJ_UNEMP)
|
||||||
|
#self.assertPayrollEqual(cats['ER_US_NJ_UNEMP'], round(cats['WAGE_US_NJ_UNEMP'] * self.ER_NJ_UNEMP, 2))
|
||||||
|
# round(37.555, 2) => 37.55 but in reality this should be 37.56, floats are weird ;)
|
||||||
|
self.assertTrue(abs(cats['ER_US_NJ_UNEMP'] - round(cats['WAGE_US_NJ_UNEMP'] * self.ER_NJ_UNEMP, 2)) < 0.02)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_SDI'], cats['WAGE_US_NJ_SDI'] * self.EE_NJ_SDI)
|
||||||
|
self.assertPayrollEqual(cats['ER_US_NJ_SDI'], cats['WAGE_US_NJ_SDI'] * self.ER_NJ_SDI)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_FLI'], cats['WAGE_US_NJ_FLI'] * self.EE_NJ_FLI)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_WF'], cats['WAGE_US_NJ_WF'] * self.EE_NJ_WF)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_INC_WITHHOLD'], wh)
|
||||||
|
|
||||||
|
process_payslip(payslip)
|
||||||
|
|
||||||
|
def test_2019_taxes_to_the_limits(self):
|
||||||
|
salary = 30000.00
|
||||||
|
schedule_pay = 'quarterly'
|
||||||
|
allowances = 3
|
||||||
|
additional_withholding = 0
|
||||||
|
|
||||||
|
# Tax Percentage Method for Single, taxable pay over $18750, under 125000
|
||||||
|
wh = -1021.75
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
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'
|
||||||
|
|
||||||
|
self.assertEqual(contract.schedule_pay, 'quarterly')
|
||||||
|
|
||||||
|
self._log('2019 New Jersey tax first payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2019-01-01', '2019-03-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['WAGE_US_NJ_UNEMP'], salary)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_UNEMP'], cats['BASIC'] * self.EE_NJ_UNEMP)
|
||||||
|
#self.assertPayrollEqual(cats['ER_US_NJ_UNEMP'], round(cats['WAGE_US_NJ_UNEMP'] * self.ER_NJ_UNEMP, 2))
|
||||||
|
# round(37.555, 2) => 37.55 but in reality this should be 37.56, floats are weird ;)
|
||||||
|
self.assertTrue(abs(cats['ER_US_NJ_UNEMP'] - round(cats['WAGE_US_NJ_UNEMP'] * self.ER_NJ_UNEMP, 2)) < 0.02)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_SDI'], cats['WAGE_US_NJ_SDI'] * self.EE_NJ_SDI)
|
||||||
|
self.assertPayrollEqual(cats['ER_US_NJ_SDI'], cats['WAGE_US_NJ_SDI'] * self.ER_NJ_SDI)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_FLI'], cats['WAGE_US_NJ_FLI'] * self.EE_NJ_FLI)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_WF'], cats['WAGE_US_NJ_WF'] * self.EE_NJ_WF)
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_INC_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('2019 New Jersey tax second payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2019-04-01', '2019-07-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertFalse(abs(cats['BASIC'] - remaining_nj_unemp_wages) < 0.02)
|
||||||
|
self.assertTrue(abs(cats['WAGE_US_NJ_UNEMP'] - remaining_nj_unemp_wages) < 0.02)
|
||||||
|
self.assertPayrollEqual(cats['WAGE_US_NJ_UNEMP'], remaining_nj_unemp_wages)
|
||||||
|
self.assertPayrollEqual(cats['ER_US_NJ_UNEMP'], round(remaining_nj_unemp_wages * self.ER_NJ_UNEMP, 2))
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_UNEMP'], round(remaining_nj_unemp_wages * self.EE_NJ_UNEMP, 2))
|
||||||
|
self.assertPayrollEqual(cats['EE_US_NJ_SDI'], remaining_nj_unemp_wages * self.EE_NJ_SDI)
|
||||||
|
self.assertPayrollEqual(cats['ER_US_NJ_SDI'], remaining_nj_unemp_wages * self.ER_NJ_SDI)
|
||||||
Reference in New Issue
Block a user