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 and Improved test case for ME Maine 2020.
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- table based on https://www.maine.gov/revenue/forms/with/2020/20_WH_Tab&Instructions.pdf step 6.-->
|
||||
<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>
|
||||
@@ -37,14 +37,14 @@
|
||||
<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),
|
||||
( 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),
|
||||
( 44450, 0, 5.80),
|
||||
( 105200, 2578, 6.75),
|
||||
( 'inf', 6679, 7.15),
|
||||
),
|
||||
}</field>
|
||||
<field name="rule_parameter_id" ref="rule_parameter_us_me_sit_tax_rate"/>
|
||||
@@ -60,8 +60,14 @@
|
||||
<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)),
|
||||
'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()"/>
|
||||
|
||||
@@ -47,7 +47,6 @@ def me_maine_state_income_withholding(payslip, categories, worked_days, inputs):
|
||||
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:
|
||||
@@ -57,8 +56,7 @@ def me_maine_state_income_withholding(payslip, categories, worked_days, inputs):
|
||||
break
|
||||
last = amt
|
||||
|
||||
if withholding < 0.0:
|
||||
withholding = 0.0
|
||||
withholding = max(withholding, 0.0)
|
||||
withholding = round(withholding / pay_periods)
|
||||
withholding += additional
|
||||
return wage, -((withholding / wage) * 100.0)
|
||||
|
||||
@@ -143,7 +143,7 @@ class HRContractUSPayrollConfig(models.Model):
|
||||
|
||||
me_w4me_sit_filing_status = fields.Selection([
|
||||
('', 'Exempt'),
|
||||
('single', 'Single'),
|
||||
('single', 'Single or Head of Household'),
|
||||
('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.')
|
||||
|
||||
@@ -27,12 +27,13 @@ class TestUsMEPayslip(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('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(800.0, 'single', 0.0, False, 2, 'bi-weekly', date(2020, 1, 1), 6.00)
|
||||
self._test_sit(4500.0, 'married', 0.0, True, 0, 'weekly', date(2020, 1, 1), 0.00)
|
||||
self._test_sit(4500.0, 'married', 0.0, False, 2, 'monthly', date(2020, 1, 1), 113.00)
|
||||
self._test_sit(4500.0, 'married', 10.0, False, 2, 'weekly', date(2020, 1, 1), 287.00)
|
||||
self._test_sit(7000.0, '', 10.0, False, 2, 'weekly', date(2020, 1, 1), 0.00)
|
||||
|
||||
Reference in New Issue
Block a user