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 Maine 13.0
This commit is contained in:
@@ -41,6 +41,7 @@ United States of America - Payroll Rules.
|
||||
'data/state/il_illinois.xml',
|
||||
'data/state/in_indiana.xml',
|
||||
'data/state/la_louisiana.xml',
|
||||
'data/state/me_maine.xml',
|
||||
'data/state/mi_michigan.xml',
|
||||
'data/state/mn_minnesota.xml',
|
||||
'data/state/mo_missouri.xml',
|
||||
|
||||
125
l10n_us_hr_payroll/data/state/me_maine.xml
Normal file
125
l10n_us_hr_payroll/data/state/me_maine.xml
Normal file
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<!-- Wage Base -->
|
||||
<record id="rule_parameter_us_me_suta_wage_base" model="hr.rule.parameter">
|
||||
<field name="name">US ME Maine SUTA Wage Base</field>
|
||||
<field name="code">us_me_suta_wage_base</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_me_suta_wage_base_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">12000.0</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_me_suta_wage_base"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Rate -->
|
||||
<record id="rule_parameter_us_me_suta_rate" model="hr.rule.parameter">
|
||||
<field name="name">US ME Maine SUTA Rate</field>
|
||||
<field name="code">us_me_suta_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_me_suta_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">1.92</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_me_suta_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_me_sit_tax_rate" model="hr.rule.parameter">
|
||||
<field name="name">US ME Maine SIT Tax Rate</field>
|
||||
<field name="code">us_me_sit_tax_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_me_sit_tax_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">{
|
||||
'single': (
|
||||
( 22200, 0, 5.80),
|
||||
( 52600, 1288, 6.75),
|
||||
( 'inf', 3340, 7.15),
|
||||
),
|
||||
'married': (
|
||||
( 44450, 0, 0.00),
|
||||
( 105200, 2578, 6.75),
|
||||
( 'inf', 6679, 7.15),
|
||||
),
|
||||
}</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_me_sit_tax_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_me_sit_standard_deduction_rate" model="hr.rule.parameter">
|
||||
<field name="name">US ME Maine Standard Deduction Rate</field>
|
||||
<field name="code">us_me_sit_standard_deduction_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_me_sit_standard_deduction_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">{
|
||||
'single': (( 82900, 9550), (157900, 75000)),
|
||||
'married': ((165800, 21950), (315800, 150000)),
|
||||
}</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_me_sit_standard_deduction_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<record id="rule_parameter_us_me_sit_personal_exemption_rate" model="hr.rule.parameter">
|
||||
<field name="name">US ME Maine Personal Exemption Rate</field>
|
||||
<field name="code">us_me_sit_personal_exemption_rate</field>
|
||||
<field name="country_id" ref="base.us"/>
|
||||
</record>
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_me_sit_personal_exemption_rate_2020" model="hr.rule.parameter.value">
|
||||
<field name="parameter_value">4300</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_me_sit_personal_exemption_rate"/>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
|
||||
<!-- Partners and Contribution Registers -->
|
||||
<record id="res_partner_us_me_dor" model="res.partner">
|
||||
<field name="name">US Maine - Department Of Labor | ReEmploy - Unemployment Tax</field>
|
||||
</record>
|
||||
|
||||
<record id="res_partner_us_me_dor_sit" model="res.partner">
|
||||
<field name="name">US Maine - Department Of Revenue Services - Income Tax</field>
|
||||
</record>
|
||||
|
||||
<!-- Categories -->
|
||||
|
||||
<!-- Rules -->
|
||||
<record id="hr_payroll_rule_er_us_me_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 ME Maine State Unemployment</field>
|
||||
<field name="code">ER_US_ME_SUTA</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_me_suta_wage_base', rate='us_me_suta_rate', state_code='ME')</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_me_suta_wage_base', rate='us_me_suta_rate', state_code='ME')</field>
|
||||
<field name="partner_id" ref="res_partner_us_me_dor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_rule_ee_us_me_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 ME Maine State Income Tax Withholding</field>
|
||||
<field name="code">EE_US_ME_SIT</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = me_maine_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">result, result_rate = me_maine_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="partner_id" ref="res_partner_us_me_dor_sit"/>
|
||||
<field name="appears_on_payslip" eval="True"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -26,6 +26,7 @@ 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.me_maine import me_maine_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
|
||||
@@ -87,6 +88,7 @@ class HRPayslip(models.Model):
|
||||
'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,
|
||||
'me_maine_state_income_withholding': me_maine_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,
|
||||
|
||||
64
l10n_us_hr_payroll/models/state/me_maine.py
Normal file
64
l10n_us_hr_payroll/models/state/me_maine.py
Normal file
@@ -0,0 +1,64 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from .general import _state_applies, sit_wage
|
||||
|
||||
|
||||
def me_maine_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 = 'ME'
|
||||
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('me_w4me_sit_filing_status')
|
||||
if not filing_status:
|
||||
return 0.0, 0.0
|
||||
|
||||
exempt = payslip.contract_id.us_payroll_config_value('state_income_tax_exempt')
|
||||
if exempt:
|
||||
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')
|
||||
allowances = payslip.contract_id.us_payroll_config_value('me_w4me_sit_allowances')
|
||||
tax_rate = payslip.rule_parameter('us_me_sit_tax_rate')[filing_status]
|
||||
personal_exemption = payslip.rule_parameter('us_me_sit_personal_exemption_rate')
|
||||
standard_deduction = payslip.rule_parameter('us_me_sit_standard_deduction_rate')[filing_status]
|
||||
|
||||
taxable_income = wage * pay_periods
|
||||
exemption_amt = allowances * personal_exemption
|
||||
last = 0.0
|
||||
standard_deduction_amt = 0.0
|
||||
for row in standard_deduction:
|
||||
amt, flat_amt = row
|
||||
if taxable_income < 82900:
|
||||
standard_deduction_amt = flat_amt
|
||||
break
|
||||
elif taxable_income < amt:
|
||||
standard_deduction_amt = last * (amt - taxable_income) / flat_amt
|
||||
break
|
||||
last = flat_amt
|
||||
|
||||
annual_income = taxable_income - (exemption_amt + standard_deduction_amt)
|
||||
withholding = 0.0
|
||||
for row in tax_rate:
|
||||
amt, flat_fee, rate = row
|
||||
if annual_income < float(amt):
|
||||
withholding = ((annual_income - last) * (rate / 100)) + flat_fee
|
||||
break
|
||||
last = amt
|
||||
|
||||
if withholding < 0.0:
|
||||
withholding = 0.0
|
||||
withholding = round(withholding / pay_periods)
|
||||
withholding += additional
|
||||
return wage, -((withholding / wage) * 100.0)
|
||||
@@ -134,6 +134,13 @@ class HRContractUSPayrollConfig(models.Model):
|
||||
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.')
|
||||
|
||||
me_w4me_sit_filing_status = fields.Selection([
|
||||
('', 'Exempt'),
|
||||
('single', 'Single'),
|
||||
('married', 'Married'),
|
||||
], string='Maine W-4ME Filing Status', help='ME W-4ME 3.')
|
||||
me_w4me_sit_allowances = fields.Integer(string='Maine Allowances', help='W-4ME 4.')
|
||||
|
||||
mi_w4_sit_exemptions = fields.Integer(string='Michigan MI W-4 Exemptions', help='MI-W4 6.')
|
||||
|
||||
mn_w4mn_sit_filing_status = fields.Selection([
|
||||
|
||||
@@ -49,6 +49,8 @@ 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_me_maine_payslip_2020
|
||||
|
||||
from . import test_us_mi_michigan_payslip_2019
|
||||
from . import test_us_mi_michigan_payslip_2020
|
||||
|
||||
|
||||
38
l10n_us_hr_payroll/tests/test_us_me_maine_payslip_2020.py
Normal file
38
l10n_us_hr_payroll/tests/test_us_me_maine_payslip_2020.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# 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 TestUsMEPayslip(TestUsPayslip):
|
||||
###
|
||||
# 2020 Taxes and Rates
|
||||
###
|
||||
ME_UNEMP_MAX_WAGE = 12000.0
|
||||
ME_UNEMP = 1.92
|
||||
# Calculation based on this file page.6 and 7 https://www.maine.gov/revenue/forms/with/2020/20_WH_Tab&Instructions.pdf
|
||||
|
||||
def _test_sit(self, wage, filing_status, additional_withholding, exempt, allowances, schedule_pay, date_start, expected_withholding):
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=wage,
|
||||
state_id=self.get_us_state('ME'),
|
||||
me_w4me_sit_filing_status=filing_status,
|
||||
state_income_tax_additional_withholding=additional_withholding,
|
||||
state_income_tax_exempt=exempt,
|
||||
me_w4me_sit_allowances=allowances,
|
||||
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('ME', self.ME_UNEMP, date(2020, 1, 1), wage_base=self.ME_UNEMP_MAX_WAGE)
|
||||
self._test_sit(300.0, 'single', 0.0, False, 2, 'weekly', date(2020, 1, 1), 0.0)
|
||||
self._test_sit(800.0, 'single', 0.0, False, 2, 'weekly', date(2020, 1, 1), 26.00)
|
||||
self._test_sit(4500.0, 'married', 0.0, False, 2, 'weekly', date(2020, 1, 1), 277.00)
|
||||
self._test_sit(4500.0, 'married', 0.0, True, 2, 'weekly', date(2020, 1, 1), 0.00)
|
||||
self._test_sit(4500.0, 'married', 10.0, False, 2, 'weekly', date(2020, 1, 1), 287.00)
|
||||
@@ -131,6 +131,13 @@
|
||||
<field name="la_l4_sit_exemptions" string="Personal Exemption 6."/>
|
||||
<field name="la_l4_sit_dependents" string="Dependent Exemption 7."/>
|
||||
</group>
|
||||
<group name="state_me_maine" string="ME Maine" attrs="{'invisible':[('state_id', '!=', %(base.state_us_20)s)]}">
|
||||
<p colspan="2"><h3>Form W-4ME - State Income Tax</h3></p>
|
||||
<field name="me_w4me_sit_filing_status" string="Filing Status 3."/>
|
||||
<field name="me_w4me_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_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