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 Kansas 13.0
This commit is contained in:
@@ -40,6 +40,7 @@ United States of America - Payroll Rules.
|
||||
'data/state/id_idaho.xml',
|
||||
'data/state/il_illinois.xml',
|
||||
'data/state/in_indiana.xml',
|
||||
'data/state/ks_kansas.xml',
|
||||
'data/state/la_louisiana.xml',
|
||||
'data/state/me_maine.xml',
|
||||
'data/state/mi_michigan.xml',
|
||||
|
||||
133
l10n_us_hr_payroll/data/state/ks_kansas.xml
Normal file
133
l10n_us_hr_payroll/data/state/ks_kansas.xml
Normal file
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<!-- Wage Base -->
|
||||
<record id="rule_parameter_us_ks_suta_wage_base" model="hr.rule.parameter">
|
||||
<field name="name">US KS Kasas SUTA Wage Base</field>
|
||||
<field name="code">us_ks_suta_wage_base</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_ks_suta_wage_base_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">14000.0</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_ks_suta_wage_base"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Rate -->
|
||||
<record id="rule_parameter_us_ks_suta_rate" model="hr.rule.parameter">
|
||||
<field name="name">US KS Kasas SUTA Rate</field>
|
||||
<field name="code">us_ks_suta_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_ks_suta_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">2.7</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_ks_suta_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_ks_sit_allowances_rate" model="hr.rule.parameter">
|
||||
<field name="name">US KS Kansas Allowances Rate</field>
|
||||
<field name="code">us_ks_sit_allowances_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_ks_sit_allowances_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">{
|
||||
'weekly' : 43.27,
|
||||
'bi-weekly' : 86.54,
|
||||
'semi-monthly': 93.75,
|
||||
'monthly' : 187.50,
|
||||
'quarterly' : 562.50,
|
||||
'semi-annual': 1125.00,
|
||||
'annually': 2250.00,
|
||||
}</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_ks_sit_allowances_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_ks_sit_tax_rate" model="hr.rule.parameter">
|
||||
<field name="name">US KS Kasas SIT Tax Rate</field>
|
||||
<field name="code">us_ks_sit_tax_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_ks_sit_tax_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">{
|
||||
'single': {
|
||||
'weekly': ((58, 0.00, 0.00), (346, 3.10, 0.00), (635, 5.25, 8.94), ('inf', 5.70, 24.09)),
|
||||
'bi-weekly': ((115, 0.00, 0.00), (692, 3.10, 0.00), (1269, 5.25, 17.88), ('inf', 5.70, 48.17)),
|
||||
'semi-monthly': ((125, 0.00, 0.00), (750, 3.10, 0.00), (1375, 5.25, 19.38), ('inf', 5.70, 52.19)),
|
||||
'monthly': ((250, 0.00, 0.00), (1500, 3.10, 0.00), (2750, 5.25, 38.75), ('inf', 5.70, 104.38)),
|
||||
'quarterly': ((750, 0.00, 0.00), (4500, 3.10, 0.00), (8250, 5.25, 116.25), ('inf', 5.70, 313.13)),
|
||||
'semi-annual': ((1500, 0.00, 0.00), (9000, 3.10, 0.00), (16500, 5.25, 232.50), ('inf', 5.70, 626.25)),
|
||||
'annually': ((3000, 0.00, 0.00), (18000, 3.10, 0.00), (33000, 5.25, 465.00), ('inf', 5.70, 1252.50)),
|
||||
},
|
||||
'married': {
|
||||
'weekly': ((144, 0.00, 0.00), (721, 3.10, 0.00), (1298, 5.25, 17.88), ('inf', 5.70, 48.17)),
|
||||
'bi-weekly': ((288, 0.00, 0.00), (1442, 3.10, 0.00), (2596, 5.25, 35.77), ('inf', 5.70, 96.35)),
|
||||
'semi-monthly': ((313, 0.00, 0.00), (1563, 3.10, 0.00), (2813, 5.25, 38.75), ('inf', 5.70, 104.38)),
|
||||
'monthly': ((625, 0.00, 0.00), (3125, 3.10, 0.00), (5625, 5.25, 77.50), ('inf', 5.70, 208.75)),
|
||||
'quarterly': ((1875, 0.00, 0.00), (9375, 3.10, 0.00), (16875, 5.25, 232.50), ('inf', 5.70, 626.25)),
|
||||
'semi-annual': ((3750, 0.00, 0.00), (18750, 3.10, 0.00), (33750, 5.25, 465.00), ('inf', 5.70, 1252.50)),
|
||||
'annually': ((7500, 0.00, 0.00), (37500, 3.10, 0.00), (67500, 5.25, 930.00), ('inf', 5.70, 2505.00)),
|
||||
},
|
||||
'head_household': {
|
||||
'weekly': ((58, 0.00, 0.00), (346, 3.10, 0.00), (635, 5.25, 8.94), ('inf', 5.70, 24.09)),
|
||||
'bi-weekly': ((115, 0.00, 0.00), (692, 3.10, 0.00), (1269, 5.25, 17.88), ('inf', 5.70, 48.17)),
|
||||
'semi-monthly': ((125, 0.00, 0.00), (750, 3.10, 0.00), (1375, 5.25, 19.38), ('inf', 5.70, 52.19)),
|
||||
'monthly': ((250, 0.00, 0.00), (1500, 3.10, 0.00), (2750, 5.25, 38.75), ('inf', 5.70, 104.38)),
|
||||
'quarterly': ((750, 0.00, 0.00), (4500, 3.10, 0.00), (8250, 5.25, 116.25), ('inf', 5.70, 313.13)),
|
||||
'semi-annual': ((1500, 0.00, 0.00), (9000, 3.10, 0.00), (16500, 5.25, 232.50), ('inf', 5.70, 626.25)),
|
||||
'annually': ((3000, 0.00, 0.00), (18000, 3.10, 0.00), (33000, 5.25, 465.00), ('inf', 5.70, 1252.50)),
|
||||
},
|
||||
}</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_ks_sit_tax_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Partners and Contribution Registers -->
|
||||
<record id="res_partner_us_ks_dor" model="res.partner">
|
||||
<field name="name">US Kansas - Department of Labor - Unemployment Tax</field>
|
||||
</record>
|
||||
|
||||
<record id="res_partner_us_ks_dor_sit" model="res.partner">
|
||||
<field name="name">US Kansas - Department of Revenue - Income Tax</field>
|
||||
</record>
|
||||
|
||||
<!-- Categories -->
|
||||
|
||||
<!-- Rules -->
|
||||
<record id="hr_payroll_rule_er_us_ks_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 KS Kasas State Unemployment</field>
|
||||
<field name="code">ER_US_KS_SUTA</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_ks_suta_wage_base', rate='us_ks_suta_rate', state_code='KS')</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_ks_suta_wage_base', rate='us_ks_suta_rate', state_code='KS')</field>
|
||||
<field name="partner_id" ref="res_partner_us_ks_dor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_rule_ee_us_ks_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 KS Kasas State Income Tax Withholding</field>
|
||||
<field name="code">EE_US_KS_SIT</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = ks_kansas_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">result, result_rate = ks_kansas_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="partner_id" ref="res_partner_us_ks_dor_sit"/>
|
||||
<field name="appears_on_payslip" eval="True"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -25,6 +25,7 @@ from .state.ia_iowa import ia_iowa_state_income_withholding
|
||||
from .state.id_idaho import id_idaho_state_income_withholding
|
||||
from .state.il_illinois import il_illinois_state_income_withholding
|
||||
from .state.in_indiana import in_indiana_state_income_withholding
|
||||
from .state.ks_kansas import ks_kansas_state_income_withholding
|
||||
from .state.la_louisiana import la_louisiana_state_income_withholding
|
||||
from .state.me_maine import me_maine_state_income_withholding
|
||||
from .state.mi_michigan import mi_michigan_state_income_withholding
|
||||
@@ -87,6 +88,7 @@ class HRPayslip(models.Model):
|
||||
'id_idaho_state_income_withholding': id_idaho_state_income_withholding,
|
||||
'il_illinois_state_income_withholding': il_illinois_state_income_withholding,
|
||||
'in_indiana_state_income_withholding': in_indiana_state_income_withholding,
|
||||
'ks_kansas_state_income_withholding': ks_kansas_state_income_withholding,
|
||||
'la_louisiana_state_income_withholding': la_louisiana_state_income_withholding,
|
||||
'me_maine_state_income_withholding': me_maine_state_income_withholding,
|
||||
'mi_michigan_state_income_withholding': mi_michigan_state_income_withholding,
|
||||
|
||||
44
l10n_us_hr_payroll/models/state/ks_kansas.py
Normal file
44
l10n_us_hr_payroll/models/state/ks_kansas.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from .general import _state_applies, sit_wage
|
||||
|
||||
|
||||
def ks_kansas_state_income_withholding(payslip, categories, worked_days, inputs):
|
||||
"""
|
||||
Returns SIT eligible wage and rate.
|
||||
|
||||
:return: result, result_rate (wage, percent)
|
||||
"""
|
||||
state_code = 'KS'
|
||||
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('ks_k4_sit_filing_status')
|
||||
if not filing_status:
|
||||
return 0.0, 0.0
|
||||
|
||||
schedule_pay = payslip.contract_id.schedule_pay
|
||||
additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
|
||||
allowances = payslip.contract_id.us_payroll_config_value('ks_k4_sit_allowances')
|
||||
allowances_amt = payslip.rule_parameter('us_ks_sit_allowances_rate')[schedule_pay]
|
||||
tax_table = payslip.rule_parameter('us_ks_sit_tax_rate')[filing_status].get(schedule_pay)
|
||||
|
||||
taxable_income = wage - (allowances * allowances_amt)
|
||||
withholding = 0.0
|
||||
last = 0.0
|
||||
for row in tax_table:
|
||||
amt, rate, flat_fee = row
|
||||
if wage <= float(amt):
|
||||
withholding = ((taxable_income - last) * (rate / 100)) + flat_fee
|
||||
break
|
||||
last = amt
|
||||
|
||||
withholding = max(withholding, 0.0)
|
||||
withholding += additional
|
||||
withholding = round(withholding)
|
||||
return wage, -((withholding / wage) * 100.0)
|
||||
@@ -127,6 +127,13 @@ class HRContractUSPayrollConfig(models.Model):
|
||||
in_w4_sit_personal_exemption = fields.Integer(string='Indiana In-W-4 Number of Personal Exemption', help='IN-W-4 5.')
|
||||
in_w4_sit_dependent_exemption = fields.Integer(string='Indiana In-W-4 Number of Dependent Exemption', help='IN-W-4 6.')
|
||||
|
||||
ks_k4_sit_filing_status = fields.Selection([
|
||||
('single', 'Single'),
|
||||
('married', 'Married'),
|
||||
('head of household', 'Head of Household'),
|
||||
], string='Kansas K-4 Filing Status', help='KS K-4 3.')
|
||||
ks_k4_sit_allowances = fields.Integer(string='Kansas KS K-4 Number of Allowances', help='KS K-4 Step 4.')
|
||||
|
||||
la_l4_sit_filing_status = fields.Selection([
|
||||
('single', 'Single'),
|
||||
('married', 'Married'),
|
||||
|
||||
@@ -46,6 +46,8 @@ from . import test_us_il_illinois_payslip_2020
|
||||
|
||||
from . import test_us_in_indiana_payslip_2020
|
||||
|
||||
from . import test_us_ks_kansas_payslip_2020
|
||||
|
||||
from . import test_us_la_louisiana_payslip_2019
|
||||
from . import test_us_la_louisiana_payslip_2020
|
||||
|
||||
|
||||
35
l10n_us_hr_payroll/tests/test_us_ks_kansas_payslip_2020.py
Executable file
35
l10n_us_hr_payroll/tests/test_us_ks_kansas_payslip_2020.py
Executable file
@@ -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 TestUsKSPayslip(TestUsPayslip):
|
||||
###
|
||||
# 2020 Taxes and Rates
|
||||
###
|
||||
KS_UNEMP_MAX_WAGE = 14000.0
|
||||
KS_UNEMP = 2.7
|
||||
# Calculation based on example https://revenue.ky.gov/Forms/42A003(T)%20(12-2019)%202020%20Tax%20Tables.pdf
|
||||
|
||||
def _test_sit(self, wage, filing_status, allowances, additional_withholding, schedule_pay, date_start, expected_withholding):
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=wage,
|
||||
state_id=self.get_us_state('KS'),
|
||||
ks_k4_sit_filing_status=filing_status,
|
||||
ks_k4_sit_allowances=allowances,
|
||||
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('KS', self.KS_UNEMP, date(2020, 1, 1), wage_base=self.KS_UNEMP_MAX_WAGE)
|
||||
self._test_sit(625, 'married', 2, 0, 'semi-monthly', date(2020, 1, 1), 4.00)
|
||||
# self._test_sit(1500, 'single', 0, 0, 'bi-weekly', date(2020, 1, 1), 69.90)
|
||||
# self._test_sit(1500, 'single', 0, 0, 'bi-weekly', date(2020, 1, 1), 79.90)
|
||||
@@ -125,6 +125,13 @@
|
||||
<field name="in_w4_sit_dependent_exemption" string="Dependent Exemption 6."/>
|
||||
<field name="state_income_tax_additional_withholding" string="Additional Withholding 7."/>
|
||||
</group>
|
||||
<group name="state_ks_kansas" string="KS Kansas" attrs="{'invisible':[('state_id', '!=', %(base.state_us_17)s)]}">
|
||||
<p colspan="2"><h3>Form KS K-4 - State Income Tax</h3></p>
|
||||
<field name="ks_k4_sit_filing_status" string="Filing Status 3."/>
|
||||
<field name="ks_k4_sit_allowances" string="Allowances 4."/>
|
||||
<field name="state_income_tax_additional_withholding" string="Additional Withholding 5."/>
|
||||
<field name="state_income_tax_exempt" string="Exempt 6."/>
|
||||
</group>
|
||||
<group name="state_la_louisiana" string="LA Louisiana" attrs="{'invisible':[('state_id', '!=', %(base.state_us_19)s)]}">
|
||||
<p colspan="2"><h3>Form LA L-4 - State Income Tax</h3></p>
|
||||
<field name="la_l4_sit_filing_status" string="Filing Status 3."/>
|
||||
|
||||
Reference in New Issue
Block a user