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: Reformat tax table, improved comments and test case for IA Iowa 2020
This commit is contained in:
@@ -46,24 +46,146 @@
|
|||||||
<data noupdate="1">
|
<data noupdate="1">
|
||||||
<record id="rule_parameter_us_ia_sit_tax_rate_2019" model="hr.rule.parameter.value">
|
<record id="rule_parameter_us_ia_sit_tax_rate_2019" model="hr.rule.parameter.value">
|
||||||
<field name="parameter_value">{
|
<field name="parameter_value">{
|
||||||
'daily': [(5.13, 0.0033, 0.0), (10.25, 0.0067, 0.02), (20.50, 0.0225, 0.05), (46.13, 0.0414, 0.28), (76.89, 0.0563, 1.34), (102.52, 0.0596, 3.07), (153.78, 0.0625, 4.60), (230.68, 0.0744, 7.80), ('inf', 0.0853, 13.52)],
|
'daily': (
|
||||||
'weekly': [(25.63, 0.0033, 0.0), (51.27, 0.0067, 0.08), (102.52, 0.0225, 0.025), (230.67, 0.0414, 1.40), (384.46, 0.0563, 6.71), (512.62, 0.0596, 15.37), (768.92, 0.0625, 23.01), (1153.38, 0.0744, 39.03), ('inf', 0.0853, 67.63)],
|
( 5.13, 0.0033, 0.00),
|
||||||
'bi-weekly': [(51.27, 0.0033, 0.00), (102.54, 0.0067, 0.17), (205.04, 0.00225, 0.51), (461.35, 0.0414, 2.82), (768.92, 0.0563, 13.43), (1025.23, 0.0596, 30.75), (1537.85, 0.0625, 46.03), (2306.77, 0.0744, 78.07), ('inf', 0.0853, 135.28)],
|
( 10.25, 0.0067, 0.02),
|
||||||
'semi-monthly': [(55.54, 0.0033, 0.00), (111.08, 0.0067, 0.18), (222.13, 0.0225, 0.55), (499.79, 0.0414, 3.05), (833.00, 0.0563, 14.59), (1110.67, 0.0596, 33.31), (1666.00, 0.0625, 49.86), (2499.00, 0.0744, 84.57), ('inf', 0.0853, 146.55)],
|
( 20.50, 0.0225, 0.05),
|
||||||
'monthly': [(111.08, 0.0033, 0.00), (222.17, 0.0067, 0.37), (444.25, 0.0225, 1.11), (999.58, 0.0414, 6.11), (1666.00, 0.0563, 29.10), (2221.33, 0.0596, 62.66), (3332.00, 0.0625, 99.72), (4998.00, 0.0744, 169.14), ('inf', 0.0853, 293.09)],
|
( 46.13, 0.0414, 0.28),
|
||||||
'annual': [(1333.00, 0.0033, 0.00), (2666.00, 0.0067, 4.40), (5331.00, 0.0225, 13.33), (11995.00, 0.0414, 73.29), (19992.00, 0.0563, 349.19), (26656.00, 0.0596, 799.41), (39984.00, 0.0625, 1196.58), (59976.00, 0.0744, 2029.58), ('inf', 0.0853, 3516.98)],
|
( 76.89, 0.0563, 1.34),
|
||||||
|
(102.52, 0.0596, 3.07),
|
||||||
|
(153.78, 0.0625, 4.60),
|
||||||
|
(230.68, 0.0744, 7.80),
|
||||||
|
( 'inf', 0.0853, 13.52),
|
||||||
|
),
|
||||||
|
'weekly': (
|
||||||
|
( 25.63, 0.0033, 0.00),
|
||||||
|
( 51.27, 0.0067, 0.08),
|
||||||
|
( 102.52, 0.0225, 0.25),
|
||||||
|
( 230.67, 0.0414, 1.40),
|
||||||
|
( 384.46, 0.0563, 6.71),
|
||||||
|
( 512.62, 0.0596, 15.37),
|
||||||
|
( 768.92, 0.0625, 23.01),
|
||||||
|
(1153.38, 0.0744, 39.03),
|
||||||
|
( 'inf', 0.0853, 67.63),
|
||||||
|
),
|
||||||
|
'bi-weekly': (
|
||||||
|
( 51.27, 0.0033, 0.00),
|
||||||
|
( 102.54, 0.0067, 0.17),
|
||||||
|
( 205.04, 0.0225, 0.51),
|
||||||
|
( 461.35, 0.0414, 2.82),
|
||||||
|
( 768.92, 0.0563, 13.43),
|
||||||
|
(1025.23, 0.0596, 30.75),
|
||||||
|
(1537.85, 0.0625, 46.03),
|
||||||
|
(2306.77, 0.0744, 78.07),
|
||||||
|
( 'inf', 0.0853, 135.28),
|
||||||
|
),
|
||||||
|
'semi-monthly': (
|
||||||
|
( 55.54, 0.0033, 0.00),
|
||||||
|
( 111.08, 0.0067, 0.18),
|
||||||
|
( 222.13, 0.0225, 0.55),
|
||||||
|
( 499.79, 0.0414, 3.05),
|
||||||
|
( 833.00, 0.0563, 14.59),
|
||||||
|
(1110.67, 0.0596, 33.31),
|
||||||
|
(1666.00, 0.0625, 49.86),
|
||||||
|
(2499.00, 0.0744, 84.57),
|
||||||
|
( 'inf', 0.0853, 146.55),
|
||||||
|
),
|
||||||
|
'monthly': (
|
||||||
|
( 111.08, 0.0033, 0.00),
|
||||||
|
( 222.17, 0.0067, 0.37),
|
||||||
|
( 444.25, 0.0225, 1.11),
|
||||||
|
( 999.58, 0.0414, 6.11),
|
||||||
|
(1666.00, 0.0563, 29.10),
|
||||||
|
(2221.33, 0.0596, 62.66),
|
||||||
|
(3332.00, 0.0625, 99.72),
|
||||||
|
(4998.00, 0.0744, 169.14),
|
||||||
|
( 'inf', 0.0853, 293.09),
|
||||||
|
),
|
||||||
|
'annual': (
|
||||||
|
( 1333.00, 0.0033, 0.00),
|
||||||
|
( 2666.00, 0.0067, 4.40),
|
||||||
|
( 5331.00, 0.0225, 13.33),
|
||||||
|
(11995.00, 0.0414, 73.29),
|
||||||
|
(19992.00, 0.0563, 349.19),
|
||||||
|
(26656.00, 0.0596, 799.41),
|
||||||
|
(39984.00, 0.0625, 1196.58),
|
||||||
|
(59976.00, 0.0744, 2029.58),
|
||||||
|
( 'inf', 0.0853, 3516.98),
|
||||||
|
),
|
||||||
}</field>
|
}</field>
|
||||||
<field name="rule_parameter_id" ref="rule_parameter_us_ia_sit_tax_rate"/>
|
<field name="rule_parameter_id" ref="rule_parameter_us_ia_sit_tax_rate"/>
|
||||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||||
</record>
|
</record>
|
||||||
|
<!-- https://tax.iowa.gov/sites/default/files/idr/documents/WH/IA%20Withholding%20Formula%20and%20Instructions%20TY2020.pdf -->
|
||||||
|
<!-- Table from page 2.-->
|
||||||
<record id="rule_parameter_us_ia_sit_tax_rate_2020" model="hr.rule.parameter.value">
|
<record id="rule_parameter_us_ia_sit_tax_rate_2020" model="hr.rule.parameter.value">
|
||||||
<field name="parameter_value">{
|
<field name="parameter_value">{
|
||||||
'daily': [(5.69, 0.0033, 0.0), (11.38, 0.0067, 0.02), (22.76, 0.0225, 0.06), (51.22, 0.0414, 0.32), (85.36, 0.0563, 1.50), (113.81, 0.0596, 3.42), (170.71, 0.0625, 5.12), (256.07, 0.0744, 8.68), ('inf', 0.0853, 15.03)],
|
'daily': (
|
||||||
'weekly': [(28.46, 0.0033, 0.0), (56.90, 0.0067, 0.09), (113.81, 0.0225, 0.028), (256.08, 0.0414, 1.56), (426.79, 0.0563, 7.45), (569.04, 0.0596, 17.06), (853.56, 0.0625, 25.54), (1280.35, 0.0744, 43.32), ('inf', 0.0853, 75.07)],
|
( 5.69, 0.0033, 0.00),
|
||||||
'bi-weekly': [(56.92, 0.0033, 0.00), (113.81, 0.0067, 0.19), (227.62, 0.00225, 0.57), (512.15, 0.0414, 3.13), (853.58, 0.0563, 14.91), (1138.08, 0.0596, 34.13), (1707.12, 0.0625, 51.09), (2560.69, 0.0744, 86.66), ('inf', 0.0853, 150.17)],
|
( 11.38, 0.0067, 0.02),
|
||||||
'semi-monthly': [(61.67, 0.0033, 0.00), (123.29, 0.0067, 0.20), (246.58, 0.0225, 0.61), (554.83, 0.0414, 3.38), (924.71, 0.0563, 16.14), (1232.92, 0.0596, 36.96), (1849.38, 0.0625, 55.33), (2774.08, 0.0744, 93.86), ('inf', 0.0853, 162.66)],
|
( 22.76, 0.0225, 0.06),
|
||||||
'monthly': [(123.33, 0.0033, 0.00), (246.58, 0.0067, 0.41), (493.17, 0.0225, 1.24), (1109.67, 0.0414, 6.79), (1849.42, 0.0563, 32.31), (2465.83, 0.0596, 73.96), (3698.75, 0.0625, 110.70), (5548.17, 0.0744, 187.76), ('inf', 0.0853, 325.36)],
|
( 51.22, 0.0414, 0.32),
|
||||||
'annual': [(1480.00, 0.0033, 0.00), (2959.00, 0.0067, 4.88), (5918.00, 0.0225, 14.79), (13316.00, 0.0414, 81.37), (22193.00, 0.0563, 387.65), (29590.00, 0.0596, 887.43), (44385.00, 0.0625, 1328.29), (66578.00, 0.0744, 2252.98), ('inf', 0.0853, 3904.14)],
|
( 85.36, 0.0563, 1.50),
|
||||||
|
(113.81, 0.0596, 3.42),
|
||||||
|
(170.71, 0.0625, 5.12),
|
||||||
|
(256.07, 0.0744, 8.68),
|
||||||
|
( 'inf', 0.0853, 15.03),
|
||||||
|
),
|
||||||
|
'weekly': (
|
||||||
|
( 28.46, 0.0033, 0.00),
|
||||||
|
( 56.90, 0.0067, 0.09),
|
||||||
|
( 113.81, 0.0225, 0.28),
|
||||||
|
( 256.08, 0.0414, 1.56),
|
||||||
|
( 426.79, 0.0563, 7.45),
|
||||||
|
( 569.04, 0.0596, 17.06),
|
||||||
|
( 853.56, 0.0625, 25.54),
|
||||||
|
(1280.35, 0.0744, 43.32),
|
||||||
|
( 'inf', 0.0853, 75.07),
|
||||||
|
),
|
||||||
|
'bi-weekly': (
|
||||||
|
( 56.92, 0.0033, 0.00),
|
||||||
|
( 113.81, 0.0067, 0.19),
|
||||||
|
( 227.62, 0.0225, 0.57),
|
||||||
|
( 512.15, 0.0414, 3.13),
|
||||||
|
( 853.58, 0.0563, 14.91),
|
||||||
|
(1138.08, 0.0596, 34.13),
|
||||||
|
(1707.12, 0.0625, 51.09),
|
||||||
|
(2560.69, 0.0744, 86.66),
|
||||||
|
( 'inf', 0.0853, 150.17),
|
||||||
|
),
|
||||||
|
'semi-monthly': (
|
||||||
|
( 61.67, 0.0033, 0.00),
|
||||||
|
( 23.29, 0.0067, 0.20),
|
||||||
|
( 246.58, 0.0225, 0.61),
|
||||||
|
( 554.83, 0.0414, 3.38),
|
||||||
|
( 924.71, 0.0563, 16.14),
|
||||||
|
(1232.92, 0.0596, 36.96),
|
||||||
|
(1849.38, 0.0625, 55.33),
|
||||||
|
(2774.08, 0.0744, 93.86),
|
||||||
|
( 'inf', 0.0853, 162.66),
|
||||||
|
),
|
||||||
|
'monthly': (
|
||||||
|
( 123.33, 0.0033, 0.00),
|
||||||
|
( 246.58, 0.0067, 0.41),
|
||||||
|
( 493.17, 0.0225, 1.24),
|
||||||
|
(1109.67, 0.0414, 6.79),
|
||||||
|
(1849.42, 0.0563, 32.31),
|
||||||
|
(2465.83, 0.0596, 73.96),
|
||||||
|
(3698.75, 0.0625, 110.70),
|
||||||
|
(5548.17, 0.0744, 187.76),
|
||||||
|
( 'inf', 0.0853, 325.36),
|
||||||
|
),
|
||||||
|
'annual': (
|
||||||
|
( 1480.00, 0.0033, 0.00),
|
||||||
|
( 2959.00, 0.0067, 4.88),
|
||||||
|
( 5918.00, 0.0225, 14.79),
|
||||||
|
(13316.00, 0.0414, 81.37),
|
||||||
|
(22193.00, 0.0563, 387.65),
|
||||||
|
(29590.00, 0.0596, 887.43),
|
||||||
|
(44385.00, 0.0625, 1328.29),
|
||||||
|
(66578.00, 0.0744, 2252.98),
|
||||||
|
( 'inf', 0.0853, 3904.14),
|
||||||
|
),
|
||||||
}</field>
|
}</field>
|
||||||
<field name="rule_parameter_id" ref="rule_parameter_us_ia_sit_tax_rate"/>
|
<field name="rule_parameter_id" ref="rule_parameter_us_ia_sit_tax_rate"/>
|
||||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||||
@@ -88,6 +210,8 @@
|
|||||||
<field name="rule_parameter_id" ref="rule_parameter_us_ia_sit_standard_deduction_rate"/>
|
<field name="rule_parameter_id" ref="rule_parameter_us_ia_sit_standard_deduction_rate"/>
|
||||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||||
</record>
|
</record>
|
||||||
|
<!-- https://tax.iowa.gov/sites/default/files/idr/documents/WH/IA%20Withholding%20Formula%20and%20Instructions%20TY2020.pdf-->
|
||||||
|
<!-- Step 2 -->
|
||||||
<record id="rule_parameter_us_ia_sit_standard_deduction_rate_2020" model="hr.rule.parameter.value">
|
<record id="rule_parameter_us_ia_sit_standard_deduction_rate_2020" model="hr.rule.parameter.value">
|
||||||
<field name="parameter_value">{
|
<field name="parameter_value">{
|
||||||
'daily': ( 7.23, 17.81),
|
'daily': ( 7.23, 17.81),
|
||||||
@@ -120,6 +244,8 @@
|
|||||||
<field name="rule_parameter_id" ref="rule_parameter_us_ia_sit_deduction_allowance_rate"/>
|
<field name="rule_parameter_id" ref="rule_parameter_us_ia_sit_deduction_allowance_rate"/>
|
||||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||||
</record>
|
</record>
|
||||||
|
<!-- https://tax.iowa.gov/sites/default/files/idr/documents/WH/IA%20Withholding%20Formula%20and%20Instructions%20TY2020.pdf -->
|
||||||
|
<!-- Step 4 -->
|
||||||
<record id="rule_parameter_us_ia_sit_deduction_allowance_rate_2020" model="hr.rule.parameter.value">
|
<record id="rule_parameter_us_ia_sit_deduction_allowance_rate_2020" model="hr.rule.parameter.value">
|
||||||
<field name="parameter_value">{
|
<field name="parameter_value">{
|
||||||
'daily': 0.15,
|
'daily': 0.15,
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ def ia_iowa_state_income_withholding(payslip, categories, worked_days, inputs):
|
|||||||
if not _state_applies(payslip, state_code):
|
if not _state_applies(payslip, state_code):
|
||||||
return 0.0, 0.0
|
return 0.0, 0.0
|
||||||
|
|
||||||
|
if payslip.contract_id.us_payroll_config_value('state_income_tax_exempt'):
|
||||||
|
return 0.0, 0.0
|
||||||
|
|
||||||
# Determine Wage
|
# Determine Wage
|
||||||
wage = sit_wage(payslip, categories)
|
wage = sit_wage(payslip, categories)
|
||||||
if not wage:
|
if not wage:
|
||||||
@@ -27,7 +30,8 @@ def ia_iowa_state_income_withholding(payslip, categories, worked_days, inputs):
|
|||||||
deduction_per_allowance = payslip.rule_parameter('us_ia_sit_deduction_allowance_rate')[schedule_pay]
|
deduction_per_allowance = payslip.rule_parameter('us_ia_sit_deduction_allowance_rate')[schedule_pay]
|
||||||
|
|
||||||
t1 = wage + fed_withholding
|
t1 = wage + fed_withholding
|
||||||
t2 = t1 - standard_deduction[0] if allowances < 2 else standard_deduction[1]
|
standard_deduction_amt = standard_deduction[0] if allowances < 2 else standard_deduction[1]
|
||||||
|
t2 = t1 - standard_deduction_amt
|
||||||
t3 = 0.0
|
t3 = 0.0
|
||||||
last = 0.0
|
last = 0.0
|
||||||
for row in tax_table:
|
for row in tax_table:
|
||||||
|
|||||||
@@ -11,11 +11,12 @@ class TestUsIAPayslip(TestUsPayslip):
|
|||||||
IA_UNEMP_MAX_WAGE = 31600.00
|
IA_UNEMP_MAX_WAGE = 31600.00
|
||||||
IA_UNEMP = 1.0
|
IA_UNEMP = 1.0
|
||||||
|
|
||||||
def _test_sit(self, wage, additional_withholding, allowances, schedule_pay, date_start, expected_withholding):
|
def _test_sit(self, wage, exempt, additional_withholding, allowances, schedule_pay, date_start, expected_withholding):
|
||||||
employee = self._createEmployee()
|
employee = self._createEmployee()
|
||||||
contract = self._createContract(employee,
|
contract = self._createContract(employee,
|
||||||
wage=wage,
|
wage=wage,
|
||||||
state_id=self.get_us_state('IA'),
|
state_id=self.get_us_state('IA'),
|
||||||
|
state_income_tax_exempt=exempt,
|
||||||
state_income_tax_additional_withholding=additional_withholding,
|
state_income_tax_additional_withholding=additional_withholding,
|
||||||
ia_w4_sit_allowances=allowances,
|
ia_w4_sit_allowances=allowances,
|
||||||
schedule_pay=schedule_pay)
|
schedule_pay=schedule_pay)
|
||||||
@@ -24,10 +25,12 @@ class TestUsIAPayslip(TestUsPayslip):
|
|||||||
cats = self._getCategories(payslip)
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
self._log('Computed period tax: ' + str(expected_withholding))
|
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):
|
def test_2020_taxes_example(self):
|
||||||
self._test_er_suta('IA', self.IA_UNEMP, date(2020, 1, 1), wage_base=self.IA_UNEMP_MAX_WAGE)
|
self._test_er_suta('IA', self.IA_UNEMP, date(2020, 1, 1), wage_base=self.IA_UNEMP_MAX_WAGE)
|
||||||
self._test_sit(3000.0, 0.0, 1.0, 'bi-weekly', date(2020, 1, 1), 146.68)
|
self._test_sit(2100.0, False, 0.0, 3.0, 'bi-weekly', date(2020, 1, 1), 83.5)
|
||||||
self._test_sit(3000.0, 10.0, 1.0, 'bi-weekly', date(2020, 1, 1), 156.68)
|
self._test_sit(3000.0, True, 10.0, 1.0, 'bi-weekly', date(2020, 1, 1), 0.00)
|
||||||
self._test_sit(30000.0, 0.0, 1.0, 'weekly', date(2020, 1, 1), 1640.04)
|
self._test_sit(300.0, False, 0.0, 1.0, 'weekly', date(2020, 1, 1), 6.77)
|
||||||
|
self._test_sit(5000.0, False, 0.0, 1.0, 'monthly', date(2020, 1, 1), 230.76)
|
||||||
|
self._test_sit(7500.0, False, 10.0, 2.0, 'semi-monthly', date(2020, 1, 1), 432.84)
|
||||||
|
|||||||
Reference in New Issue
Block a user