diff --git a/l10n_us_hr_payroll/data/state/mo_missouri.xml b/l10n_us_hr_payroll/data/state/mo_missouri.xml index 230e24eb..73ea5109 100644 --- a/l10n_us_hr_payroll/data/state/mo_missouri.xml +++ b/l10n_us_hr_payroll/data/state/mo_missouri.xml @@ -44,6 +44,7 @@ + [ (1053.0, 1.5), @@ -59,6 +60,8 @@ + + [ (1073.0, 1.5), @@ -82,6 +85,7 @@ + { 'single': 12400.0, @@ -91,6 +95,8 @@ + + { 'single': 12400.0, diff --git a/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2020.py b/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2020.py index 164b0f0f..ff6a0ca1 100755 --- a/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2020.py +++ b/l10n_us_hr_payroll/tests/test_us_mo_missouri_payslip_2020.py @@ -1,5 +1,6 @@ +# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details. -from datetime import date +from datetime import date, timedelta from .common import TestUsPayslip @@ -8,98 +9,26 @@ class TestUsMoPayslip(TestUsPayslip): MO_UNEMP_MAX_WAGE = 11500.0 MO_UNEMP = 2.376 - TAX = [ - (1073.0, 1.5), - (1073.0, 2.0), - (1073.0, 2.5), - (1073.0, 3.0), - (1073.0, 3.5), - (1073.0, 4.0), - (1073.0, 4.5), - (1073.0, 5.0), - ( 'inf', 5.4), - ] - STD_DED = { - '': 0.0, # Exempt - 'single': 12400.0, - 'married': 24800.0, - 'head_of_household': 18650.0, - } - - def _test_sit(self, filing_status, schedule_pay): - wage = 5000.0 + def _test_sit(self, wage, filing_status, additional_withholding, schedule_pay, date_start, expected_withholding): employee = self._createEmployee() contract = self._createContract(employee, wage=wage, state_id=self.get_us_state('MO'), mo_mow4_sit_filing_status=filing_status, - state_income_tax_additional_withholding=0.0, + state_income_tax_additional_withholding=additional_withholding, schedule_pay=schedule_pay) - - payslip = self._createPayslip(employee, '2020-01-01', '2020-01-31') + payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7)) payslip.compute_sheet() cats = self._getCategories(payslip) - pp = payslip.get_pay_periods_in_year() - gross_salary = wage * pp - standard_deduction = self.STD_DED[filing_status] + self._log('Computed period tax: ' + str(expected_withholding)) + self.assertPayrollAlmostEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding) - mo_taxable_income = gross_salary - standard_deduction - self._log('%s = %s - %s -' % (mo_taxable_income, gross_salary, standard_deduction)) - - remaining_taxable_income = mo_taxable_income - tax = 0.0 - for amt, rate in self.TAX: - amt = float(amt) - rate = rate / 100.0 - self._log(str(amt) + ' : ' + str(rate) + ' : ' + str(remaining_taxable_income)) - if (remaining_taxable_income - amt) > 0.0 or (remaining_taxable_income - amt) == 0.0: - tax += rate * amt - else: - tax += rate * remaining_taxable_income - break - remaining_taxable_income = remaining_taxable_income - amt - - tax = -tax - self._log('Computed annual tax: ' + str(tax)) - - tax = tax / pp - tax = round(tax) - self._log('Computed period tax: ' + str(tax)) - self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), tax if filing_status else 0.0) - - contract.us_payroll_config_id.state_income_tax_additional_withholding = 100.0 - payslip.compute_sheet() - cats = self._getCategories(payslip) - self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), (tax - 100.0) if filing_status else 0.0) - - contract.us_payroll_config_id.mo_mow4_sit_withholding = 200.0 - payslip.compute_sheet() - cats = self._getCategories(payslip) - self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -200.0 if filing_status else 0.0) - - def test_2020_taxes_single(self): + def test_2020_taxes_example(self): self._test_er_suta('MO', self.MO_UNEMP, date(2020, 1, 1), wage_base=self.MO_UNEMP_MAX_WAGE) - self._test_sit('single', 'weekly') + self._test_sit(750.0, 'single', 0.0, 'weekly', date(2020, 1, 1), 24.00) + self._test_sit(2500.0, 'single', 5.0, 'bi-weekly', date(2020, 1, 1), 107.00) + self._test_sit(7000.0, 'married', 0.0, 'monthly', date(2020, 1, 1), 251.00) + self._test_sit(5000.0, 'married', 10.0, 'semi-monthly', date(2020, 1, 1), 217.00) + self._test_sit(6000.0, '', 0.0, 'monthly', date(2020, 1, 1), 0.00) - def test_2020_spouse_not_employed(self): - self._test_sit('married', 'semi-monthly') - - def test_2020_head_of_household(self): - self._test_sit('head_of_household', 'monthly') - - def test_2020_underflow(self): - # Payroll Period Weekly - salary = 200.0 - - employee = self._createEmployee() - - contract = self._createContract(employee, - wage=salary, - state_id=self.get_us_state('MO')) - - payslip = self._createPayslip(employee, '2020-01-01', '2020-01-31') - payslip.compute_sheet() - cats = self._getCategories(payslip) - - self.assertPayrollEqual(cats['EE_US_SIT'], 0.0)