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 Delaware 12.0
This commit is contained in:
@@ -34,6 +34,7 @@ USA Payroll Rules.
|
||||
'data/state/az_arizona.xml',
|
||||
'data/state/ca_california.xml',
|
||||
'data/state/ct_connecticut.xml',
|
||||
'data/state/de_delaware.xml',
|
||||
'data/state/fl_florida.xml',
|
||||
'data/state/ga_georgia.xml',
|
||||
'data/state/hi_hawaii.xml',
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
ref('hr_payroll_rule_er_us_ct_suta'),
|
||||
ref('hr_payroll_rule_ee_us_ct_sit'),
|
||||
|
||||
ref('hr_payroll_rule_er_us_de_suta'),
|
||||
ref('hr_payroll_rule_ee_us_de_sit'),
|
||||
|
||||
ref('hr_payroll_rule_er_us_fl_suta'),
|
||||
|
||||
ref('hr_payroll_rule_er_us_ga_suta'),
|
||||
|
||||
107
l10n_us_hr_payroll/data/state/de_delaware.xml
Normal file
107
l10n_us_hr_payroll/data/state/de_delaware.xml
Normal file
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<!-- Wage Base -->
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_de_suta_wage_base_2020" model="hr.payroll.rate">
|
||||
<field name="name">US DE Delaware SUTA Wage Base</field>
|
||||
<field name="code">us_de_suta_wage_base</field>
|
||||
<field name="parameter_value">16500.0</field>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Rate -->
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_de_suta_rate_2020" model="hr.payroll.rate">
|
||||
<field name="name">US DE Delaware SUTA Rate</field>
|
||||
<field name="code">us_de_suta_rate</field>
|
||||
<field name="parameter_value">1.50</field>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_de_sit_tax_rate_2020" model="hr.payroll.rate">
|
||||
<field name="name">US DE Delaware SIT Tax Rate</field>
|
||||
<field name="code">us_de_sit_tax_rate</field>
|
||||
<field name="parameter_value">[
|
||||
( 2000, 0.0, 0.00),
|
||||
( 5000, 0.0, 2.20),
|
||||
(10000, 66.0, 3.90),
|
||||
(20000, 261.0, 4.80),
|
||||
(25000, 741.0, 5.20),
|
||||
(60000, 1001.0, 5.55),
|
||||
('inf', 2943.0, 6.60),
|
||||
|
||||
]</field>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_de_sit_standard_deduction_rate_2020" model="hr.payroll.rate">
|
||||
<field name="name">US DE Delaware Standard Deduction Rate</field>
|
||||
<field name="code">us_de_sit_standard_deduction_rate</field>
|
||||
<field name="parameter_value">3250</field>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_de_sit_personal_exemption_rate_2020" model="hr.payroll.rate">
|
||||
<field name="name">US DE Delaware Personal Exemption Rate</field>
|
||||
<field name="code">us_de_sit_personal_exemption_rate</field>
|
||||
<field name="parameter_value">110</field>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Partners and Contribution Registers -->
|
||||
<record id="res_partner_us_de_dor" model="res.partner">
|
||||
<field name="name">US Delaware - Division of Unemployment Insurance - Unemployment Tax</field>
|
||||
<field name="supplier">1</field>
|
||||
</record>
|
||||
<record id="contrib_register_us_de_dor" model="hr.contribution.register">
|
||||
<field name="name">US Delaware - Division of Unemployment Insurance - Unemployment Tax</field>
|
||||
<field name="partner_id" ref="res_partner_us_de_dor"/>
|
||||
</record>
|
||||
|
||||
<record id="res_partner_us_de_dor_sit" model="res.partner">
|
||||
<field name="name">US Delaware - Division of Revenue - Income Tax</field>
|
||||
<field name="supplier">1</field>
|
||||
</record>
|
||||
<record id="contrib_register_us_de_dor_sit" model="hr.contribution.register">
|
||||
<field name="name">US Delaware - Division of Revenue - Unemployment Tax</field>
|
||||
<field name="partner_id" ref="res_partner_us_de_dor_sit"/>
|
||||
</record>
|
||||
|
||||
<!-- Categories -->
|
||||
|
||||
<!-- Rules -->
|
||||
<record id="hr_payroll_rule_er_us_de_suta" model="hr.salary.rule">
|
||||
<field name="sequence" eval="450"/>
|
||||
<field name="category_id" ref="hr_payroll_category_er_us_suta"/>
|
||||
<field name="name">ER: US DE Delaware State Unemployment</field>
|
||||
<field name="code">ER_US_DE_SUTA</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_de_suta_wage_base', rate='us_de_suta_rate', state_code='DE')</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_de_suta_wage_base', rate='us_de_suta_rate', state_code='DE')</field>
|
||||
<field name="register_id" ref="contrib_register_us_de_dor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_rule_ee_us_de_sit" model="hr.salary.rule">
|
||||
<field name="sequence" eval="195"/>
|
||||
<field name="category_id" ref="hr_payroll_category_ee_us_sit"/>
|
||||
<field name="name">EE: US DE Delaware State Income Tax Withholding</field>
|
||||
<field name="code">EE_US_DE_SIT</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = de_delaware_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">result, result_rate = de_delaware_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="register_id" ref="contrib_register_us_de_dor_sit"/>
|
||||
<field name="appears_on_payslip" eval="True"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -19,6 +19,7 @@ from .state.ar_arkansas import ar_arkansas_state_income_withholding
|
||||
from .state.az_arizona import az_arizona_state_income_withholding
|
||||
from .state.ca_california import ca_california_state_income_withholding
|
||||
from .state.ct_connecticut import ct_connecticut_state_income_withholding
|
||||
from .state.de_delaware import de_delaware_state_income_withholding
|
||||
from .state.ga_georgia import ga_georgia_state_income_withholding
|
||||
from .state.hi_hawaii import hi_hawaii_state_income_withholding
|
||||
from .state.id_idaho import id_idaho_state_income_withholding
|
||||
@@ -71,6 +72,7 @@ class HRPayslip(models.Model):
|
||||
'az_arizona_state_income_withholding': az_arizona_state_income_withholding,
|
||||
'ca_california_state_income_withholding': ca_california_state_income_withholding,
|
||||
'ct_connecticut_state_income_withholding': ct_connecticut_state_income_withholding,
|
||||
'de_delaware_state_income_withholding': de_delaware_state_income_withholding,
|
||||
'ga_georgia_state_income_withholding': ga_georgia_state_income_withholding,
|
||||
'hi_hawaii_state_income_withholding': hi_hawaii_state_income_withholding,
|
||||
'id_idaho_state_income_withholding': id_idaho_state_income_withholding,
|
||||
|
||||
49
l10n_us_hr_payroll/models/state/de_delaware.py
Normal file
49
l10n_us_hr_payroll/models/state/de_delaware.py
Normal file
@@ -0,0 +1,49 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from .general import _state_applies, sit_wage
|
||||
|
||||
|
||||
def de_delaware_state_income_withholding(payslip, categories, worked_days, inputs):
|
||||
"""
|
||||
Returns SIT eligible wage and rate.
|
||||
|
||||
:return: result, result_rate (wage, percent)
|
||||
"""
|
||||
state_code = 'DE'
|
||||
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.dict.contract_id.us_payroll_config_value('de_w4_sit_filing_status')
|
||||
if not filing_status:
|
||||
return 0.0, 0.0
|
||||
|
||||
pay_periods = payslip.dict.get_pay_periods_in_year()
|
||||
additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
|
||||
tax_table = payslip.dict.rule_parameter('us_de_sit_tax_rate')
|
||||
personal_exemption = payslip.dict.rule_parameter('us_de_sit_personal_exemption_rate')
|
||||
allowances = payslip.dict.contract_id.us_payroll_config_value('de_w4_sit_dependent')
|
||||
standard_deduction = payslip.dict.rule_parameter('us_de_sit_standard_deduction_rate')
|
||||
|
||||
taxable_income = wage * pay_periods
|
||||
if filing_status == 'single':
|
||||
taxable_income -= standard_deduction
|
||||
else:
|
||||
taxable_income -= standard_deduction * 2
|
||||
|
||||
withholding = 0.0
|
||||
last = 0.0
|
||||
for row in tax_table:
|
||||
if taxable_income <= float(row[0]):
|
||||
withholding = (row[1] + ((row[2] / 100.0) * (taxable_income - last)) - (allowances * personal_exemption))
|
||||
break
|
||||
last = row[0]
|
||||
|
||||
withholding = max(withholding, 0.0)
|
||||
withholding = withholding / pay_periods
|
||||
withholding += additional
|
||||
return wage, -((withholding / wage) * 100.0)
|
||||
@@ -85,6 +85,12 @@ class HRContractUSPayrollConfig(models.Model):
|
||||
('f', 'F'),
|
||||
], string='Connecticut CT-W4 Withholding Code', help='CT-W4 1.')
|
||||
|
||||
de_w4_sit_filing_status = fields.Selection([
|
||||
('single', 'Single or Married filing separately'),
|
||||
('married', 'Married filing jointly'),
|
||||
], string='Delaware W-4 Marital Status', help='DE W-4 3.')
|
||||
de_w4_sit_dependent = fields.Integer(string='Delaware W-4 Dependents', help='DE W-4 4.')
|
||||
|
||||
ga_g4_sit_filing_status = fields.Selection([
|
||||
('exempt', 'Exempt'),
|
||||
('single', 'Single'),
|
||||
|
||||
@@ -22,6 +22,8 @@ from . import test_us_ca_california_payslip_2020
|
||||
from . import test_us_ct_connecticut_payslip_2019
|
||||
from . import test_us_ct_connecticut_payslip_2020
|
||||
|
||||
from . import test_us_de_delaware_payslip_2020
|
||||
|
||||
from . import test_us_fl_florida_payslip_2019
|
||||
from . import test_us_fl_florida_payslip_2020
|
||||
|
||||
|
||||
36
l10n_us_hr_payroll/tests/test_us_de_delaware_payslip_2020.py
Executable file
36
l10n_us_hr_payroll/tests/test_us_de_delaware_payslip_2020.py
Executable file
@@ -0,0 +1,36 @@
|
||||
# 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 TestUsDEPayslip(TestUsPayslip):
|
||||
###
|
||||
# 2020 Taxes and Rates
|
||||
###
|
||||
DE_UNEMP_MAX_WAGE = 16500.0
|
||||
DE_UNEMP = 1.50
|
||||
# Calculation based on section 17. https://revenue.delaware.gov/employers-guide-withholding-regulations-employers-duties/
|
||||
|
||||
def _test_sit(self, wage, filing_status, additional_withholding, dependents, schedule_pay, date_start, expected_withholding):
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=wage,
|
||||
state_id=self.get_us_state('DE'),
|
||||
de_w4_sit_filing_status=filing_status,
|
||||
state_income_tax_additional_withholding=additional_withholding,
|
||||
de_w4_sit_dependent=dependents,
|
||||
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('DE', self.DE_UNEMP, date(2020, 1, 1), wage_base=self.DE_UNEMP_MAX_WAGE)
|
||||
self._test_sit(480.77, 'single', 0.0, 1.0, 'weekly', date(2020, 1, 1), 13.88)
|
||||
self._test_sit(5000.0, 'single', 0.0, 2.0, 'monthly', date(2020, 1, 1), 211.93)
|
||||
self._test_sit(5000.0, 'single', 10.0, 1.0, 'monthly', date(2020, 1, 1), 231.1)
|
||||
self._test_sit(20000.0, 'married', 0.0, 3.0, 'quarterly', date(2020, 1, 1), 876.0)
|
||||
@@ -69,6 +69,12 @@
|
||||
<field name="ca_de4_sit_additional_allowances" string="Additional Allowances 4(c)."/>
|
||||
<field name="state_income_tax_additional_withholding" string="Additional Withholding 2."/>
|
||||
</group>
|
||||
<group name="state_de_delaware" string="DE Delaware" attrs="{'invisible':[('state_id', '!=', %(base.state_us_8)s)]}">
|
||||
<p colspan="2"><h3>Form DE W-4 - State Income Tax</h3></p>
|
||||
<field name="de_w4_sit_filing_status" string="Marital Status 3."/>
|
||||
<field name="de_w4_sit_dependent" string="Dependents Allowances 4."/>
|
||||
<field name="state_income_tax_additional_withholding" string="Additional Withholding 5."/>
|
||||
</group>
|
||||
<group name="state_ct_connecticut" string="CT Connecticut" attrs="{'invisible':[('state_id', '!=', %(base.state_us_7)s)]}">
|
||||
<p colspan="2"><h3>Form CT-W4 - State Income Tax</h3></p>
|
||||
<field name="ct_w4na_sit_code" string="Withholding Code 1."/>
|
||||
|
||||
Reference in New Issue
Block a user