mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[IMP] l10n_us_hr_payroll: WI Wisconsin 2022 SIT Formula
This commit is contained in:
@@ -37,6 +37,17 @@
|
|||||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="rule_parameter_us_wi_sit_deduction_rate" model="hr.rule.parameter">
|
||||||
|
<field name="name">US WI Wisconsin SIT Deduction Rate</field>
|
||||||
|
<field name="code">us_wi_sit_deduction_rate</field>
|
||||||
|
<field name="country_id" ref="base.us"/>
|
||||||
|
</record>
|
||||||
|
<record id="rule_parameter_us_wi_sit_deduction_rate_2021" model="hr.rule.parameter.value">
|
||||||
|
<field name="parameter_value">False</field>
|
||||||
|
<field name="rule_parameter_id" ref="rule_parameter_us_wi_sit_deduction_rate"/>
|
||||||
|
<field name="date_from" eval="datetime(2021, 1, 1).date()"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="rule_parameter_us_wi_sit_tax_rate" model="hr.rule.parameter">
|
<record id="rule_parameter_us_wi_sit_tax_rate" model="hr.rule.parameter">
|
||||||
<field name="name">US WI Wisconsin SIT Tax Rate</field>
|
<field name="name">US WI Wisconsin SIT Tax Rate</field>
|
||||||
<field name="code">us_wi_sit_tax_rate</field>
|
<field name="code">us_wi_sit_tax_rate</field>
|
||||||
|
|||||||
@@ -29,15 +29,41 @@ def wi_wisconsin_state_income_withholding(payslip, categories, worked_days, inpu
|
|||||||
additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
|
additional = payslip.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
|
||||||
exemptions = payslip.contract_id.us_payroll_config_value('wi_wt4_sit_exemptions')
|
exemptions = payslip.contract_id.us_payroll_config_value('wi_wt4_sit_exemptions')
|
||||||
exemption_amt = payslip.rule_parameter('us_wi_sit_exemption_rate')
|
exemption_amt = payslip.rule_parameter('us_wi_sit_exemption_rate')
|
||||||
tax_table = payslip.rule_parameter('us_wi_sit_tax_rate')[filing_status]
|
# deduction_table introduced in 2022
|
||||||
|
deduction_table = payslip.rule_parameter('us_wi_sit_deduction_rate')
|
||||||
|
if deduction_table:
|
||||||
|
deduction_table = deduction_table[filing_status]
|
||||||
|
# tax_table simplified in 2022
|
||||||
|
tax_table = payslip.rule_parameter('us_wi_sit_tax_rate')
|
||||||
|
if isinstance(tax_table, dict):
|
||||||
|
tax_table = tax_table[filing_status]
|
||||||
|
|
||||||
|
taxable_income = wage * pay_periods # (a)
|
||||||
|
if deduction_table:
|
||||||
|
deduction = 0.0
|
||||||
|
last_wage_cap = 0.0
|
||||||
|
last_deduction = 0.0
|
||||||
|
last_rate = 0.0
|
||||||
|
for row in deduction_table:
|
||||||
|
wage_cap, deduction, rate = row
|
||||||
|
if taxable_income <= wage_cap:
|
||||||
|
if last_rate:
|
||||||
|
deduction = last_deduction - ((taxable_income - last_wage_cap) * last_rate / 100.0)
|
||||||
|
break
|
||||||
|
last_wage_cap, last_deduction, last_rate = row
|
||||||
|
taxable_income -= deduction # (b)
|
||||||
|
|
||||||
|
taxable_income -= exemption_amt * exemptions # (c)
|
||||||
|
|
||||||
|
if taxable_income <= 0.0:
|
||||||
|
return 0.0, 0.0
|
||||||
|
|
||||||
taxable_income = wage * pay_periods
|
|
||||||
withholding = 0.0
|
withholding = 0.0
|
||||||
last = 0.0
|
last = 0.0
|
||||||
for row in tax_table:
|
for row in tax_table:
|
||||||
amt, rate, flat_fee = row
|
amt, rate, flat_fee = row
|
||||||
if taxable_income <= float(amt):
|
if taxable_income <= float(amt):
|
||||||
withholding = (((taxable_income - last) * (rate / 100)) + flat_fee) - (exemptions * exemption_amt)
|
withholding = (((taxable_income - last) * (rate / 100)) + flat_fee)
|
||||||
break
|
break
|
||||||
last = amt
|
last = amt
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user