From 6d2d6f4f469f4542b3466b94d85fae9adcc8a327 Mon Sep 17 00:00:00 2001 From: David Frick Date: Wed, 14 Aug 2019 16:19:53 -0400 Subject: [PATCH] MIG `l10n_us_ar_hr_payroll` for 12.0. Changed variables names to match Arkansas Tax Form. Added abbreviations for partners in manifest. --- l10n_us_ar_hr_payroll/__manifest__.py | 8 +-- l10n_us_ar_hr_payroll/data/base.xml | 6 +-- l10n_us_ar_hr_payroll/data/rules.xml | 8 +-- l10n_us_ar_hr_payroll/models/hr_payroll.py | 8 +-- .../tests/test_us_ar_payslip_2019.py | 53 +++++++++---------- .../views/hr_payroll_views.xml | 8 +-- 6 files changed, 45 insertions(+), 46 deletions(-) diff --git a/l10n_us_ar_hr_payroll/__manifest__.py b/l10n_us_ar_hr_payroll/__manifest__.py index 1bb42dad..45f86c6b 100755 --- a/l10n_us_ar_hr_payroll/__manifest__.py +++ b/l10n_us_ar_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::Arkansas Payroll Rules. +USA - Arkansas Payroll Rules. ================================== -* Contribution register and partner for Arkansas Department of Financial Administration - Income Tax Withholding -* Contribution register and partner for Arkansas Department of Workforce Solutions - Unemployment +* Contribution register and partner for Arkansas Department of Financial Administration (ADFA) - Income Tax Withholding +* Contribution register and partner for Arkansas Department of Workforce Solutions (ADWS) - Unemployment * Contract level Arkansas Exemptions * Company level Arkansas Unemployment Rate * Salary Structure for Arkansas diff --git a/l10n_us_ar_hr_payroll/data/base.xml b/l10n_us_ar_hr_payroll/data/base.xml index 2e004924..ce1b73cc 100755 --- a/l10n_us_ar_hr_payroll/data/base.xml +++ b/l10n_us_ar_hr_payroll/data/base.xml @@ -3,12 +3,12 @@ - Arkansas Department of Workforce Solutions - Unemployment Tax + Arkansas Department of Workforce Solutions - Unemployment Tax 1 - Arkansas Department of Financial Administration- Income Tax Withholding + Arkansas Department of Financial Administration - Income Tax Withholding 1 @@ -16,7 +16,7 @@ Arkansas Unemployment - Arkansas Department of Workforce Solutions - Unemployment + Arkansas Department of Workforce Solutions - Unemployment diff --git a/l10n_us_ar_hr_payroll/data/rules.xml b/l10n_us_ar_hr_payroll/data/rules.xml index 00fed6f5..71b77a79 100755 --- a/l10n_us_ar_hr_payroll/data/rules.xml +++ b/l10n_us_ar_hr_payroll/data/rules.xml @@ -11,7 +11,7 @@ code rate = payslip.dict.get_rate('US_AR_UNEMP') -year = int(payslip.dict.date_to[:4]) +year = payslip.dict.date_to.year ytd = payslip.sum('WAGE_US_AR_UNEMP', str(year) + '-01-01', str(year+1) + '-01-01') ytd += contract.external_wages remaining = rate.wage_limit_year - ytd @@ -52,15 +52,15 @@ if result_rate == 0.0: EE: US-AR Income Tax Withholding EE_US_AR_INC_WITHHOLD python - result = not (contract.ar_w4_texarkana_exemption or contract.ar_w4_tax_exempt) + result = not (contract.ar_ar4ec_texarkana_exemption or contract.ar_ar4ec_tax_exempt) code wages = categories.GROSS annual_gross_pay = 0.00 -allowance_amt = contract.ar_w4_allowances * 26.00 +allowance_amt = contract.ar_ar4ec_allowances * 26.00 schedule_pay = contract.schedule_pay standard_deduction = 2200 -additional_withholding = contract.ar_w4_additional_wh +additional_withholding = contract.ar_ar4ec_additional_wh if contract.w4_filing_status == 'married': standard_deduction = standard_deduction * 2 diff --git a/l10n_us_ar_hr_payroll/models/hr_payroll.py b/l10n_us_ar_hr_payroll/models/hr_payroll.py index b6b51866..e477e67e 100755 --- a/l10n_us_ar_hr_payroll/models/hr_payroll.py +++ b/l10n_us_ar_hr_payroll/models/hr_payroll.py @@ -4,7 +4,7 @@ from odoo import models, fields, api class USARHrContract(models.Model): _inherit = 'hr.contract' - ar_w4_allowances = fields.Integer(string='Arkansas W-4 allowances', default=0) - ar_w4_additional_wh = fields.Float(string="Arkansas Additional Withholding", default=0.0) - ar_w4_tax_exempt = fields.Boolean(string="Tax Exempt") - ar_w4_texarkana_exemption = fields.Boolean(string="Texarkana Exemption") + ar_ar4ec_allowances = fields.Integer(string='Arkansas AR-4EC Allowances', default=0) + ar_ar4ec_additional_wh = fields.Float(string="Arkansas AR-4EC Additional Withholding", default=0.0) + ar_ar4ec_tax_exempt = fields.Boolean(string="Arkansas AR-4EC Tax Exempt") + ar_ar4ec_texarkana_exemption = fields.Boolean(string="Arkansas AR-4EC Texarkana Exemption") diff --git a/l10n_us_ar_hr_payroll/tests/test_us_ar_payslip_2019.py b/l10n_us_ar_hr_payroll/tests/test_us_ar_payslip_2019.py index 44a4a058..3f72292f 100755 --- a/l10n_us_ar_hr_payroll/tests/test_us_ar_payslip_2019.py +++ b/l10n_us_ar_hr_payroll/tests/test_us_ar_payslip_2019.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 TestUsARPayslip(TestUsPayslip): @@ -31,17 +30,17 @@ class TestUsARPayslip(TestUsPayslip): process_payslip(payslip) # Make a new payslip, this one will have maximums - remaining_AR_UNEMP_wages = self.AR_UNEMP_MAX_WAGE - salary if (self.AR_UNEMP_MAX_WAGE - 2*salary < salary) \ + remaining_ar_unemp_wages = self.AR_UNEMP_MAX_WAGE - salary if (self.AR_UNEMP_MAX_WAGE - 2*salary < salary) \ else salary # We reached the cap of 10000.0 in the first payslip. - self.assertEqual(0.0, remaining_AR_UNEMP_wages) + self.assertEqual(0.0, remaining_ar_unemp_wages) self._log('2019 Arkansas tax second payslip weekly:') payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28') payslip.compute_sheet() cats = self._getCategories(payslip) - self.assertPayrollEqual(cats['WAGE_US_AR_UNEMP'], remaining_AR_UNEMP_wages) - self.assertPayrollEqual(cats['ER_US_AR_UNEMP'], remaining_AR_UNEMP_wages * self.AR_UNEMP) + self.assertPayrollEqual(cats['WAGE_US_AR_UNEMP'], remaining_ar_unemp_wages) + self.assertPayrollEqual(cats['ER_US_AR_UNEMP'], remaining_ar_unemp_wages * self.AR_UNEMP) def test_taxes_with_state_exempt(self): salary = 50000.0 @@ -52,7 +51,7 @@ class TestUsARPayslip(TestUsPayslip): salary, struct_id=self.ref('l10n_us_ar_hr_payroll.hr_payroll_salary_structure_us_ar_employee'), ) - contract.ar_w4_tax_exempt = tax_exempt + contract.ar_ar4ec_tax_exempt = tax_exempt self._log('2019 Arkansas exempt tax first payslip weekly:') payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31') @@ -73,7 +72,7 @@ class TestUsARPayslip(TestUsPayslip): contract = self._createContract(employee, salary, struct_id=self.ref('l10n_us_ar_hr_payroll.hr_payroll_salary_structure_us_ar_employee')) - contract.ar_w4_texarkana_exemption = texarkana_exemption + contract.ar_ar4ec_texarkana_exemption = texarkana_exemption self._log('2019 Arkansas tax first payslip:') payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31') @@ -99,8 +98,8 @@ class TestUsARPayslip(TestUsPayslip): wages, struct_id=self.ref('l10n_us_ar_hr_payroll.hr_payroll_salary_structure_us_ar_employee'), schedule_pay=schedule_pay) - contract.ar_w4_additional_wh = 0.0 - contract.ar_w4_allowances = exemptions + contract.ar_ar4ec_additional_wh = 0.0 + contract.ar_ar4ec_allowances = exemptions self.assertEqual(contract.schedule_pay, 'monthly') @@ -114,7 +113,7 @@ class TestUsARPayslip(TestUsPayslip): # TODO: change to hand the test_ar_amt already be divided by pay periods self.assertPayrollEqual(cats['EE_US_AR_INC_WITHHOLD'], -(test_ar_amt / pay_periods)) - contract.ar_w4_additional_wh = additional_wh + contract.ar_ar4ec_additional_wh = additional_wh payslip.compute_sheet() cats = self._getCategories(payslip) @@ -137,8 +136,8 @@ class TestUsARPayslip(TestUsPayslip): struct_id=self.ref( 'l10n_us_ar_hr_payroll.hr_payroll_salary_structure_us_ar_employee'), schedule_pay=schedule_pay) - contract.ar_w4_additional_wh = 0.0 - contract.ar_w4_allowances = exemptions + contract.ar_ar4ec_additional_wh = 0.0 + contract.ar_ar4ec_allowances = exemptions self.assertEqual(contract.schedule_pay, 'monthly') @@ -151,7 +150,7 @@ class TestUsARPayslip(TestUsPayslip): self.assertPayrollEqual(cats['ER_US_AR_UNEMP'], cats['WAGE_US_AR_UNEMP'] * self.AR_UNEMP) self.assertPayrollEqual(cats['EE_US_AR_INC_WITHHOLD'], -(test_ar_amt / pay_periods)) - contract.ar_w4_additional_wh = additional_wh + contract.ar_ar4ec_additional_wh = additional_wh payslip.compute_sheet() cats = self._getCategories(payslip) self.assertPayrollEqual(cats['EE_US_AR_INC_WITHHOLD'], -(test_ar_amt / pay_periods) - additional_wh) @@ -160,7 +159,7 @@ class TestUsARPayslip(TestUsPayslip): # Make a new payslip, this one will have maximums - remaining_AR_UNEMP_wages = self.AR_UNEMP_MAX_WAGE - wages if (self.AR_UNEMP_MAX_WAGE - 2 * wages < wages) \ + remaining_ar_unemp_wages = self.AR_UNEMP_MAX_WAGE - wages if (self.AR_UNEMP_MAX_WAGE - 2 * wages < wages) \ else wages self._log('2019 Arkansas tax second payslip weekly:') @@ -168,8 +167,8 @@ class TestUsARPayslip(TestUsPayslip): payslip.compute_sheet() cats = self._getCategories(payslip) - self.assertPayrollEqual(cats['WAGE_US_AR_UNEMP'], remaining_AR_UNEMP_wages) - self.assertPayrollEqual(cats['ER_US_AR_UNEMP'], remaining_AR_UNEMP_wages * self.AR_UNEMP) + self.assertPayrollEqual(cats['WAGE_US_AR_UNEMP'], remaining_ar_unemp_wages) + self.assertPayrollEqual(cats['ER_US_AR_UNEMP'], remaining_ar_unemp_wages * self.AR_UNEMP) def test_over_fifty_thousand(self): wages = 10000.00 # 10000.00 monthly is over 50,000 annually. @@ -186,8 +185,8 @@ class TestUsARPayslip(TestUsPayslip): struct_id=self.ref( 'l10n_us_ar_hr_payroll.hr_payroll_salary_structure_us_ar_employee'), schedule_pay=schedule_pay) - contract.ar_w4_additional_wh = 0.0 - contract.ar_w4_allowances = exemptions + contract.ar_ar4ec_additional_wh = 0.0 + contract.ar_ar4ec_allowances = exemptions self.assertEqual(contract.schedule_pay, 'monthly') @@ -200,7 +199,7 @@ class TestUsARPayslip(TestUsPayslip): self.assertPayrollEqual(cats['ER_US_AR_UNEMP'], cats['WAGE_US_AR_UNEMP'] * self.AR_UNEMP) self.assertPayrollEqual(cats['EE_US_AR_INC_WITHHOLD'], -(test_ar_amt / pay_periods)) - contract.ar_w4_additional_wh = additional_wh + contract.ar_ar4ec_additional_wh = additional_wh payslip.compute_sheet() cats = self._getCategories(payslip) self.assertPayrollEqual(cats['EE_US_AR_INC_WITHHOLD'], -(test_ar_amt / pay_periods) - additional_wh) @@ -209,7 +208,7 @@ class TestUsARPayslip(TestUsPayslip): # Make a new payslip, this one will have maximums - remaining_AR_UNEMP_wages = self.AR_UNEMP_MAX_WAGE - wages if (self.AR_UNEMP_MAX_WAGE - 2 * wages < wages) \ + remaining_ar_unemp_wages = self.AR_UNEMP_MAX_WAGE - wages if (self.AR_UNEMP_MAX_WAGE - 2 * wages < wages) \ else wages self._log('2019 Arkansas tax second payslip weekly:') @@ -217,8 +216,8 @@ class TestUsARPayslip(TestUsPayslip): payslip.compute_sheet() cats = self._getCategories(payslip) - self.assertPayrollEqual(cats['WAGE_US_AR_UNEMP'], remaining_AR_UNEMP_wages) - self.assertPayrollEqual(cats['ER_US_AR_UNEMP'], remaining_AR_UNEMP_wages * self.AR_UNEMP) + self.assertPayrollEqual(cats['WAGE_US_AR_UNEMP'], remaining_ar_unemp_wages) + self.assertPayrollEqual(cats['ER_US_AR_UNEMP'], remaining_ar_unemp_wages * self.AR_UNEMP) def test_married(self): wages = 5500.00 @@ -237,8 +236,8 @@ class TestUsARPayslip(TestUsPayslip): struct_id=self.ref( 'l10n_us_ar_hr_payroll.hr_payroll_salary_structure_us_ar_employee'), schedule_pay=schedule_pay) - contract.ar_w4_additional_wh = additional_wh - contract.ar_w4_allowances = exemptions + contract.ar_ar4ec_additional_wh = additional_wh + contract.ar_ar4ec_allowances = exemptions contract.w4_filing_status = w4_filing_status self.assertEqual(contract.w4_filing_status, 'married') @@ -269,8 +268,8 @@ class TestUsARPayslip(TestUsPayslip): struct_id=self.ref( 'l10n_us_ar_hr_payroll.hr_payroll_salary_structure_us_ar_employee'), schedule_pay=schedule_pay) - contract.ar_w4_additional_wh = 0 - contract.ar_w4_allowances = exemptions + contract.ar_ar4ec_additional_wh = 0 + contract.ar_ar4ec_allowances = exemptions contract.w4_filling_status = w4_filling_status self.assertEqual(contract.w4_filling_status, 'single') @@ -284,7 +283,7 @@ class TestUsARPayslip(TestUsPayslip): self.assertPayrollEqual(cats['ER_US_AR_UNEMP'], cats['WAGE_US_AR_UNEMP'] * self.AR_UNEMP) self.assertPayrollEqual(cats['EE_US_AR_INC_WITHHOLD'], -(test_ar_amt / pay_periods)) - contract.ar_w4_additional_wh = additional_wh + contract.ar_ar4ec_additional_wh = additional_wh payslip.compute_sheet() cats = self._getCategories(payslip) self.assertPayrollEqual(cats['EE_US_AR_INC_WITHHOLD'], -(test_ar_amt / pay_periods) - additional_wh) diff --git a/l10n_us_ar_hr_payroll/views/hr_payroll_views.xml b/l10n_us_ar_hr_payroll/views/hr_payroll_views.xml index d1ed5d9c..e3fc69be 100755 --- a/l10n_us_ar_hr_payroll/views/hr_payroll_views.xml +++ b/l10n_us_ar_hr_payroll/views/hr_payroll_views.xml @@ -10,10 +10,10 @@ - - - - + + + +