Refactor to mitigate the fact that eligible 401(k) contributions reduce taxable wage (gross) but not FICA/FUTA etc.

This refactor bases all/most 'wage' categories off of BASIC instead of GROSS to allow all 'Income Tax' rules to continue to be based on GROSS.
This commit is contained in:
Jared Kipe
2018-12-09 11:51:01 -08:00
parent 98418340b9
commit 24a73663e5
15 changed files with 45 additions and 44 deletions

View File

@@ -19,10 +19,10 @@ ytd += contract.external_wages
remaining = 7000.0 - ytd
if remaining <= 0.0:
result = 0
elif remaining < categories.GROSS:
elif remaining < categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>
@@ -63,10 +63,10 @@ ytd += contract.external_wages
remaining = 7000.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>
@@ -107,10 +107,10 @@ ytd += contract.external_wages
remaining = 114967.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>

View File

@@ -18,10 +18,10 @@ ytd += contract.external_wages
remaining = 7000.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>

View File

@@ -19,10 +19,10 @@ ytd += contract.external_wages
remaining = 128400.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>
@@ -34,7 +34,7 @@ else:
<field name="condition_select">python</field>
<field name="condition_python">result = (payslip.date_to[:4] == '2018') and not contract.fica_exempt</field>
<field name="amount_select">code</field>
<field name="amount_python_compute">result = categories.GROSS</field>
<field name="amount_python_compute">result = categories.BASIC</field>
<field name="appears_on_payslip" eval="False"/>
</record>
<record id="hr_payroll_rules_fica_emp_m_add_wages_2018" model="hr.salary.rule">
@@ -577,10 +577,10 @@ ytd += contract.external_wages
remaining = 7000.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>

View File

@@ -18,10 +18,10 @@ ytd += contract.external_wages
remaining = 14000.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>

View File

@@ -18,10 +18,10 @@ ytd += contract.external_wages
remaining = 12500.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>

View File

@@ -45,7 +45,7 @@ class TestUsMoPayslip(TestUsPayslip):
# tax rates
mo_unemp = contract.mo_unemp_rate(2018) / -100.0
self._log('2018 Missouri tax first payslip:')
self._log('2018 Missouri tax single first payslip:')
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
payslip.compute_sheet()
@@ -62,11 +62,12 @@ class TestUsMoPayslip(TestUsPayslip):
# 5000 for single and married with spouse working, 10000 for married spouse not working
us_withholding = min(5000, us_withholding)
# 5000
self._log(us_withholding)
mo_taxable_income = gross_salary - standard_deduction - mo_allowance_calculated - us_withholding
# 48306.14
self._log(mo_taxable_income)
# 44000.0
self._log('%s = %s - %s - %s - %s' % (mo_taxable_income, gross_salary, standard_deduction, mo_allowance_calculated, us_withholding))
remaining_taxable_income = mo_taxable_income
tax = 0.0

View File

@@ -17,10 +17,10 @@ ytd += contract.external_wages
remaining = 7000.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>

View File

@@ -19,10 +19,10 @@ ytd += contract.external_wages
remaining = 33700.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>
@@ -82,10 +82,10 @@ ytd += contract.external_wages
remaining = 33700.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>
@@ -144,10 +144,10 @@ ytd += contract.external_wages
remaining = 33700.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>
@@ -183,10 +183,10 @@ ytd += contract.external_wages
remaining = 33700.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>

View File

@@ -19,10 +19,10 @@ ytd += contract.external_wages
remaining = 11100.00 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>

View File

@@ -18,10 +18,10 @@ ytd += contract.external_wages
remaining = 9500.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>

View File

@@ -18,10 +18,10 @@ ytd += contract.external_wages
remaining = 10000.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>

View File

@@ -14,7 +14,7 @@ class TestUsPAPayslip(TestUsPayslip):
wh = -127.92
employee = self._createEmployee()
employee.company_id.pa_unemp_employee_rate_2018 = 0.06~
employee.company_id.pa_unemp_employee_rate_2018 = 0.06
employee.company_id.pa_unemp_company_rate_2018 = 3.6785
employee.company_id.pa_withhold_rate_2018 = 3.07

View File

@@ -18,10 +18,10 @@ ytd += contract.external_wages
remaining = 9000.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>

View File

@@ -18,10 +18,10 @@ ytd += contract.external_wages
remaining = 8000.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>

View File

@@ -18,10 +18,10 @@ ytd += contract.external_wages
remaining = 47300.0 - ytd
if remaining &lt;= 0.0:
result = 0
elif remaining &lt; categories.GROSS:
elif remaining &lt; categories.BASIC:
result = remaining
else:
result = categories.GROSS
result = categories.BASIC
</field>
<field name="appears_on_payslip" eval="False"/>
</record>