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: Refactored Tax table, changed tax rate and added additional withholding field. Improved test case for ME Maine 2020.
This commit is contained in:
@@ -27,17 +27,17 @@
|
||||
</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="parameter_value">1.14</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="parameter_value">1.14</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>
|
||||
|
||||
<!-- table data from http://www.revenue.louisiana.gov/taxforms/1306(7_09)W.pdf page 9. -->
|
||||
<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>
|
||||
@@ -46,16 +46,32 @@
|
||||
<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)),
|
||||
'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)),
|
||||
'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()"/>
|
||||
|
||||
@@ -24,6 +24,7 @@ def la_louisiana_state_income_withholding(payslip, categories, worked_days, inpu
|
||||
|
||||
pay_periods = payslip.dict.get_pay_periods_in_year()
|
||||
personal_exemptions = payslip.contract_id.us_payroll_config_value('la_l4_sit_exemptions')
|
||||
additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
|
||||
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')
|
||||
@@ -57,4 +58,5 @@ def la_louisiana_state_income_withholding(payslip, categories, worked_days, inpu
|
||||
|
||||
withholding = withholding - (after_credits_under + after_credits_over)
|
||||
withholding = round(withholding, 2)
|
||||
withholding += additional
|
||||
return wage, -((withholding / wage) * 100.0)
|
||||
|
||||
@@ -7,7 +7,7 @@ class TestUsLAPayslip(TestUsPayslip):
|
||||
|
||||
# TAXES AND RATES
|
||||
LA_UNEMP_MAX_WAGE = 7700.00
|
||||
LA_UNEMP = -(6.20 / 100.0)
|
||||
LA_UNEMP = -(1.14 / 100.0)
|
||||
|
||||
def test_taxes_single_weekly(self):
|
||||
salary = 700.00
|
||||
@@ -15,6 +15,7 @@ class TestUsLAPayslip(TestUsPayslip):
|
||||
filing_status = 'single'
|
||||
exemptions = 1
|
||||
dependents = 2
|
||||
additional_withholding = 0
|
||||
# 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.
|
||||
@@ -24,6 +25,7 @@ class TestUsLAPayslip(TestUsPayslip):
|
||||
wage=salary,
|
||||
state_id=self.get_us_state('LA'),
|
||||
la_l4_sit_filing_status=filing_status,
|
||||
state_income_tax_additional_withholding=additional_withholding,
|
||||
la_l4_sit_exemptions=exemptions,
|
||||
la_l4_sit_dependents=dependents,
|
||||
schedule_pay=schedule_pay)
|
||||
@@ -54,6 +56,7 @@ class TestUsLAPayslip(TestUsPayslip):
|
||||
filing_status = 'married'
|
||||
exemptions = 2
|
||||
dependents = 3
|
||||
additional_withholding = 0
|
||||
# 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
|
||||
@@ -62,6 +65,7 @@ class TestUsLAPayslip(TestUsPayslip):
|
||||
wage=salary,
|
||||
state_id=self.get_us_state('LA'),
|
||||
la_l4_sit_filing_status=filing_status,
|
||||
state_income_tax_additional_withholding=additional_withholding,
|
||||
la_l4_sit_exemptions=exemptions,
|
||||
la_l4_sit_dependents=dependents,
|
||||
schedule_pay=schedule_pay)
|
||||
|
||||
@@ -9,15 +9,16 @@ class TestUsLAPayslip(TestUsPayslip):
|
||||
# 2020 Taxes and Rates
|
||||
###
|
||||
LA_UNEMP_MAX_WAGE = 7700.0
|
||||
LA_UNEMP = 6.20
|
||||
LA_UNEMP = 1.14
|
||||
# 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):
|
||||
def _test_sit(self, wage, filing_status, additional_withholding, 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,
|
||||
state_income_tax_additional_withholding=additional_withholding,
|
||||
la_l4_sit_exemptions=exemptions,
|
||||
la_l4_sit_dependents=dependents,
|
||||
schedule_pay=schedule_pay)
|
||||
@@ -26,9 +27,10 @@ class TestUsLAPayslip(TestUsPayslip):
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self._log('Computed period tax: ' + str(expected_withholding))
|
||||
self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
|
||||
self.assertPayrollAlmostEqual(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)
|
||||
self._test_sit(700.0, 'single', 0.0, 1.0, 2.0, 'weekly', date(2020, 1, 1), 19.43)
|
||||
self._test_sit(4600.0, 'married', 0.0, 2.0, 3.0, 'bi-weekly', date(2020, 1, 1), 157.12)
|
||||
self._test_sit(6000.0, 'single', 10.0, 2.0, 3.0, 'monthly', date(2020, 1, 1), 219.08)
|
||||
|
||||
@@ -142,6 +142,7 @@
|
||||
<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."/>
|
||||
<field name="state_income_tax_additional_withholding" string="Additional Withholding 8."/>
|
||||
</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>
|
||||
|
||||
Reference in New Issue
Block a user