diff --git a/l10n_us_ia_hr_payroll/__manifest__.py b/l10n_us_ia_hr_payroll/__manifest__.py
index 28dc125d..7cc7b1d0 100755
--- a/l10n_us_ia_hr_payroll/__manifest__.py
+++ b/l10n_us_ia_hr_payroll/__manifest__.py
@@ -4,13 +4,13 @@
'license': 'AGPL-3',
'category': 'Localization',
'depends': ['l10n_us_hr_payroll'],
- 'version': '11.0.2019.0.0',
+ 'version': '12.0.2019.0.0',
'description': """
-USA::Iowa Payroll Rules.
+USA - Iowa Payroll Rules.
==================================
-* Contribution register and partner for Additional WithholdingTaxaction - Income Tax Withholding
-* Contribution register and partner for Iowa Workforce Development- Unemployment
+* Contribution register and partner for Iowa Workforce Development (IWD) - Unemployment
+* Contribution register and partner for Iowa Department of Revenue (IDOR) - Income Tax Withholding
* Contract level Iowa Exemptions
* Company level Iowa Unemployment Rate
* Salary Structure for Iowa
diff --git a/l10n_us_ia_hr_payroll/data/rules.xml b/l10n_us_ia_hr_payroll/data/rules.xml
index 2281d900..62ec8a59 100755
--- a/l10n_us_ia_hr_payroll/data/rules.xml
+++ b/l10n_us_ia_hr_payroll/data/rules.xml
@@ -12,7 +12,7 @@
code
rate = payslip.dict.get_rate('US_IA_UNEMP')
-year = int(payslip.dict.date_to[:4])
+year = payslip.dict.date_to.year
ytd = payslip.sum('WAGE_US_IA_UNEMP', str(year) + '-01-01', str(year+1) + '-01-01')
ytd += contract.external_wages
remaining = rate.wage_limit_year - ytd
diff --git a/l10n_us_ia_hr_payroll/models/hr_payroll.py b/l10n_us_ia_hr_payroll/models/hr_payroll.py
index c171154a..7eac3055 100755
--- a/l10n_us_ia_hr_payroll/models/hr_payroll.py
+++ b/l10n_us_ia_hr_payroll/models/hr_payroll.py
@@ -4,6 +4,6 @@ from odoo import models, fields, api
class USIAHrContract(models.Model):
_inherit = 'hr.contract'
- ia_w4_allowances = fields.Integer(string='Iowa W-4 allowances', default=0)
- ia_w4_additional_wh = fields.Float(string="Iowa Additional Withholding", default=0.0)
- ia_w4_tax_exempt = fields.Boolean(string="Tax Exempt")
+ ia_w4_allowances = fields.Integer(string='Iowa W-4 allowances')
+ ia_w4_additional_wh = fields.Float(string="Iowa W-4 Additional Withholding")
+ ia_w4_tax_exempt = fields.Boolean(string="Iowa W-4 Tax Exempt")
diff --git a/l10n_us_ia_hr_payroll/tests/test_us_ia_payslip.py b/l10n_us_ia_hr_payroll/tests/test_us_ia_payslip.py
index 53d1fd44..bde22b29 100755
--- a/l10n_us_ia_hr_payroll/tests/test_us_ia_payslip.py
+++ b/l10n_us_ia_hr_payroll/tests/test_us_ia_payslip.py
@@ -1,5 +1,4 @@
from odoo.addons.l10n_us_hr_payroll.tests.test_us_payslip import TestUsPayslip, process_payslip
-from odoo.addons.l10n_us_hr_payroll.models.l10n_us_hr_payroll import USHrContract
class TestUsIAPayslip(TestUsPayslip):
@@ -11,13 +10,11 @@ class TestUsIAPayslip(TestUsPayslip):
wages = 30000.00
schedule_pay = 'weekly'
allowances = 1
- additional_wh = 0.00
employee = self._createEmployee()
contract = self._createContract(employee, wages,
struct_id=self.ref('l10n_us_ia_hr_payroll.hr_payroll_salary_structure_us_ia_employee'),
schedule_pay=schedule_pay)
contract.ia_w4_allowances = allowances
- contract.ia_w4_additional_wh = additional_wh
self.assertEqual(contract.schedule_pay, 'weekly')
@@ -30,30 +27,24 @@ class TestUsIAPayslip(TestUsPayslip):
# withholding amount because it is calculated in the base US payroll module as a negative
# t1 = 30000 - (10399.66) = 19600.34
t1_to_test = wages + cats['EE_US_FED_INC_WITHHOLD']
- self.assertPayrollEqual(t1_to_test, 19600.34)
-
# T2 is T1 minus our standard deduction which is a table of flat rates dependent on the number of allowances.
# In our case, we have a weekly period which on the table has a std deduct. of $32.50 for 0 or 1 allowances,
# and 80.00 of 2 or more allowances.
standard_deduction = 32.50 # The allowance tells us what standard_deduction amount to use.
# t2 = 19600.34 - 32.50 = 19567.84
t2_to_test = t1_to_test - standard_deduction
- self.assertPayrollEqual(t2_to_test, 19567.84)
# T3 is T2 multiplied by the income rates in the large table plus a flat fee for that bracket.
# 1153.38 is the bracket floor. 8.53 is the rate, and 67.63 is the flat fee.
# t3 = 1638.38
t3_to_test = ((t2_to_test - 1153.38) * (8.53 / 100)) + 67.63
- self.assertPayrollEqual(t3_to_test, 1638.38)
# T4 is T3 minus a flat amount determined by pay period * the number of deductions. For 2019, our weekly
# deduction amount per allowance is 0.77
# t4 = 1638.38 - 0.77 = 155.03
t4_to_test = t3_to_test - (0.77 * allowances)
- self.assertPayrollEqual(t4_to_test, 1637.61)
# t5 is our T4 plus the additional withholding per period
# t5 = 1637.61 + 0.0
# Convert to negative as well.
- t5_to_test = -t4_to_test - additional_wh
- self.assertPayrollEqual(t5_to_test, -1637.61)
+ t5_to_test = -t4_to_test
self.assertPayrollEqual(cats['WAGE_US_IA_UNEMP'], wages)
self.assertPayrollEqual(cats['ER_US_IA_UNEMP'], cats['WAGE_US_IA_UNEMP'] * self.IA_UNEMP)
@@ -70,7 +61,7 @@ class TestUsIAPayslip(TestUsPayslip):
# Make a new payslip, this one will have maximums
- remaining_IA_UNEMP_wages = self.IA_UNEMP_MAX_WAGE - wages if (self.IA_UNEMP_MAX_WAGE - 2*wages < wages) \
+ remaining_ia_unemp_wages = self.IA_UNEMP_MAX_WAGE - wages if (self.IA_UNEMP_MAX_WAGE - 2*wages < wages) \
else wages
self._log('2019 Iowa tax second payslip weekly:')
@@ -78,21 +69,19 @@ class TestUsIAPayslip(TestUsPayslip):
payslip.compute_sheet()
cats = self._getCategories(payslip)
- self.assertPayrollEqual(cats['WAGE_US_IA_UNEMP'], remaining_IA_UNEMP_wages)
- self.assertPayrollEqual(cats['ER_US_IA_UNEMP'], remaining_IA_UNEMP_wages * self.IA_UNEMP)
+ self.assertPayrollEqual(cats['WAGE_US_IA_UNEMP'], remaining_ia_unemp_wages)
+ self.assertPayrollEqual(cats['ER_US_IA_UNEMP'], remaining_ia_unemp_wages * self.IA_UNEMP)
def test_taxes_biweekly(self):
wages = 3000.00
schedule_pay = 'bi-weekly'
allowances = 1
- additional_wh = 0.00
employee = self._createEmployee()
contract = self._createContract(employee, wages,
struct_id=self.ref(
'l10n_us_ia_hr_payroll.hr_payroll_salary_structure_us_ia_employee'),
schedule_pay=schedule_pay)
contract.ia_w4_allowances = allowances
- contract.ia_w4_additional_wh = additional_wh
self.assertEqual(contract.schedule_pay, 'bi-weekly')
@@ -115,11 +104,11 @@ class TestUsIAPayslip(TestUsPayslip):
# deduction amount per allowance is 0.77
t4_to_test = t3_to_test - (1.54 * allowances)
# t5 is our T4 plus the additional withholding per period
- t5_to_test = -t4_to_test - additional_wh
+ t5_to_test = -t4_to_test
self.assertPayrollEqual(cats['WAGE_US_IA_UNEMP'], wages)
self.assertPayrollEqual(cats['ER_US_IA_UNEMP'], cats['WAGE_US_IA_UNEMP'] * self.IA_UNEMP)
- self.assertPayrollEqual(cats['EE_US_IA_INC_WITHHOLD'], t5_to_test - additional_wh)
+ self.assertPayrollEqual(cats['EE_US_IA_INC_WITHHOLD'], t5_to_test)
process_payslip(payslip)
@@ -175,7 +164,6 @@ class TestUsIAPayslip(TestUsPayslip):
salary,
external_wages=external_wages,
struct_id=self.ref('l10n_us_ia_hr_payroll.hr_payroll_salary_structure_us_ia_employee'),
- futa_type=USHrContract.FUTA_TYPE_BASIC,
schedule_pay=schedule_pay)
contract.ia_w4_tax_exempt = True
@@ -184,8 +172,10 @@ class TestUsIAPayslip(TestUsPayslip):
payslip.compute_sheet()
cats = self._getCategories(payslip)
- self.assertPayrollEqual(cats.get('WAGE_US_IA_UNEMP', 0.0), 0.0)
- self.assertPayrollEqual(cats.get('ER_US_IA_UNEMP', 0.0), cats.get('WAGE_US_IA_UNEMP', 0.0) * self.IA_UNEMP)
+ self.assertPayrollEqual(cats['WAGE_US_IA_UNEMP'], salary)
+ self.assertPayrollEqual(cats['ER_US_IA_UNEMP'], cats['WAGE_US_IA_UNEMP'] * self.IA_UNEMP)
+ self.assertPayrollEqual(cats.get('EE_US_IA_INC_WITHHOLD', 0.00), 0.00)
+