[IMP] l10n_us_hr_payroll: Added Tax table and improved Test case for MT Montana 2020

This commit is contained in:
Bhoomi Vaishnani
2020-08-21 15:48:22 -04:00
parent 2f5503c0da
commit 1d45b0bf11
2 changed files with 86 additions and 15 deletions

View File

@@ -64,40 +64,78 @@
<data noupdate="1">
<record id="rule_parameter_us_mt_sit_rate_2019" model="hr.rule.parameter.value">
<field name="parameter_value">{
'weekly': [
'weekly': (
( 135.00, 0.0, 1.80),
( 288.00, 2.0, 4.40),
( 2308.00, 9.0, 6.00),
( 'inf', 130.0, 6.60),
],
'bi-weekly': [
),
'bi-weekly': (
( 269.00, 0.0, 1.80),
( 577.00, 5.0, 4.40),
( 4615.00, 18.0, 6.00),
( 'inf', 261.0, 6.60),
],
'semi-monthly': [
),
'semi-monthly': (
( 292.00, 0.0, 1.80),
( 625.00, 5.0, 4.40),
( 5000.00, 20.0, 6.00),
( 'inf', 282.0, 6.60),
],
'monthly': [
),
'monthly': (
( 583.00, 0.0, 1.80),
( 1250.00, 11.0, 4.40),
( 10000.00, 40.0, 6.00),
( 'inf', 565.0, 6.60),
],
'annually': [
),
'annually': (
( 7000.00, 0.0, 1.80),
( 15000.00, 126.0, 4.40),
( 120000.00, 478.0, 6.00),
( 'inf', 6778.0, 6.60),
],
),
}</field>
<field name="rule_parameter_id" ref="rule_parameter_us_mt_sit_rate"/>
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
</record>
<!-- https://app.mt.gov/myrevenue/Endpoint/DownloadPdf?yearId=705 -->
<!-- Table Montana Withholding Tax Formula for Computerized Payroll Systems -->
<record id="rule_parameter_us_mt_sit_rate_2020" model="hr.rule.parameter.value">
<field name="parameter_value">{
'weekly': (
( 135.00, 0.0, 1.80),
( 288.00, 2.0, 4.40),
( 2308.00, 9.0, 6.00),
( 'inf', 130.0, 6.60),
),
'bi-weekly': (
( 269.00, 0.0, 1.80),
( 577.00, 5.0, 4.40),
( 4615.00, 18.0, 6.00),
( 'inf', 261.0, 6.60),
),
'semi-monthly': (
( 292.00, 0.0, 1.80),
( 625.00, 5.0, 4.40),
( 5000.00, 20.0, 6.00),
( 'inf', 282.0, 6.60),
),
'monthly': (
( 583.00, 0.0, 1.80),
( 1250.00, 11.0, 4.40),
( 10000.00, 40.0, 6.00),
( 'inf', 565.0, 6.60),
),
'annually': (
( 7000.00, 0.0, 1.80),
( 15000.00, 126.0, 4.40),
( 120000.00, 478.0, 6.00),
( 'inf', 6778.0, 6.60),
),
}</field>
<field name="rule_parameter_id" ref="rule_parameter_us_mt_sit_rate"/>
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
</record>
</data>
<record id="rule_parameter_us_mt_sit_exemption_rate" model="hr.rule.parameter">
@@ -117,6 +155,19 @@
<field name="rule_parameter_id" ref="rule_parameter_us_mt_sit_exemption_rate"/>
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
</record>
<!-- https://app.mt.gov/myrevenue/Endpoint/DownloadPdf?yearId=705 -->
<!-- Table Montana Withholding Tax Formula for Computerized Payroll Systems -->
<record id="rule_parameter_us_mt_sit_exemption_rate_2020" model="hr.rule.parameter.value">
<field name="parameter_value">{
'weekly': 37.0,
'bi-weekly': 73.0,
'semi-monthly': 79.0,
'monthly': 158.0,
'annually': 1900.0,
}</field>
<field name="rule_parameter_id" ref="rule_parameter_us_mt_sit_exemption_rate"/>
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
</record>
</data>
<!-- Partners and Contribution Registers -->

View File

@@ -1,17 +1,37 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from datetime import date
from .common import TestUsPayslip, process_payslip
from datetime import date, timedelta
from .common import TestUsPayslip
class TestUsMtPayslip(TestUsPayslip):
# Calculations from https://app.mt.gov/myrevenue/Endpoint/DownloadPdf?yearId=705
###
# 2020 Taxes and Rates
###
MT_UNEMP_WAGE_MAX = 34100.0
MT_UNEMP = 1.18
MT_UNEMP_AFT = 0.13
# Calculations from https://app.mt.gov/myrevenue/Endpoint/DownloadPdf?yearId=705
def _test_sit(self, wage, additional_withholding, exemptions, schedule_pay, date_start, expected_withholding):
employee = self._createEmployee()
contract = self._createContract(employee,
wage=wage,
state_id=self.get_us_state('MT'),
state_income_tax_additional_withholding=additional_withholding,
mt_mw4_sit_exemptions=exemptions,
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_one(self):
combined_rate = self.MT_UNEMP + self.MT_UNEMP_AFT # Combined for test as they both go to the same category and have the same cap
self._test_er_suta('MT', combined_rate, date(2020, 1, 1), wage_base=self.MT_UNEMP_WAGE_MAX)
# TODO Montana Incometax rates for 2020 when released
self._test_sit(550.0, 0.0, 5.0, 'semi-monthly', date(2020, 1, 1), 3.0)
self._test_sit(2950.0, 10.0, 2.0, 'bi-weekly', date(2020, 1, 1), 162.0)
self._test_sit(5000.0, 0.0, 1.0, 'monthly', date(2020, 1, 1), 256.0)
self._test_sit(750.0, 0.0, 1.0, 'weekly', date(2020, 1, 1), 34.0)