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 Port l10n_us_la_hr_payroll LA Louisiana including migration
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/la_louisiana.xml',
|
||||
'data/state/mi_michigan.xml',
|
||||
'data/state/mn_minnesota.xml',
|
||||
'data/state/mo_missouri.xml',
|
||||
|
||||
141
l10n_us_hr_payroll/data/state/la_louisiana.xml
Normal file
141
l10n_us_hr_payroll/data/state/la_louisiana.xml
Normal file
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<!-- Wage Base -->
|
||||
<record id="rule_parameter_us_la_suta_wage_base" model="hr.rule.parameter">
|
||||
<field name="name">US LA Louisiana SUTA Wage Base</field>
|
||||
<field name="code">us_la_suta_wage_base</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_la_suta_wage_base_2019" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">7700.0</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_la_suta_wage_base"/>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_la_suta_wage_base_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">7700.0</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_la_suta_wage_base"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Rate -->
|
||||
<record id="rule_parameter_us_la_suta_rate" model="hr.rule.parameter">
|
||||
<field name="name">US LA Louisiana SUTA Rate</field>
|
||||
<field name="code">us_la_suta_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_la_suta_rate_2019" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">6.20</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_la_suta_rate"/>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_la_suta_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">6.20</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_la_suta_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_la_sit_tax_rate" model="hr.rule.parameter">
|
||||
<field name="name">US LA Louisiana SIT Tax Rate</field>
|
||||
<field name="code">us_la_sit_tax_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_la_sit_tax_rate_2019" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">{
|
||||
'single': ((12500.00, 2.10), (50000.00, 1.60), ('inf', 1.35)),
|
||||
'married': ((25000.00, 2.10), (100000.00, 1.65), ('inf', 1.35)),
|
||||
}</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_la_sit_tax_rate"/>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_la_sit_tax_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">{
|
||||
'single': ((12500.00, 2.10), (50000.00, 1.60), ('inf', 1.35)),
|
||||
'married': ((25000.00, 2.10), (100000.00, 1.65), ('inf', 1.35)),
|
||||
}</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_la_sit_tax_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_la_sit_personal_exemption_rate" model="hr.rule.parameter">
|
||||
<field name="name">US LA Louisiana Personal Exemption Rate</field>
|
||||
<field name="code">us_la_sit_personal_exemption_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_la_sit_personal_exemption_rate_2019" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">4500</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_la_sit_personal_exemption_rate"/>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_la_sit_personal_exemption_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">4500</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_la_sit_personal_exemption_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_la_sit_dependent_rate" model="hr.rule.parameter">
|
||||
<field name="name">US LA Louisiana Dependent Rate</field>
|
||||
<field name="code">us_la_sit_dependent_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_la_sit_dependent_rate_2019" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">1000.0</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_la_sit_dependent_rate"/>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_la_sit_dependent_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">1000.0</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_la_sit_dependent_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Partners and Contribution Registers -->
|
||||
<record id="res_partner_us_la_dor" model="res.partner">
|
||||
<field name="name">US Louisiana - Workforce Commission (LWC) - Unemployment Tax</field>
|
||||
</record>
|
||||
|
||||
<record id="res_partner_us_la_dor_sit" model="res.partner">
|
||||
<field name="name">US Louisiana - Department of Revenue (LDOR) - Income Tax</field>
|
||||
</record>
|
||||
|
||||
<!-- Categories -->
|
||||
|
||||
<!-- Rules -->
|
||||
<record id="hr_payroll_rule_er_us_la_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 LA Louisiana State Unemployment</field>
|
||||
<field name="code">ER_US_LA_SUTA</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_la_suta_wage_base', rate='us_la_suta_rate', state_code='LA')</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_la_suta_wage_base', rate='us_la_suta_rate', state_code='LA')</field>
|
||||
<field name="partner_id" ref="res_partner_us_la_dor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_rule_ee_us_la_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 LA Louisiana State Income Tax Withholding</field>
|
||||
<field name="code">EE_US_LA_SIT</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = la_louisiana_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">result, result_rate = la_louisiana_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="partner_id" ref="res_partner_us_la_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.la_louisiana import la_louisiana_state_income_withholding
|
||||
from .state.mi_michigan import mi_michigan_state_income_withholding
|
||||
from .state.mn_minnesota import mn_minnesota_state_income_withholding
|
||||
from .state.mo_missouri import mo_missouri_state_income_withholding
|
||||
@@ -81,6 +82,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,
|
||||
'la_louisiana_state_income_withholding': la_louisiana_state_income_withholding,
|
||||
'mi_michigan_state_income_withholding': mi_michigan_state_income_withholding,
|
||||
'mn_minnesota_state_income_withholding': mn_minnesota_state_income_withholding,
|
||||
'mo_missouri_state_income_withholding': mo_missouri_state_income_withholding,
|
||||
|
||||
60
l10n_us_hr_payroll/models/state/la_louisiana.py
Normal file
60
l10n_us_hr_payroll/models/state/la_louisiana.py
Normal file
@@ -0,0 +1,60 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from .general import _state_applies, sit_wage
|
||||
|
||||
|
||||
def la_louisiana_state_income_withholding(payslip, categories, worked_days, inputs):
|
||||
"""
|
||||
Returns SIT eligible wage and rate.
|
||||
|
||||
:return: result, result_rate (wage, percent)
|
||||
"""
|
||||
state_code = 'LA'
|
||||
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('la_l4_sit_filing_status')
|
||||
if not filing_status:
|
||||
return 0.0, 0.0
|
||||
|
||||
pay_periods = payslip.dict.get_pay_periods_in_year()
|
||||
personal_exemptions = payslip.contract_id.us_payroll_config_value('la_l4_sit_exemptions')
|
||||
dependent_exemptions = payslip.contract_id.us_payroll_config_value('la_l4_sit_dependents')
|
||||
tax_table = payslip.rule_parameter('us_la_sit_tax_rate')[filing_status]
|
||||
exemption_rate = payslip.rule_parameter('us_la_sit_personal_exemption_rate')
|
||||
dependent_rate = payslip.rule_parameter('us_la_sit_dependent_rate')
|
||||
|
||||
annual_wage = wage * pay_periods
|
||||
|
||||
effect_cap = 0.0
|
||||
multiplier = 0.0
|
||||
if filing_status == 'single':
|
||||
effect_cap = 12500.00
|
||||
multiplier = 1.60
|
||||
elif filing_status == 'married':
|
||||
effect_cap = 25000.00
|
||||
multiplier = 1.65
|
||||
|
||||
after_credits_under = (2.100 / 100) * (((personal_exemptions * exemption_rate) +
|
||||
(dependent_exemptions * dependent_rate)) / pay_periods)
|
||||
after_credits_over = 0.00
|
||||
if after_credits_under > effect_cap:
|
||||
after_credits_under = effect_cap
|
||||
after_credits_over_check = ((personal_exemptions * exemption_rate) + (dependent_exemptions * dependent_rate)) - effect_cap
|
||||
after_credits_over = (multiplier / 100.00) * (after_credits_over_check / pay_periods) if after_credits_over_check > 0 else 0.00
|
||||
withholding = 0.0
|
||||
last = 0.0
|
||||
for amt, rate in tax_table:
|
||||
withholding = withholding + ((rate / 100.0) * (wage - (last / pay_periods)))
|
||||
if annual_wage <= float(amt):
|
||||
break
|
||||
last = amt
|
||||
|
||||
withholding = withholding - (after_credits_under + after_credits_over)
|
||||
withholding = round(withholding, 2)
|
||||
return wage, -((withholding / wage) * 100.0)
|
||||
@@ -126,6 +126,14 @@ 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.')
|
||||
|
||||
la_l4_sit_filing_status = fields.Selection([
|
||||
('single', 'Single'),
|
||||
('married', 'Married'),
|
||||
], string='Louisiana LA L-4 Filing Status', help='LA L-4 3.')
|
||||
la_l4_sit_exemptions = fields.Integer(string='Louisiana LA L-4 Number of Exemptions', help='LA L-4 6.')
|
||||
la_l4_sit_dependents = fields.Integer(string='Louisiana LA L-4 Number of Dependents', help='LA L-4 7.')
|
||||
|
||||
mi_w4_sit_exemptions = fields.Integer(string='Michigan MI W-4 Exemptions', help='MI-W4 6.')
|
||||
|
||||
mn_w4mn_sit_filing_status = fields.Selection([
|
||||
|
||||
@@ -46,6 +46,9 @@ from . import test_us_il_illinois_payslip_2020
|
||||
|
||||
from . import test_us_in_indiana_payslip_2020
|
||||
|
||||
from . import test_us_la_louisiana_payslip_2019
|
||||
from . import test_us_la_louisiana_payslip_2020
|
||||
|
||||
from . import test_us_mi_michigan_payslip_2019
|
||||
from . import test_us_mi_michigan_payslip_2020
|
||||
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from .common import TestUsPayslip, process_payslip
|
||||
|
||||
|
||||
class TestUsLAPayslip(TestUsPayslip):
|
||||
|
||||
# TAXES AND RATES
|
||||
LA_UNEMP_MAX_WAGE = 7700.00
|
||||
LA_UNEMP = -(6.20 / 100.0)
|
||||
|
||||
def test_taxes_single_weekly(self):
|
||||
salary = 700.00
|
||||
schedule_pay = 'weekly'
|
||||
filing_status = 'single'
|
||||
exemptions = 1
|
||||
dependents = 2
|
||||
# SEE http://revenue.louisiana.gov/TaxForms/1306(1_12)TF.pdf for example calculations
|
||||
# wh_to test is 19.42
|
||||
# Our algorithm correctly rounds whereas theirs does it prematurely.
|
||||
wh_to_check = -19.43
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=salary,
|
||||
state_id=self.get_us_state('LA'),
|
||||
la_l4_sit_filing_status=filing_status,
|
||||
la_l4_sit_exemptions=exemptions,
|
||||
la_l4_sit_dependents=dependents,
|
||||
schedule_pay=schedule_pay)
|
||||
|
||||
self._log('2019 Louisiana tax first payslip weekly:')
|
||||
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||
payslip.compute_sheet()
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['ER_US_SUTA'], salary * self.LA_UNEMP)
|
||||
self.assertPayrollEqual(cats['EE_US_SIT'], wh_to_check)
|
||||
|
||||
process_payslip(payslip)
|
||||
|
||||
remaining_la_unemp_wages = self.LA_UNEMP_MAX_WAGE - salary if (self.LA_UNEMP_MAX_WAGE - 2*salary < salary) \
|
||||
else salary
|
||||
|
||||
self._log('2019 Louisiana tax second payslip weekly:')
|
||||
payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
|
||||
payslip.compute_sheet()
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_la_unemp_wages * self.LA_UNEMP)
|
||||
|
||||
def test_taxes_married_biweekly(self):
|
||||
salary = 4600.00
|
||||
schedule_pay = 'bi-weekly'
|
||||
filing_status = 'married'
|
||||
exemptions = 2
|
||||
dependents = 3
|
||||
# SEE http://revenue.louisiana.gov/TaxForms/1306(1_12)TF.pdf for example calculations
|
||||
# wh_to test is 157.12
|
||||
wh_to_check = -157.12
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=salary,
|
||||
state_id=self.get_us_state('LA'),
|
||||
la_l4_sit_filing_status=filing_status,
|
||||
la_l4_sit_exemptions=exemptions,
|
||||
la_l4_sit_dependents=dependents,
|
||||
schedule_pay=schedule_pay)
|
||||
|
||||
self._log('2019 Louisiana tax first payslip bi-weekly:')
|
||||
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||
payslip.compute_sheet()
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['ER_US_SUTA'], salary * self.LA_UNEMP)
|
||||
self.assertPayrollEqual(cats['EE_US_SIT'], wh_to_check)
|
||||
|
||||
process_payslip(payslip)
|
||||
|
||||
remaining_la_unemp_wages = self.LA_UNEMP_MAX_WAGE - salary if (self.LA_UNEMP_MAX_WAGE - 2*salary < salary) \
|
||||
else salary
|
||||
|
||||
self._log('2019 Louisiana tax second payslip bi-weekly:')
|
||||
payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
|
||||
payslip.compute_sheet()
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_la_unemp_wages * self.LA_UNEMP)
|
||||
34
l10n_us_hr_payroll/tests/test_us_la_louisiana_payslip_2020.py
Executable file
34
l10n_us_hr_payroll/tests/test_us_la_louisiana_payslip_2020.py
Executable file
@@ -0,0 +1,34 @@
|
||||
# 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 TestUsLAPayslip(TestUsPayslip):
|
||||
###
|
||||
# 2020 Taxes and Rates
|
||||
###
|
||||
LA_UNEMP_MAX_WAGE = 7700.0
|
||||
LA_UNEMP = 6.20
|
||||
# Calculation based on http://revenue.louisiana.gov/TaxForms/1306(1_12)TF.pdf
|
||||
|
||||
def _test_sit(self, wage, filing_status, exemptions, dependents, schedule_pay, date_start, expected_withholding):
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=wage,
|
||||
state_id=self.get_us_state('LA'),
|
||||
la_l4_sit_filing_status=filing_status,
|
||||
la_l4_sit_exemptions=exemptions,
|
||||
la_l4_sit_dependents=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('LA', self.LA_UNEMP, date(2020, 1, 1), wage_base=self.LA_UNEMP_MAX_WAGE)
|
||||
self._test_sit(700.0, 'single', 1.0, 2.0, 'weekly', date(2020, 1, 1), 19.43)
|
||||
self._test_sit(4600.0, 'married', 2.0, 3.0, 'bi-weekly', date(2020, 1, 1), 157.12)
|
||||
@@ -125,6 +125,12 @@
|
||||
<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_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."/>
|
||||
<field name="la_l4_sit_exemptions" string="Personal Exemption 6."/>
|
||||
<field name="la_l4_sit_dependents" string="Dependent Exemption 7."/>
|
||||
</group>
|
||||
<group name="state_mi_michigan" string="MI Michigan" attrs="{'invisible':[('state_id', '!=', %(base.state_us_35)s)]}">
|
||||
<p colspan="2"><h3>Form MI-W4 - State Income Tax</h3></p>
|
||||
<field name="mi_w4_sit_exemptions" string="Exemptions 6."/>
|
||||
|
||||
Reference in New Issue
Block a user