mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[IMP] l10n_us_hr_payroll: For North Dakota 13.0
This commit is contained in:
@@ -47,6 +47,7 @@ United States of America - Payroll Rules.
|
||||
'data/state/ms_mississippi.xml',
|
||||
'data/state/mt_montana.xml',
|
||||
'data/state/nc_northcarolina.xml',
|
||||
'data/state/nd_north_dakota.xml',
|
||||
'data/state/ne_nebraska.xml',
|
||||
'data/state/nh_new_hampshire.xml',
|
||||
'data/state/nj_newjersey.xml',
|
||||
|
||||
110
l10n_us_hr_payroll/data/state/nd_north_dakota.xml
Normal file
110
l10n_us_hr_payroll/data/state/nd_north_dakota.xml
Normal file
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<!-- Wage Base -->
|
||||
<record id="rule_parameter_us_nd_suta_wage_base" model="hr.rule.parameter">
|
||||
<field name="name">US ND North Dakota SUTA Wage Base</field>
|
||||
<field name="code">us_nd_suta_wage_base</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_nd_suta_wage_base_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">37900.0</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_nd_suta_wage_base"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Rate -->
|
||||
<record id="rule_parameter_us_nd_suta_rate" model="hr.rule.parameter">
|
||||
<field name="name">US ND North Dakota SUTA Rate</field>
|
||||
<field name="code">us_nd_suta_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_nd_suta_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">1.02</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_nd_suta_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_nd_sit_tax_rate" model="hr.rule.parameter">
|
||||
<field name="name">US ND North Dakota SIT Tax Rate</field>
|
||||
<field name="code">us_nd_sit_tax_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_nd_sit_tax_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">{
|
||||
'single': (
|
||||
( 6200, 0.00, 0.00),
|
||||
( 46325, 0.00, 1.10),
|
||||
( 103350, 441.38, 2.04),
|
||||
( 208850, 1604.69, 2.27),
|
||||
( 446800, 3999.54, 2.64),
|
||||
( 'inf',10281.42, 2.90),
|
||||
),
|
||||
'married': (
|
||||
( 12400, 0.00, 0.00),
|
||||
( 45925, 0.00, 1.10),
|
||||
( 93375, 368.78, 2.04),
|
||||
( 135750, 1336.76, 2.27),
|
||||
( 232700, 2298.67, 2.64),
|
||||
( 'inf', 4858.15, 2.90),
|
||||
),
|
||||
'head_household': (
|
||||
( 9325, 0.00, 0.00),
|
||||
( 63075, 0.00, 1.10),
|
||||
( 148125, 591.25, 2.04),
|
||||
( 234025, 2326.27, 2.27),
|
||||
( 449925, 4276.20, 2.64),
|
||||
( 'inf', 9975.96, 2.90),
|
||||
),
|
||||
}</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_nd_sit_tax_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
|
||||
<!-- Partners and Contribution Registers -->
|
||||
<record id="res_partner_us_nd_dor" model="res.partner">
|
||||
<field name="name">US North Dakota - Office of State Tax Commissioner - Unemployment Tax</field>
|
||||
</record>
|
||||
|
||||
<record id="res_partner_us_nd_dor_sit" model="res.partner">
|
||||
<field name="name">US North Dakota - Taxpayer Access Point - Income Tax</field>
|
||||
</record>
|
||||
|
||||
<!-- Categories -->
|
||||
|
||||
<!-- Rules -->
|
||||
<record id="hr_payroll_rule_er_us_nd_suta" model="hr.salary.rule">
|
||||
<field name="sequence" eval="450"/>
|
||||
<field name="struct_id" ref="hr_payroll_structure"/>
|
||||
<field name="category_id" ref="hr_payroll_category_er_us_suta"/>
|
||||
<field name="name">ER: US ND North Dakota State Unemployment</field>
|
||||
<field name="code">ER_US_ND_SUTA</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nd_suta_wage_base', rate='us_nd_suta_rate', state_code='ND')</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_nd_suta_wage_base', rate='us_nd_suta_rate', state_code='ND')</field>
|
||||
<field name="partner_id" ref="res_partner_us_nd_dor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_rule_ee_us_nd_sit" model="hr.salary.rule">
|
||||
<field name="sequence" eval="195"/>
|
||||
<field name="struct_id" ref="hr_payroll_structure"/>
|
||||
<field name="category_id" ref="hr_payroll_category_ee_us_sit"/>
|
||||
<field name="name">EE: US ND North Dakota State Income Tax Withholding</field>
|
||||
<field name="code">EE_US_ND_SIT</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = nd_north_dakota_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">result, result_rate = nd_north_dakota_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="partner_id" ref="res_partner_us_nd_dor_sit"/>
|
||||
<field name="appears_on_payslip" eval="True"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -32,6 +32,7 @@ from .state.mo_missouri import mo_missouri_state_income_withholding
|
||||
from .state.ms_mississippi import ms_mississippi_state_income_withholding
|
||||
from .state.mt_montana import mt_montana_state_income_withholding
|
||||
from .state.nc_northcarolina import nc_northcarolina_state_income_withholding
|
||||
from .state.nd_north_dakota import nd_north_dakota_state_income_withholding
|
||||
from .state.ne_nebraska import ne_nebraska_state_income_withholding
|
||||
from .state.nj_newjersey import nj_newjersey_state_income_withholding
|
||||
from .state.nm_new_mexico import nm_new_mexico_state_income_withholding
|
||||
@@ -92,6 +93,7 @@ class HRPayslip(models.Model):
|
||||
'ms_mississippi_state_income_withholding': ms_mississippi_state_income_withholding,
|
||||
'mt_montana_state_income_withholding': mt_montana_state_income_withholding,
|
||||
'nc_northcarolina_state_income_withholding': nc_northcarolina_state_income_withholding,
|
||||
'nd_north_dakota_state_income_withholding': nd_north_dakota_state_income_withholding,
|
||||
'ne_nebraska_state_income_withholding': ne_nebraska_state_income_withholding,
|
||||
'nj_newjersey_state_income_withholding': nj_newjersey_state_income_withholding,
|
||||
'nm_new_mexico_state_income_withholding': nm_new_mexico_state_income_withholding,
|
||||
|
||||
43
l10n_us_hr_payroll/models/state/nd_north_dakota.py
Normal file
43
l10n_us_hr_payroll/models/state/nd_north_dakota.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from .general import _state_applies, sit_wage
|
||||
|
||||
|
||||
def nd_north_dakota_state_income_withholding(payslip, categories, worked_days, inputs):
|
||||
"""
|
||||
Returns SIT eligible wage and rate.
|
||||
WAGE = GROSS + DED_FIT_EXEMPT
|
||||
|
||||
:return: result, result_rate (wage, percent)
|
||||
"""
|
||||
state_code = 'ND'
|
||||
if not _state_applies(payslip, state_code):
|
||||
return 0.0, 0.0
|
||||
|
||||
# Determine Wage
|
||||
wage = sit_wage(payslip, categories)
|
||||
if not wage:
|
||||
return 0.0, 0.0
|
||||
|
||||
filing_status = payslip.contract_id.us_payroll_config_value('nd_w4_sit_filing_status')
|
||||
if not filing_status:
|
||||
return 0.0, 0.0
|
||||
|
||||
pay_periods = payslip.dict.get_pay_periods_in_year()
|
||||
additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
|
||||
tax_rate = payslip.rule_parameter('us_nd_sit_tax_rate')[filing_status]
|
||||
|
||||
taxable_income = wage * pay_periods
|
||||
withholding = 0.0
|
||||
last = 0.0
|
||||
for row in tax_rate:
|
||||
amt, flat_fee, rate = row
|
||||
if taxable_income < float(amt):
|
||||
withholding = ((taxable_income - last) * (rate / 100)) + flat_fee
|
||||
break
|
||||
last = amt
|
||||
|
||||
withholding = round(withholding / pay_periods)
|
||||
withholding = max(withholding, 0.0)
|
||||
withholding += additional
|
||||
return wage, -((withholding / wage) * 100.0)
|
||||
@@ -182,6 +182,12 @@ class HRContractUSPayrollConfig(models.Model):
|
||||
], string='North Carolina NC-4 Filing Status', help='NC-4')
|
||||
nc_nc4_sit_allowances = fields.Integer(string='North Carolina NC-4 Allowances', help='NC-4 1.')
|
||||
|
||||
nd_w4_sit_filing_status = fields.Selection([
|
||||
('single', 'Single'),
|
||||
('married', 'Married'),
|
||||
('head_household', 'Head of Household')
|
||||
], string='North Dakota ND W-4 Filing Status', help='ND W-4')
|
||||
|
||||
ne_w4n_sit_filing_status = fields.Selection([
|
||||
('single', 'Single'),
|
||||
('married', 'Married'),
|
||||
|
||||
@@ -67,6 +67,8 @@ from . import test_us_mt_montana_payslip_2020
|
||||
from . import test_us_nc_northcarolina_payslip_2019
|
||||
from . import test_us_nc_northcarolina_payslip_2020
|
||||
|
||||
from . import test_us_nd_north_dakota_payslip_2020
|
||||
|
||||
from . import test_us_ne_nebraska_payslip_2020
|
||||
|
||||
from . import test_us_nh_new_hampshire_payslip_2020
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from datetime import date, timedelta
|
||||
from .common import TestUsPayslip
|
||||
|
||||
|
||||
class TestUsNDPayslip(TestUsPayslip):
|
||||
###
|
||||
# 2020 Taxes and Rates
|
||||
###
|
||||
ND_UNEMP_MAX_WAGE = 37900.0
|
||||
ND_UNEMP = 1.02
|
||||
# Calculation based on this file page.47 https://www.nd.gov/tax/data/upfiles/media/rates-and-instructions.pdf?20200110115917
|
||||
|
||||
def _test_sit(self, wage, filing_status, additional_withholding, schedule_pay, date_start, expected_withholding):
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=wage,
|
||||
state_id=self.get_us_state('ND'),
|
||||
nd_w4_sit_filing_status=filing_status,
|
||||
state_income_tax_additional_withholding=additional_withholding,
|
||||
schedule_pay=schedule_pay)
|
||||
payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
|
||||
payslip.compute_sheet()
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self._log('Computed period tax: ' + str(expected_withholding))
|
||||
self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
|
||||
|
||||
def test_2020_taxes_example(self):
|
||||
self._test_er_suta('ND', self.ND_UNEMP, date(2020, 1, 1), wage_base=self.ND_UNEMP_MAX_WAGE)
|
||||
self._test_sit(700.0, 'single', 0.0, 'weekly', date(2020, 1, 1), 6.0)
|
||||
self._test_sit(2500.0, 'married', 0.0, 'bi-weekly', date(2020, 1, 1), 29.0)
|
||||
self._test_sit(25000.0, 'head_household', 0.0, 'monthly', date(2020, 1, 1), 501.0)
|
||||
self._test_sit(25000.0, 'head_household', 10.0, 'monthly', date(2020, 1, 1), 511.0)
|
||||
@@ -167,6 +167,11 @@
|
||||
<field name="nc_nc4_sit_allowances" string="Allowances 1."/>
|
||||
<field name="state_income_tax_additional_withholding" string="Additional Withholding 2."/>
|
||||
</group>
|
||||
<group name="state_nd_north_dakota" string="ND North Dakota" attrs="{'invisible':[('state_id', '!=', %(base.state_us_29)s)]}">
|
||||
<p colspan="2"><h3>Form ND W-4 - State Income Tax</h3></p>
|
||||
<field name="nd_w4_sit_filing_status" string="Filing Status"/>
|
||||
<field name="state_income_tax_additional_withholding" string="Additional Withholding 2."/>
|
||||
</group>
|
||||
<group name="state_ne_nebraska" string="NE Nebraska" attrs="{'invisible':[('state_id', '!=', %(base.state_us_22)s)]}">
|
||||
<p colspan="2"><h3>Form NC-4 - State Income Tax</h3></p>
|
||||
<field name="ne_w4n_sit_filing_status" string="Filing Status"/>
|
||||
|
||||
Reference in New Issue
Block a user