mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Merge branch '11.0-payroll-test' into 11.0-test
This commit is contained in:
@@ -36,12 +36,12 @@
|
|||||||
<record id="contrib_register_cador_ett" model="hr.contribution.register">
|
<record id="contrib_register_cador_ett" model="hr.contribution.register">
|
||||||
<field name="name">Employment Training Tax</field>
|
<field name="name">Employment Training Tax</field>
|
||||||
<field name="note">California Department of Taxation - Employment Training Tax</field>
|
<field name="note">California Department of Taxation - Employment Training Tax</field>
|
||||||
<field name="partner_id" ref="res_partner_cador_withhold"/>
|
<field name="partner_id" ref="res_partner_cador_ett"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="contrib_register_cador_sdi" model="hr.contribution.register">
|
<record id="contrib_register_cador_sdi" model="hr.contribution.register">
|
||||||
<field name="name">State Disability Insurance</field>
|
<field name="name">State Disability Insurance</field>
|
||||||
<field name="note">California Department of Taxation - State Disability Insurance</field>
|
<field name="note">California Department of Taxation - State Disability Insurance</field>
|
||||||
<field name="partner_id" ref="res_partner_cador_withhold"/>
|
<field name="partner_id" ref="res_partner_cador_sdi"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ result = categories.CA_ETT_WAGES
|
|||||||
if result_rate == 0.0:
|
if result_rate == 0.0:
|
||||||
result = 0.0
|
result = 0.0
|
||||||
</field>
|
</field>
|
||||||
<field name="register_id" ref="contrib_register_cador_sdi"/>
|
<field name="register_id" ref="contrib_register_cador_ett"/>
|
||||||
<field name="appears_on_payslip" eval="False"/>
|
<field name="appears_on_payslip" eval="False"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|||||||
@@ -60,11 +60,14 @@ allowances = contract.ks_k4_allowances
|
|||||||
additional_withholding = contract.ks_additional_withholding
|
additional_withholding = contract.ks_additional_withholding
|
||||||
schedule_pay = contract.schedule_pay
|
schedule_pay = contract.schedule_pay
|
||||||
filing_status = contract.ks_k4_filing_status
|
filing_status = contract.ks_k4_filing_status
|
||||||
|
tax_rate_table = []
|
||||||
|
|
||||||
# Tables are found in https://www.ksrevenue.org/pdf/kw1002017.pdf
|
# Tables are found in https://www.ksrevenue.org/pdf/kw1002017.pdf
|
||||||
# First check for exemption status (Step 1)
|
# First check for exemption status (Step 1)
|
||||||
if filing_status == 'exempt':
|
if filing_status == 'exempt':
|
||||||
result = 0
|
result = 0
|
||||||
|
elif wages <= 0:
|
||||||
|
result = 0
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Calculate Withholding Allowance Amounts using table (allowance multipliers are from table).
|
# Calculate Withholding Allowance Amounts using table (allowance multipliers are from table).
|
||||||
@@ -94,7 +97,7 @@ else:
|
|||||||
(float('inf'), 0.057, 24.09),
|
(float('inf'), 0.057, 24.09),
|
||||||
]
|
]
|
||||||
|
|
||||||
elif filing_status == 'married':
|
elif filing_status == 'married' and wages > 0:
|
||||||
tax_rate_table = [
|
tax_rate_table = [
|
||||||
(144, 0.0, 0.0),
|
(144, 0.0, 0.0),
|
||||||
(721, 0.031, 0.0),
|
(721, 0.031, 0.0),
|
||||||
@@ -112,7 +115,7 @@ else:
|
|||||||
(float('inf'), 0.057, 48.17),
|
(float('inf'), 0.057, 48.17),
|
||||||
]
|
]
|
||||||
|
|
||||||
elif filing_status == 'married':
|
elif filing_status == 'married' and wages > 0:
|
||||||
tax_rate_table = [
|
tax_rate_table = [
|
||||||
(288, 0.0, 0.0),
|
(288, 0.0, 0.0),
|
||||||
(1442, 0.031, 0.0),
|
(1442, 0.031, 0.0),
|
||||||
@@ -130,7 +133,7 @@ else:
|
|||||||
(float('inf'), 0.057, 52.19),
|
(float('inf'), 0.057, 52.19),
|
||||||
]
|
]
|
||||||
|
|
||||||
elif filing_status == 'married':
|
elif filing_status == 'married' and wages > 0:
|
||||||
tax_rate_table = [
|
tax_rate_table = [
|
||||||
(313, 0.0, 0.0),
|
(313, 0.0, 0.0),
|
||||||
(1563, 0.031, 0.0),
|
(1563, 0.031, 0.0),
|
||||||
@@ -148,7 +151,7 @@ else:
|
|||||||
(float('inf'), 0.057, 104.38),
|
(float('inf'), 0.057, 104.38),
|
||||||
]
|
]
|
||||||
|
|
||||||
elif filing_status == 'married':
|
elif filing_status == 'married' and wages > 0:
|
||||||
tax_rate_table = [
|
tax_rate_table = [
|
||||||
(625, 0.0, 0.0),
|
(625, 0.0, 0.0),
|
||||||
(3125, 0.031, 0.0),
|
(3125, 0.031, 0.0),
|
||||||
@@ -166,7 +169,7 @@ else:
|
|||||||
(float('inf'), 0.057, 313.13),
|
(float('inf'), 0.057, 313.13),
|
||||||
]
|
]
|
||||||
|
|
||||||
elif filing_status == 'married':
|
elif filing_status == 'married' and wages > 0:
|
||||||
tax_rate_table = [
|
tax_rate_table = [
|
||||||
(1875, 0.0, 0.0),
|
(1875, 0.0, 0.0),
|
||||||
(9375, 0.031, 0.0),
|
(9375, 0.031, 0.0),
|
||||||
@@ -184,7 +187,7 @@ else:
|
|||||||
(float('inf'), 0.057, 626.25),
|
(float('inf'), 0.057, 626.25),
|
||||||
]
|
]
|
||||||
|
|
||||||
elif filing_status == 'married':
|
elif filing_status == 'married' and wages > 0:
|
||||||
tax_rate_table = [
|
tax_rate_table = [
|
||||||
(3750, 0.0, 0.0),
|
(3750, 0.0, 0.0),
|
||||||
(18750, 0.031, 0.0),
|
(18750, 0.031, 0.0),
|
||||||
@@ -202,7 +205,7 @@ else:
|
|||||||
(float('inf'), 0.057, 1252.50),
|
(float('inf'), 0.057, 1252.50),
|
||||||
]
|
]
|
||||||
|
|
||||||
elif filing_status == 'married':
|
elif filing_status == 'married' and wages > 0:
|
||||||
tax_rate_table = [
|
tax_rate_table = [
|
||||||
(7500, 0.0, 0.0),
|
(7500, 0.0, 0.0),
|
||||||
(37500, 0.031, 0.0),
|
(37500, 0.031, 0.0),
|
||||||
|
|||||||
@@ -95,7 +95,11 @@ else:
|
|||||||
if contract.nc_nc4_filing_status == 'exempt':
|
if contract.nc_nc4_filing_status == 'exempt':
|
||||||
result = 0
|
result = 0
|
||||||
else:
|
else:
|
||||||
result = -round(((wages - (PST + (allowance_multiplier * allowances))) * 0.05599) + contract.nc_nc4_additional_wh)
|
withholding = round(((wages - (PST + (allowance_multiplier * allowances))) * 0.05599) + contract.nc_nc4_additional_wh)
|
||||||
|
if withholding > 0.0:
|
||||||
|
result = - withholding
|
||||||
|
else:
|
||||||
|
result = 0
|
||||||
|
|
||||||
</field>
|
</field>
|
||||||
<field name="register_id" ref="contrib_register_ncdor_withhold"/>
|
<field name="register_id" ref="contrib_register_ncdor_withhold"/>
|
||||||
|
|||||||
@@ -379,3 +379,40 @@ class TestUsNCPayslip(TestUsPayslip):
|
|||||||
|
|
||||||
self.assertPayrollEqual(cats['NC_UNEMP_WAGES'], remaining_nc_unemp_wages)
|
self.assertPayrollEqual(cats['NC_UNEMP_WAGES'], remaining_nc_unemp_wages)
|
||||||
self.assertPayrollEqual(cats['NC_UNEMP'], remaining_nc_unemp_wages * nc_unemp)
|
self.assertPayrollEqual(cats['NC_UNEMP'], remaining_nc_unemp_wages * nc_unemp)
|
||||||
|
|
||||||
|
def test_underflow(self):
|
||||||
|
salary = 150.0
|
||||||
|
schedule_pay = 'weekly'
|
||||||
|
# allowance_multiplier and Portion of Standard Deduction for weekly
|
||||||
|
allowance_multiplier = 48.08
|
||||||
|
PST = 168.27
|
||||||
|
|
||||||
|
exemption = 1
|
||||||
|
|
||||||
|
# Withholding should be 0, since pay is so low it's less than PST.
|
||||||
|
wh = 0.0
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
employee.company_id.nc_unemp_rate_2018 = 0.06
|
||||||
|
|
||||||
|
contract = self._createContract(employee, salary, struct_id=self.ref(
|
||||||
|
'l10n_us_nc_hr_payroll.hr_payroll_salary_structure_us_nc_employee'), schedule_pay=schedule_pay)
|
||||||
|
contract.nc_nc4_allowances = exemption
|
||||||
|
|
||||||
|
self.assertEqual(contract.schedule_pay, 'weekly')
|
||||||
|
|
||||||
|
# tax rates
|
||||||
|
nc_unemp = contract.nc_unemp_rate(2018) / -100.0
|
||||||
|
|
||||||
|
self._log('2018 North Carolina tax first payslip weekly:')
|
||||||
|
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['NC_UNEMP_WAGES'], salary)
|
||||||
|
self.assertPayrollEqual(cats['NC_UNEMP'], cats['NC_UNEMP_WAGES'] * nc_unemp)
|
||||||
|
self.assertPayrollEqual(cats['NC_INC_WITHHOLD'], wh)
|
||||||
|
|
||||||
|
process_payslip(payslip)
|
||||||
|
|||||||
Reference in New Issue
Block a user