Basic Salary 1 BASIC none code result = payslip.paid_amount Commission COMMISSION 5 input input Tips TIPS 5 input input Qualified Overtime 5 QAOT python year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) overtime_sum = year_payslips._get_line_values(['QAOT'], compute_sum=True)['QAOT']['sum']['total'] overtime_caps = payslip._rule_parameter('l10n_us_qualified_overtime_deduction_cap') if 'OVERTIME' in worked_days else {} result = employee.l10n_us_filing_status in overtime_caps and overtime_sum < overtime_caps[employee.l10n_us_filing_status] code overtime_cap = payslip._rule_parameter('l10n_us_qualified_overtime_deduction_cap')[employee.l10n_us_filing_status] current_overtime_amount = worked_days['OVERTIME'].amount/3 if overtime_sum + current_overtime_amount >= overtime_cap: current_overtime_amount = overtime_cap - overtime_sum result = current_overtime_amount Bonus BONUS 6 input input Gross Pay 100 GROSS none code result = categories['BASIC'] + categories['ALW'] Pre-tax Deductions PRETAXDEDUCTION 109 Contributions to retirement Plans 401K 110 python result = version.l10n_us_pre_retirement_amount and version.l10n_us_pre_retirement_type code amount_401K = 0 if version.l10n_us_pre_retirement_type == "percent": amount_401K = GROSS * version.l10n_us_pre_retirement_amount / 100.0 elif version.l10n_us_pre_retirement_type == "fixed": amount_401K = version.l10n_us_pre_retirement_amount year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) already_done = -year_payslips._get_line_values(['401K'], compute_sum=True)['401K']['sum']['total'] cap = payslip._rule_parameter('l10n_us_401k_cap') if already_done > cap: result = 0 else: result = min(cap - already_done, amount_401K) result = -result Benefits Matching to Retirement Plans 401KMATCHING 111 python result = version.l10n_us_pre_retirement_amount and version.l10n_us_pre_retirement_type and version.l10n_us_pre_retirement_matching_amount and version.l10n_us_pre_retirement_matching_type code employee_contribution = -result_rules['401K']['total'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) previous_amounts = year_payslips._get_line_values(['401K'], vals_list=['amount'], compute_sum=True)['401K']['sum']['amount'] irs_cap = payslip._rule_parameter('l10n_us_benefits_matching_cap') # 1. IRS cap on employee contributions employee_contribution = max(0, min(irs_cap - previous_amounts, employee_contribution)) if version.l10n_us_pre_retirement_matching_type == "percent": # 2. Salary-based eligibility cap eligible_base = min(employee_contribution, GROSS * version.l10n_us_pre_retirement_matching_yearly_cap / 100.0) # 3. apply match matching_amount = eligible_base * version.l10n_us_pre_retirement_matching_amount / 100.0 else: matching_amount = min(employee_contribution, version.l10n_us_pre_retirement_matching_amount) result = matching_amount Medical MEDICAL 112 python result = version.l10n_us_health_benefits_medical code result = - version.l10n_us_health_benefits_medical Dental DENTAL 112 python result = version.l10n_us_health_benefits_dental code result = - version.l10n_us_health_benefits_dental Vision VISION 113 python result = version.l10n_us_health_benefits_vision code result = - version.l10n_us_health_benefits_vision Medical FSA MEDICALFSA 114 python result = version.l10n_us_health_benefits_fsa code result = - version.l10n_us_health_benefits_fsa Medical FSA Dependent Care MEDICALFSADC 115 python result = version.l10n_us_health_benefits_fsadc code result = - version.l10n_us_health_benefits_fsadc Health Benefits: HSA MEDICALHSA 116 python result = version.l10n_us_health_benefits_hsa code result = - version.l10n_us_health_benefits_hsa Commuter Benefits COMMUTER 117 python result = version.l10n_us_commuter_benefits code result = - version.l10n_us_commuter_benefits Taxable Income TAXABLE 150 code result = GROSS + categories['PRETAX'] Taxes TAXES 159 Federal Income Tax FIT 160 code # Worksheet 1A. Employer's Withholding Worksheet for Percentage # Method Tables for Automated Payroll Systems # https://www.irs.gov/publications/p15t#en_US_2023_publink100019280 # Step 1. Adjust the employee's payment amount # 1a Enter the employee's total taxable wages this payroll period line_1a = categories['TAXABLE'] # 1b Enter the number of pay periods you have per year line_1b = { 'annually': 1, 'semi-annually': 2, 'quarterly': 4, 'bi-monthly': 6, 'monthly': 12, 'semi-monthly': 24, 'bi-weekly': 26, 'weekly': 52, 'daily': 260, }[version.schedule_pay] # 1c Multiply the amount on line 1a by the number on line 1b line_1c = line_1a * line_1b if not version.l10n_us_old_w4: # If the employee HAS submitted a Form W-4 for 2020 or later, # figure the Adjusted Annual Wage Amount as follows: # 1d Enter the amount from Step 4(a) of the employee's Form W-4 line_1d = version.l10n_us_w4_step_4a # 1e Add lines 1c and 1d line_1e = line_1c + line_1d # 1f Enter the amount from Step 4(b) of the employee's Form W-4 line_1f = version.l10n_us_w4_step_4b # 1g If the box in Step 2 of Form W-4 is checked, enter -0-. # If the box is not checked, enter $12,900 if the taxpayer is # married filing jointly or $8,600 otherwise if version.l10n_us_w4_step_2: line_1g = 0 elif version.l10n_us_filing_status == 'jointly': line_1g = payslip._rule_parameter('l10n_us_income_tax_1g_jointly') else: line_1g = payslip._rule_parameter('l10n_us_income_tax_1g_separately') # 1h Add lines 1f and 1g line_1h = line_1f + line_1g # 1i Subtract line 1h from line 1e. If zero or less, enter -0-. # This is the Adjusted Annual Wage Amount line_1i = max(0, line_1e - line_1h) adjusted_annual_wage = line_1i else: # If the employee HAS NOT submitted a Form W-4 for 2020 or later, # figure the Adjusted Annual Wage Amount as follows: # 1j Enter the number of allowances claimed on the employee's # most recent Form W-4 line_1j = version.l10n_us_w4_allowances_count # 1k Multiply line 1j by $4,300 line_1k = line_1j * payslip._rule_parameter('l10n_us_income_tax_1k_factor') # 1l Subtract line 1k from line 1c. If zero or less, enter -0-. # This is the Adjusted Annual Wage Amount line_1l = max(0, line_1c - line_1k) adjusted_annual_wage = line_1l # Step 2. Figure the Tentative Withholding Amount # based on the employee's Adjusted Annual Wage Amount; # filing status (Step 1(c) of the 2020 or later Form W-4) # or marital status (line 3 of Form W-4 from 2019 or earlier); # and whether the box in Step 2 of 2020 or later Form W-4 is checked. # Note. Don't use the Head of Household table if the Form W-4 is # from 2019 or earlier. # 2a Enter the employee's Adjusted Annual Wage Amount from line 1i or 1l above line_2a = adjusted_annual_wage # 2b Find the row in the appropriate Annual Percentage Method table in # which the amount on line 2a is at least the amount in column A but # less than the amount in column B, then enter here the amount from # column A of that row if version.l10n_us_old_w4 or not version.l10n_us_w4_step_2: withholding_rates = payslip._rule_parameter('l10n_us_income_tax_withholding_rates_1') else: withholding_rates = payslip._rule_parameter('l10n_us_income_tax_withholding_rates_2') if version.l10n_us_filing_status in ['jointly', 'survivor']: withholding_rates = withholding_rates['jointly'] if version.l10n_us_filing_status in ['single', 'separately']: withholding_rates = withholding_rates['separately'] if version.l10n_us_filing_status == 'head': withholding_rates = withholding_rates['separately' if version.l10n_us_old_w4 else 'head'] def find_rates(x, rates): for low, high, fix, rate, threshold in rates: if low <= x <= high: return low, high, fix, rate, threshold low, high, fix, rate, threshold = find_rates(adjusted_annual_wage, withholding_rates) line_2b = low # 2c Enter the amount from column C of that row line_2c = fix # 2d Enter the percentage from column D of that row line_2d = rate # 2e Subtract line 2b from line 2a line_2e = line_2a - line_2b # 2f Multiply the amount on line 2e by the percentage on line 2d line_2f = line_2e * line_2d / 100 # 2g Add lines 2c and 2f line_2g = line_2c + line_2f # 2h Divide the amount on line 2g by the number of pay periods # on line 1b. This is the Tentative Withholding Amount line_2h = line_2g / line_1b tentative_withholding_amount = line_2h # Step 3. Account for tax credits # 3a If the employee's Form W-4 is from 2020 or later, enter the amount # from Step 3 of that form; otherwise, enter -0- if not version.l10n_us_old_w4: line_3a = version.l10n_us_w4_step_3 else: line_3a = 0 # 3b Divide the amount on line 3a by the number of pay periods on line 1b line_3b = line_3a / line_1b # 3c Subtract line 3b from line 2h. If zero or less, enter -0- line_3c = max(0, tentative_withholding_amount - line_3b) # Step 4. Figure the final amount to withhold # 4a Enter the additional amount to withhold from the employee's Form W-4 # (Step 4(c) of the 2020 or later form or line 6 on earlier forms) line_4a = version.l10n_us_w4_step_4c # 4b Add lines 3c and 4a. This is the amount to withhold from the # employee's wages this pay period line_4b = line_3c + line_4a result = - line_4b Social Security Tax SST 161 code taxable = categories['TAXABLE'] - result_rules['401K']['total'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['TAXABLE', '401K'], vals_list=['amount'], compute_sum=True) previous_amounts = line_values['TAXABLE']['sum']['amount'] - line_values['401K']['sum']['amount'] cap = payslip._rule_parameter('l10n_us_OASDI_cap') if previous_amounts > cap: result = 0 else: result = min(cap - previous_amounts, taxable) result_rate = - payslip._rule_parameter('l10n_us_OASDI_tax_rate') Medicare Tax MEDICARE 161 code result = categories['TAXABLE'] - result_rules['401K']['total'] result_rate = - 1.45 Medicare Additional Tax MEDICAREADD 161 code # https://www.irs.gov/publications/p15#en_US_2023_publink1000286680 medicare_amount = result_rules['MEDICARE']['amount'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['MEDICARE'], vals_list=['amount'], compute_sum=True) cap = payslip._rule_parameter('l10n_us_medicare_additional_cap') previous_amounts = line_values['MEDICARE']['sum']['amount'] if previous_amounts > cap: result = medicare_amount else: result = max(0, medicare_amount - (cap - previous_amounts)) result_rate = - 0.9 CA State Income Tax CAINCOMETAX 162 python result = version.address_id.state_id.code == 'CA' code # METHOD B - EXACT CALCULATION METHOD # https://edd.ca.gov/siteassets/files/pdf_pub_ctr/23methb.pdf gross = categories['TAXABLE'] - result_rules['MEDICALHSA']['total'] schedule_pay = version.schedule_pay # Step 1 Determine if the employee's gross wages are less than, # or equal to, the amount shown in TABLE 1 - LOW # INCOME EXEMPTION TABLE. If so, no income tax is required # to be withheld. low_income_exemption_table = payslip._rule_parameter('l10n_us_ca_low_income_exemption_table') table_index = None if version.l10n_us_state_filing_status == 'ca_status_1': table_index = 0 elif version.l10n_us_state_filing_status == 'ca_status_2': if version.l10n_us_w4_allowances_count <= 1: table_index = 1 else: table_index = 2 elif version.l10n_us_state_filing_status == 'ca_status_4': table_index = 3 if table_index is None: raise UserError(f'No state tax filling status for employee {employee.name}') exemption_amount = low_income_exemption_table[schedule_pay][table_index] if gross <= exemption_amount: gross = 0 # Step 2 If the employee claims any additional withholding allowances # for estimated deductions on a DE 4, subtract the amount shown in # TABLE 2 - ESTIMATED DEDUCTION TABLE from the gross wages. estimated_deduction_table = payslip._rule_parameter('l10n_us_ca_estimated_deduction_table') deduction_amounts = estimated_deduction_table[schedule_pay] allowance_count = version.l10n_us_w4_withholding_deduction_allowances if allowance_count and allowance_count <= 10: gross -= deduction_amounts[allowance_count - 1] elif allowance_count and allowance_count > 10: gross -= deduction_amounts[0] * allowance_count # Step 3 Subtract the standard deduction amount shown in TABLE 3 - STANDARD # DEDUCTION TABLE to arrive at the employee's taxable income. standard_deduction_table = payslip._rule_parameter('l10n_us_ca_standard_deduction_table') deduction_amount = standard_deduction_table[schedule_pay][table_index] taxable = max(0, gross - deduction_amount) # Step 4 Use TABLE 5 - TAX RATE TABLE for the payroll period and marital # status to find the applicable line on which the taxable income # is located. Perform the indicated calculations to arrive at the # computed tax liability. tax_rate_tables = payslip._rule_parameter('l10n_us_ca_tax_rate_tables') if version.l10n_us_state_filing_status == 'ca_status_1': tax_table_key = 'separately' elif version.l10n_us_state_filing_status == 'ca_status_2': tax_table_key = 'jointly' else: tax_table_key = 'head' tax_rates = tax_rate_tables[schedule_pay][tax_table_key] def find_rates(x, rates): for low, high, rate, threshold, fix in rates: if low <= x <= high: return low, high, rate, threshold, fix low, high, rate, threshold, fix = find_rates(taxable, tax_rates) tax_liability = fix + (taxable - threshold) * rate / 100 # Step 5 Subtract the tax credit shown in TABLE 4 - EXEMPTION ALLOWANCE TABLE # from the computed tax liability to arrive at the amount of tax to be withheld. exemption_allowance_table = payslip._rule_parameter('l10n_us_ca_exemption_allowance_table') exemption_amounts = exemption_allowance_table[schedule_pay] allowance_count = version.l10n_us_w4_allowances_count if allowance_count and allowance_count <= 10: exemption_amount = exemption_amounts[allowance_count] elif allowance_count and allowance_count > 10: exemption_amount = exemption_amounts[1] * allowance_count else: exemption_amount = 0 tax_to_be_withheld = max(0, tax_liability - exemption_amount) result = - (tax_to_be_withheld + employee.l10n_us_state_extra_withholding) NY State Income Tax NYINCOMETAX 162 python result = version.address_id.state_id.code == 'NY' code # There are three methods in New York for determining the amount from salaries to # be withheld for state personal income tax (Method I, II, and III). We will use # Method II Exact Calculation due to its wider amplitude of salaries covered. # See: https://www.tax.ny.gov/pdf/publications/withholding/nys50_t_nys_123.pdf # Step 1 # If the number of exemptions claimed is ten or fewer, look up the total exemption # and deduction amount in Table A on page 14, according to the payroll period and # marital status claimed. (If there are more than 10 exemptions, multiply the # number by the exemption amount in Table C on page 14 and add it to the deduction # amount from Table B.) Subtract the total exemption and deduction amount from the # wages to get net wages. # For weekly payroll periods, if the amount of net wages is $600 or less, you may # use the simplified Dollar to Dollar Withholding Table beginning on page 20 to # find the amount to withhold. Otherwise, continue with Step 2. # Note: If the annualized amount of net wages is at least $1,077,550, then you must # use Method III to determine the amount to withhold. gross = categories['TAXABLE'] schedule_pay = version.schedule_pay if version.l10n_us_state_filing_status in ['ny_status_1', 'ny_status_3']: marital = "single" else: marital = "married" allowances_count = version.l10n_us_w4_allowances_count if allowances_count <= 10: table_a = payslip._rule_parameter('l10n_us_ny_state_income_tax_table_a') total_exemption_deduction_amount = table_a[schedule_pay][marital][allowances_count] else: table_c = payslip._rule_parameter('l10n_us_ny_state_income_tax_table_c') exemption_allowance = table_c[schedule_pay] table_b = payslip._rule_parameter('l10n_us_ny_state_income_tax_table_b') deduction_allowance = table_b[schedule_pay][marital] total_exemption_deduction_amount = allowances_count * exemption_allowance + deduction_allowance net_wages = gross - total_exemption_deduction_amount # Step 2 Locate the table on page 17/19 for the appropriate payroll period. Find the # line on which the net wages fall between the amounts in Columns 1 and 2. all_rates = payslip._rule_parameter('l10n_us_ny_state_income_tax_rates') rates = all_rates[schedule_pay][marital] def find_rates(x, rates): for low, high, col3, col4, col5 in rates: if low <= x <= high: return low, high, col3, col4, col5 return 0, 0, 0, 0, 0 col1, col2, col3, col4, col5 = find_rates(net_wages, rates) # Step 3 Following across on the line you found in Step 2, subtract the amount in # Column 3 from the net wages. step3 = net_wages - col3 # Step 4 Following across the same line, multiply the result from Step 3 by the # amount in Column 4. step4 = step3 * col4 # Step 5 Following across on the same line, add the result from Step 4 to the amount # in Column 5. The resulting sum is the amount to withhold from wages. tax_to_be_withheld = step4 + col5 result = - (tax_to_be_withheld + employee.l10n_us_state_extra_withholding) CO State Income Tax COINCOMETAX 162 python result = version.address_id.state_id.code == 'CO' code # Step 1 # Compute Gross Income (GI) = Employee's Gross Wage * Number of Payroll Periods per Year gross_income = categories['TAXABLE'] * version._get_salary_costs_factor() # Step 2 # Get the correct deduction from the taxable amount if version.l10n_us_state_withholding_allowance: deduction = version.l10n_us_state_withholding_allowance elif version.l10n_us_state_filing_status == 'co_status_2': deduction = payslip._rule_parameter('l10n_us_co_ded_jointly') else: deduction = payslip._rule_parameter('l10n_us_co_ded_single') # Step 3 # Final taxable amount by applying the deduction taxable = max(gross_income - deduction, 0) # Step 4 # Tax amount per year yearly_tax = taxable * payslip._rule_parameter('l10n_us_co_income_tax_rate') # Step 5 # Tax amount per payroll period tax = yearly_tax / version._get_salary_costs_factor() # Step 6 # Add extra tax withholding tax += version.l10n_us_state_extra_withholding or 0 result = -tax VT State Income Tax VTINCOMETAX 162 python result = employee.address_id.state_id.code == 'VT' code # Calculation: https://tax.vermont.gov/sites/tax/files/documents/GB-1210-2025.pdf gross = categories['TAXABLE'] schedule_pay = version.schedule_pay if schedule_pay in ['semi-annually', 'bi-monthly']: gross *= version._get_salary_costs_factor()[schedule_pay] schedule_pay = 'annually' withholding_allowance_amount = payslip._rule_parameter('l10n_us_vt_withholding_allowances_table')[schedule_pay] gross -= employee.l10n_us_w4_allowances_count * withholding_allowance_amount tax_rate_tables = payslip._rule_parameter('l10n_us_vt_tax_rate_tables') if employee.l10n_us_state_filing_status in ['vt_status_1', 'vt_status_3', 'vt_status_4']: tax_table_key = 'single' else: tax_table_key = 'married' tax_rates = tax_rate_tables[schedule_pay][tax_table_key] def find_rates(x, rates): for low, high, rate, threshold, fix in rates: if low <= x <= high: return low, high, rate, threshold, fix low, high, rate, threshold, fix = find_rates(gross, tax_rates) tax_to_be_withheld = fix + (gross - threshold) * rate / 100 if version.schedule_pay in ['semi-annually', 'bi-monthly']: tax_to_be_withheld /= version._get_salary_costs_factor()[version.schedule_pay] result = - (tax_to_be_withheld + employee.l10n_us_state_extra_withholding) IL State Income Tax ILINCOMETAX 162 python result = employee.address_id.state_id.code == 'IL' code # Calculation: https://tax.illinois.gov/content/dam/soi/en/web/tax/forms/withholding/documents/currentyear/il-700-t.pdf # Step 1 gross = categories['TAXABLE'] # Step 2 # 2. a line_1_allowances = employee.l10n_us_w4_allowances_count * payslip._rule_parameter('l10n_us_il_line_1_allowances') # 2. b line_2_allowances = employee.l10n_us_w4_withholding_deduction_allowances * payslip._rule_parameter('l10n_us_il_line_2_allowances') # 2. c total_allowances = line_1_allowances + line_2_allowances # 2. d exemption = total_allowances / version._get_salary_costs_factor() # Step 3 taxable = gross - exemption # Step 4 tax_to_be_withheld = taxable * payslip._rule_parameter('l10n_us_il_income_tax_rate') # Step 5 result = -(tax_to_be_withheld + employee.l10n_us_state_extra_withholding) AZ State Income Tax AZINCOMETAX 162 python result = employee.address_id.state_id.code == 'AZ' code # Step 1 gross = categories['TAXABLE'] # Step 2 filing_status = employee.l10n_us_state_filing_status tax_rate = int(filing_status[-1]) * 0.5 / 100 # Step 3 tax_to_be_withheld = gross * tax_rate # Step 4 result = -(tax_to_be_withheld + employee.l10n_us_state_extra_withholding) NC State Income Tax NCINCOMETAX 162 python result = employee.address_id.state_id.code == 'NC' code # Calculation: https://www.ncdor.gov/income-tax-withholding-tables-and-instructions-employers/open # Step 1 gross = categories['TAXABLE'] # Step 2 pay_periods = version._get_salary_costs_factor() # Step 3 annual_gross = gross * pay_periods # Step 4 if employee.l10n_us_state_filing_status in ['nc_status_1', 'nc_status_3']: standard_deduction = payslip._rule_parameter('l10n_us_nc_standard_deduction_single') else: standard_deduction = payslip._rule_parameter('l10n_us_nc_standard_deduction_head') # Step 5 allowances = employee.l10n_us_w4_allowances_count * payslip._rule_parameter('l10n_us_nc_withholding_allowances') # Step 6 total_exemption = standard_deduction + allowances # Step 7 annual_taxable = annual_gross - total_exemption # Step 8 annual_tax_to_be_withheld = annual_taxable * payslip._rule_parameter('l10n_us_nc_tax_rate') / 100 # Step 9 tax_to_be_withheld = round(annual_tax_to_be_withheld / version._get_salary_costs_factor()) # Step 4 result = -(tax_to_be_withheld + employee.l10n_us_state_extra_withholding) VA State Income Tax VAINCOMETAX 162 python result = employee.address_id.state_id.code == 'VA' code # Step 1 standard_deduction = payslip._rule_parameter('l10n_us_va_standard_deduction') line_1_allowances = employee.l10n_us_w4_allowances_count * payslip._rule_parameter('l10n_us_va_line_1_allowances') line_2_allowances = employee.l10n_us_w4_withholding_deduction_allowances * payslip._rule_parameter('l10n_us_va_line_2_allowances') total_exemptions = standard_deduction + line_1_allowances + line_2_allowances annual_gross = categories['TAXABLE'] * version._get_salary_costs_factor() - total_exemptions # Step 2 tax_rates = payslip._rule_parameter('l10n_us_va_tax_rates_table') def find_rates(x, rates): for low, high, rate, threshold, fix in rates: if low <= x <= high: return low, high, rate, threshold, fix low, high, rate, threshold, fix = find_rates(annual_gross, tax_rates) annual_tax_to_be_withheld = fix + (annual_gross - threshold) * rate / 100 # Step 3 tax_to_be_withheld = annual_tax_to_be_withheld / version._get_salary_costs_factor() # Step 4 result = -(tax_to_be_withheld + employee.l10n_us_state_extra_withholding) DC State Income Tax DCINCOMETAX 162 python result = employee.address_id.state_id.code == 'DC' code # Step 1 annual_gross = categories['TAXABLE'] * version._get_salary_costs_factor() # Step 2 tax_rates = payslip._rule_parameter('l10n_us_dc_tax_rates_table') def find_rates(x, rates): for low, high, rate, threshold, fix in rates: if low <= x <= high: return low, high, rate, threshold, fix low, high, rate, threshold, fix = find_rates(annual_gross, tax_rates) annual_tax_to_be_withheld = fix + (annual_gross - threshold) * rate / 100 # Step 3 tax_to_be_withheld = annual_tax_to_be_withheld / version._get_salary_costs_factor() # Step 4 result = -(tax_to_be_withheld + employee.l10n_us_state_extra_withholding) OR State Income Tax ORINCOMETAX 162 python result = employee.address_id.state_id.code == 'OR' code # Step 1 annual_gross = categories['TAXABLE'] * version._get_salary_costs_factor() # Step 2 if annual_gross < payslip._rule_parameter('l10n_us_or_annual_wage_cap'): tax_rates_key = 'below_cap' else: tax_rates_key = 'above_cap' if employee.l10n_us_state_filing_status == 'or_status_1' and employee.l10n_us_w4_allowances_count < 3: standard_deduction = payslip._rule_parameter('l10n_us_or_standard_deduction')['single'] tax_rates = payslip._rule_parameter('l10n_us_or_annual_tax_brackets')[tax_rates_key]['single'] else: standard_deduction = payslip._rule_parameter('l10n_us_or_standard_deduction')['married'] tax_rates = payslip._rule_parameter('l10n_us_or_annual_tax_brackets')[tax_rates_key]['married'] # Step 3 def find_cap(x, caps): for low, high, cap in caps: if low <= x <= high: return cap return 0 if employee.l10n_us_state_filing_status == 'or_status_1': federal_cap = find_cap(annual_gross, payslip._rule_parameter('l10n_us_or_federal_tax_cap')['single']) else: federal_cap = find_cap(annual_gross, payslip._rule_parameter('l10n_us_or_federal_tax_cap')['married']) # Step 4 federal_tax = abs(result_rules['FIT']['total']) * version._get_salary_costs_factor() # Step 5 base = annual_gross - min(federal_tax, federal_cap) - standard_deduction # Step 6 def find_rates(x, rates): for low, high, rate, threshold, fix in rates: if low <= x <= high: return low, high, rate, threshold, fix low, high, rate, threshold, fix = find_rates(base, tax_rates) # Step 7 if employee.l10n_us_state_filing_status == 'or_status_1': allowances_cap = payslip._rule_parameter('l10n_us_or_allowances_cap')['single'] else: allowances_cap = payslip._rule_parameter('l10n_us_or_allowances_cap')['married'] # Step 8 if annual_gross > allowances_cap: allowances = 0 else: allowances = payslip._rule_parameter('l10n_us_or_withholding_allowances') * employee.l10n_us_w4_allowances_count # Step 8 annual_tax_to_be_withheld = fix + (base - threshold) * rate / 100 - allowances # Step 9 tax_to_be_withheld = annual_tax_to_be_withheld / version._get_salary_costs_factor() # Step 10 result = -(tax_to_be_withheld + employee.l10n_us_state_extra_withholding) ID State Income Tax IDINCOMETAX 162 python result = employee.address_id.state_id.code == 'ID' code gross = categories['TAXABLE'] schedule_pay = version.schedule_pay if schedule_pay in ['semi-annually', 'quarterly', 'bi-monthly']: gross *= version._get_salary_costs_factor()[schedule_pay] schedule_pay = 'annually' withholding_allowance_amount = payslip._rule_parameter('l10n_us_id_child_tax_credit_withholding_allowances')[schedule_pay] gross -= employee.l10n_us_w4_allowances_count * withholding_allowance_amount tax_rate_tables = payslip._rule_parameter('l10n_us_id_tax_brackets') if employee.l10n_us_state_filing_status in ['id_status_1', 'id_status_3']: tax_table_key = 'single' else: tax_table_key = 'married' bracket = tax_rate_tables[schedule_pay][tax_table_key] rate = payslip._rule_parameter('l10n_us_id_tax_rate') tax_to_be_withheld = (gross - bracket) * rate / 100 if gross >= bracket else 0 if version.schedule_pay in ['semi-annually', 'quarterly', 'bi-monthly']: tax_to_be_withheld /= version._get_salary_costs_factor()[version.schedule_pay] result = -(tax_to_be_withheld + employee.l10n_us_state_extra_withholding) AL State Income Tax ALINCOMETAX 162 python # We will use the formula for computing Alabama withholding tax from the document below. # See: https://www.revenue.alabama.gov/ultraviewer/viewer/basic_viewer/index.html?form=2023/01/whbooklet_0123.pdf.pdf # # Check if the tax needs to be withheld. The tax needs to be withheld in 3 cases: # - Employer resident in Alabama and employee resident in Alabama # - Employer resident in Alabama, employee not resident in Alabama and employee works in Alabama # - Employer not resident in Alabama and employee works in Alabama # # All these conditions can be summarized to this: # Employee works in Alabama OR (employer resident in Alabama AND employee resident in Alabama) result = (version.address_id.state_id.code == 'AL' or (version.company_id.state_id.code == 'AL' and version.private_state_id.code == 'AL')) code # We will use the formula for computing Alabama withholding tax from the document below. # See: https://www.revenue.alabama.gov/ultraviewer/viewer/basic_viewer/index.html?form=2023/01/whbooklet_0123.pdf.pdf # # Step 1 # Compute Gross Income (GI) = Employee's Gross Wage * Number of Payroll Periods per Year gross_income = categories['TAXABLE'] * version._get_salary_costs_factor() # Step 2 # Get the Standard Deduction using the deduction table and the employee filing status standard_deduction_table = payslip._rule_parameter('l10n_us_al_standard_deduction_table') match version.l10n_us_state_filing_status: case 'al_status_3': ded_table_key = 'separately' case 'al_status_4': ded_table_key = 'jointly' case 'al_status_5': ded_table_key = 'head' case _: ded_table_key = 'single' def find_deductions(x, deductions): for low, high, deduction in deductions: if low <= x <= high: return deduction return 0 standard_deduction = find_deductions(gross_income, standard_deduction_table[ded_table_key]) # Step 3 # Get the Employee's annual Federal Income Tax # FIT is negative and we want the absolute amount fit = -result_rules['FIT']['total'] * version._get_salary_costs_factor() # Step 4 # Compute personal exemption depending on the filing status: match version.l10n_us_state_filing_status: case 'al_status_2' | 'al_status_3': personal_exemption = payslip._rule_parameter('l10n_us_al_personal_exempt') case 'al_status_4' | 'al_status_5': personal_exemption = payslip._rule_parameter('l10n_us_al_personal_exempt') * 2 case _: personal_exemption = 0 # Step 5 # Compute amount per dependent according to Gross Income (GI): dependents_deduction = 0 for amount_per_dependent, threshold in payslip._rule_parameter('l10n_us_al_amount_per_dependent_table'): if gross_income <= threshold: dependents_deduction = amount_per_dependent * version.children break # Step 6 # Compute total deductions total_deduction = standard_deduction + fit + personal_exemption + dependents_deduction # Step 7 # Compute taxable amount taxable_amount = max(gross_income - total_deduction, 0) # Step 8 # Compute income tax income_tax = 0 for bracket, rate in payslip._rule_parameter('l10n_us_al_tax_rates_table'): if version.l10n_us_state_filing_status == 'al_status_4': bracket *= 2 income_tax += min(taxable_amount, bracket) * rate taxable_amount -= min(taxable_amount, bracket) # Step 9 # Alabama Withholding Tax tax_to_be_withheld = income_tax / version._get_salary_costs_factor() result = -(tax_to_be_withheld + employee.l10n_us_state_extra_withholding) CA SDI Tax CASDITAX 163 python result = version.address_id.state_id.code == 'CA' code result = categories['TAXABLE'] - result_rules['MEDICALHSA']['total'] - result_rules['401K']['total'] result_rate = - payslip._rule_parameter('l10n_us_ca_sdi_tax_rate') NY SDI Tax NYSDITAX 163 python result = version.address_id.state_id.code == 'NY' code taxable = categories['TAXABLE'] max_amount = payslip._rule_parameter('l10n_us_ny_sdi_max_amount')[version.schedule_pay] result = - min(0.005 * taxable, max_amount) NY PFL Tax NYPFLTAX 165 python result = version.address_id.state_id.code == 'NY' code taxable = categories['GROSS'] rate = payslip._rule_parameter('l10n_us_ny_pfl_rate') pfl_amount = taxable * rate / 100.0 year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) previous_amounts = -year_payslips._get_line_values(['NYPFLTAX'], compute_sum=True)['NYPFLTAX']['sum']['total'] cap = payslip._rule_parameter('l10n_us_ny_pfl_max_amount') if previous_amounts > cap: pfl_amount = 0 else: pfl_amount = min(cap - previous_amounts, pfl_amount) result = -pfl_amount Worker's Compensation WORKER_COMPENSATION 166 python result = version.address_id.state_id.code == 'WA' and version.l10n_us_worker_compensation_id code payroll_deduction = version.l10n_us_worker_compensation_id.payroll_deduction xp_factor = payslip._rule_parameter('l10n_us_business_experience_factor') result = payroll_deduction * payslip.sum_worked_hours * xp_factor CO FAMLI - Family and Medical Leave Insurance Program COFAMLI 166 python result = version.address_id.state_id.code == 'CO' code taxable = categories['GROSS'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['GROSS'], vals_list=['amount'], compute_sum=True) previous_amounts = line_values['GROSS']['sum']['amount'] cap = payslip._rule_parameter('l10n_us_OASDI_cap') if previous_amounts > cap: result = 0 else: result = min(cap - previous_amounts, taxable) result_rate = payslip._rule_parameter('l10n_us_co_famli_rate') CO OPT Aurora COOPTAURORA 166 python result = version.address_id.state_id.code == 'CO' and version.address_id.city == 'Aurora' code result = -payslip._rule_parameter('l10n_us_co_opt_aurora') * 12 / version._get_salary_costs_factor() CO OPT Denver COOPTDENVER 166 python result = version.address_id.state_id.code == 'CO' and version.address_id.city == 'Denver' code result = -payslip._rule_parameter('l10n_us_co_opt_denver') * 12 / version._get_salary_costs_factor() CO OPT Glendale COOPTGLENDALE 166 python result = version.address_id.state_id.code == 'CO' and version.address_id.city == 'Glendale' code result = -payslip._rule_parameter('l10n_us_co_opt_glendale') * 12 / version._get_salary_costs_factor() CO OPT Greenwood Village COOPTGREENWOODVILLAGE 166 python result = version.address_id.state_id.code == 'CO' and version.address_id.city == 'Greenwood Village' code result = -payslip._rule_parameter('l10n_us_co_opt_greenwood_village') * 12 / version._get_salary_costs_factor() CO OPT Sheridan COOPTSHERIDAN 166 python result = version.address_id.state_id.code == 'CO' and version.address_id.city == 'Sheridan' code result = -payslip._rule_parameter('l10n_us_co_opt_sheridan') * 12 / version._get_salary_costs_factor() OR Transit Tax ORTRANSITTAX 166 python result = employee.address_id.state_id.code == 'OR' code result = categories['GROSS'] result_rate = - payslip._rule_parameter('l10n_us_or_transit_tax_rate') OR Workers Benefit Fund ORWBF 166 python result = employee.address_id.state_id.code == 'OR' code result = payslip._rule_parameter('l10n_us_or_wbf_amount_per_hour') result_rate = - payslip._rule_parameter('l10n_us_or_wbf_employee_portion') result_qty = payslip.sum_worked_hours OR Family and Medical Leave Insurance (FMLI) ORFMLI 166 python result = employee.address_id.state_id.code == 'OR' code gross = categories['TAXABLE'] - result_rules['401K']['total'] rate = payslip._rule_parameter('l10n_us_or_fmli_employee_portion') / 100 result = gross * rate result_rate = payslip._rule_parameter('l10n_us_or_fmli_rate') WA PFML - Employee Family Share WAPFMLFAMILY 166 python result = version.address_id.state_id.code == 'WA' code taxable = categories['GROSS'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['GROSS'], vals_list=['amount'], compute_sum=True) previous_amounts = line_values['GROSS']['sum']['amount'] cap = payslip._rule_parameter('l10n_us_OASDI_cap') if previous_amounts > cap: result = 0 else: result = min(cap - previous_amounts, taxable) result_rate = payslip._rule_parameter('l10n_us_wa_pfml_family_rate') WA PFML - Employee Medical Share WAPFMLMEDICAL 166 python result = version.address_id.state_id.code == 'WA' code taxable = categories['GROSS'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['GROSS'], vals_list=['amount'], compute_sum=True) previous_amounts = line_values['GROSS']['sum']['amount'] cap = payslip._rule_parameter('l10n_us_OASDI_cap') if previous_amounts > cap: result = 0 else: result = min(cap - previous_amounts, taxable) result_rate = payslip._rule_parameter('l10n_us_wa_pfml_medical_rate') WA Cares Fund WACARESFUND 166 python result = version.address_id.state_id.code == 'WA' code result = categories['GROSS'] result_rate = - payslip._rule_parameter('l10n_us_wa_cares_fund_rate') VT Childcare Tax VTCHILDCARE 166 python result = employee.address_id.state_id.code == 'VT' code result = categories['GROSS'] result_rate = - payslip._rule_parameter('l10n_us_vt_childcare_tax_rate') Post-tax Deductions POSTTAXDEDUCTION 169 Roth 401(k) ROTH401K 170 python result = version.l10n_us_post_roth_401k_amount and version.l10n_us_post_roth_401k_type code amount_ROTH401K = 0 if version.l10n_us_post_roth_401k_type == "percent": amount_ROTH401K = GROSS * version.l10n_us_post_roth_401k_amount / 100.0 elif version.l10n_us_post_roth_401k_type == "fixed": amount_ROTH401K = version.l10n_us_post_roth_401k_amount year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) already_done = -year_payslips._get_line_values(['ROTH401K'], compute_sum=True)['ROTH401K']['sum']['total'] cap = payslip._rule_parameter('l10n_us_401k_cap') if already_done > cap: result = 0 else: result = min(cap - already_done, amount_ROTH401K) result = -result Attachment of Salary 174 ATTACH_SALARY python result = 'ATTACH_SALARY' in inputs code result = -inputs['ATTACH_SALARY'].amount result_name = inputs['ATTACH_SALARY'].name Assignment of Salary 174 ASSIG_SALARY python result = 'ASSIG_SALARY' in inputs code result = -inputs['ASSIG_SALARY'].amount result_name = inputs['ASSIG_SALARY'].name Child Support CHILD_SUPPORT code 174 python result = 'CHILD_SUPPORT' in inputs result = -inputs['CHILD_SUPPORT'].amount result_name = inputs['CHILD_SUPPORT'].name Employer Taxes: Social Security COMPANYSOCIAL 175 none code result = result_rules['SST']['amount'] result_rate = - result_rules['SST']['rate'] Employer Taxes: Medicare COMPANYMEDICARE 175 none code result = result_rules['MEDICARE']['amount'] result_rate = - result_rules['MEDICARE']['rate'] Employer Taxes: FUTA COMPANYFUTA 175 none code taxable = categories['TAXABLE'] - result_rules['401K']['total'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['TAXABLE', '401K'], compute_sum=True) already_taxed = line_values['TAXABLE']['sum']['total'] - line_values['401K']['sum']['total'] cap = payslip._rule_parameter('l10n_us_FUTA_cap') if already_taxed > cap: result = 0 else: result = min(cap - already_taxed, taxable) result_rate = payslip._rule_parameter('l10n_us_FUTA_tax_rate') Employer Taxes: SUI Tax COMPANYSUI 175 python result = version.address_id.state_id.code code year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) if version.address_id.state_id.code == 'CA': line_values = year_payslips._get_line_values(['TAXABLE', '401K', 'MEDICALHSA'], compute_sum=True) already_taxed = line_values['TAXABLE']['sum']['total'] \ - line_values['MEDICALHSA']['sum']['total'] \ - line_values['401K']['sum']['total'] taxable = categories['TAXABLE'] - result_rules['MEDICALHSA']['total'] - result_rules['401K']['total'] elif version.address_id.state_id.code == 'CO': line_values = year_payslips._get_line_values(['TAXABLE', '401K'], compute_sum=True) already_taxed = line_values['TAXABLE']['sum']['total'] \ - line_values['401K']['sum']['total'] taxable = categories['TAXABLE'] - result_rules['401K']['total'] else: line_values = year_payslips._get_line_values(['GROSS'], compute_sum=True) already_taxed = line_values['GROSS']['sum']['total'] taxable = categories['GROSS'] state_code = version.address_id.state_id.code.lower() result_rate = payslip._rule_parameter('l10n_us_%s_sui_rate' % (state_code)) cap = payslip._rule_parameter('l10n_us_%s_sui_cap' % (state_code)) if already_taxed > cap: result = 0 else: result = min(cap - already_taxed, taxable) Employer Taxes: CA ETT Employer Payroll Tax COMPANYCAETT 176 python result = version.address_id.state_id.code == 'CA' code # https://edd.ca.gov/en/payroll_taxes/What_Are_State_Payroll_Taxes if version.company_id.l10n_us_ca_ett_tax: taxable = categories['TAXABLE'] - result_rules['MEDICALHSA']['total'] - result_rules['401K']['total'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['TAXABLE', 'MEDICALHSA', '401K'], vals_list=['amount'], compute_sum=True) previous_amounts = line_values['TAXABLE']['sum']['amount'] \ - line_values['MEDICALHSA']['sum']['amount'] \ - line_values['401K']['sum']['amount'] cap = payslip._rule_parameter('l10n_us_ca_ett_cap') if previous_amounts > cap: result = 0 else: result = min(cap - previous_amounts, taxable) else: result = 0 result_rate = payslip._rule_parameter('l10n_us_ca_ett_rate') Employer Taxes: DC Paid Family Leave (PFL) COMPANYDCPFL 176 python result = employee.address_id.state_id.code == 'DC' code result = categories['TAXABLE'] result_rate = payslip._rule_parameter('l10n_us_dc_pfl_rate') Employer Taxes: DC Administrative Funding Tax COMPANYDCADMIN 176 python result = employee.address_id.state_id.code == 'DC' code taxable = categories['TAXABLE'] rate, cap = payslip._rule_parameter('l10n_us_dc_administrative_funding_tax') result = min(taxable * rate / 100, cap) Employer Taxes: OR Workers Benefit Fund COMPANYORWBF 176 python result = employee.address_id.state_id.code == 'OR' code result = payslip._rule_parameter('l10n_us_or_wbf_amount_per_hour') result_rate = 100 - payslip._rule_parameter('l10n_us_or_wbf_employee_portion') result_qty = payslip.sum_worked_hours Employer Taxes: OR Family and Medical Leave Insurance (FMLI) COMPANYORFMLI 176 python result = employee.address_id.state_id.code == 'OR' code gross = categories['TAXABLE'] - result_rules['401K']['total'] rate = 1 - payslip._rule_parameter('l10n_us_or_fmli_employee_portion') / 100 result = gross * rate result_rate = payslip._rule_parameter('l10n_us_or_fmli_rate') Employer Taxes: NY Re-employment Tax COMPANYNYREEMPLOYMENT 176 python result = version.address_id.state_id.code == 'NY' code taxable = categories['GROSS'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['COMPANYNYREEMPLOYMENT'], vals_list=['amount'], compute_sum=True) previous_amounts = line_values['COMPANYNYREEMPLOYMENT']['sum']['amount'] cap = payslip._rule_parameter('l10n_us_ny_reemployment_tax_cap') if previous_amounts > cap: result = 0 else: result = min(cap - previous_amounts, taxable) result_rate = payslip._rule_parameter('l10n_us_ny_reemployment_tax_rate') Employer Taxes: VT Childcare Tax COMPANYVTCHILDCARE 176 python result = employee.address_id.state_id.code == 'VT' code result = categories['GROSS'] result_rate = payslip._rule_parameter('l10n_us_vt_employer_childcare_tax_rate') Employer Taxes: CO Family and Medical Leave Insurance Program (FAMLI) COMPANYCOFAMLI 176 python result = version.address_id.state_id.code == 'CO' code taxable = categories['GROSS'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['GROSS'], vals_list=['amount'], compute_sum=True) previous_amounts = line_values['GROSS']['sum']['amount'] cap = payslip._rule_parameter('l10n_us_OASDI_cap') if previous_amounts > cap: result = 0 else: result = min(cap - previous_amounts, taxable) result_rate = -payslip._rule_parameter('l10n_us_co_famli_rate') Employer Taxes: CO OPT Aurora COMPANYCOOPTAURORA 176 python result = version.address_id.state_id.code == 'CO' and version.address_id.city == 'Aurora' code result = payslip._rule_parameter('l10n_us_co_opt_aurora') * 12 / version._get_salary_costs_factor() Employer Taxes: CO OPT Denver COMPANYCOOPTDENVER 176 python result = version.address_id.state_id.code == 'CO' and version.address_id.city == 'Denver' code result = payslip._rule_parameter('l10n_us_co_opt_denver_employer') * 12 / version._get_salary_costs_factor() Employer Taxes: CO OPT Glendale COMPANYCOOPTGLENDALE 176 python result = version.address_id.state_id.code == 'CO' and version.address_id.city == 'Glendale' code result = payslip._rule_parameter('l10n_us_co_opt_glendale') * 12 / version._get_salary_costs_factor() Employer Taxes: CO OPT Greenwood Village COMPANYCOOPTGREENWOODVILLAGE 176 python result = version.address_id.state_id.code == 'CO' and version.address_id.city == 'Greenwood Village' code result = payslip._rule_parameter('l10n_us_co_opt_greenwood_village') * 12 / version._get_salary_costs_factor() Employer Taxes: CO OPT Sheridan COMPANYCOOPTSHERIDAN 176 python result = version.address_id.state_id.code == 'CO' and version.address_id.city == 'Sheridan' code result = payslip._rule_parameter('l10n_us_co_opt_sheridan') * 12 / version._get_salary_costs_factor() Employer Taxes: WA Paid Family & Medical Leave COMPANYWAPFML 176 python result = version.address_id.state_id.code == 'WA' code taxable = categories['GROSS'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['GROSS'], vals_list=['amount'], compute_sum=True) previous_amounts = line_values['GROSS']['sum']['amount'] cap = payslip._rule_parameter('l10n_us_OASDI_cap') if previous_amounts > cap: result = 0 else: result = min(cap - previous_amounts, taxable) result_rate = payslip._rule_parameter('l10n_us_wa_pfml_employer_rate') Employer Taxes: NV Career Enhancement Program (CEP) COMPANYNVCEP 176 python result = version.address_id.state_id.code == 'NV' code result = categories['GROSS'] result_rate = payslip._rule_parameter('l10n_us_nv_cep_rate') Employer Taxes: AL ESA COMPANYALESA 176 python result = employee.address_id.state_id.code == 'AL' code taxable = categories['GROSS'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['GROSS'], vals_list=['amount'], compute_sum=True) previous_amounts = line_values['GROSS']['sum']['amount'] cap = payslip._rule_parameter('l10n_us_al_sui_cap') if previous_amounts > cap: result = 0 else: result = min(cap - previous_amounts, taxable) result_rate = payslip._rule_parameter('l10n_us_al_esa_rate') Employer Taxes: CO Support Surcharge COMPANYCOSUPPORT 176 python result = employee.address_id.state_id.code == 'CO' code taxable = categories['TAXABLE'] - result_rules['401K']['total'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['TAXABLE', '401K'], compute_sum=True) already_taxed = line_values['TAXABLE']['sum']['total'] - line_values['401K']['sum']['total'] cap = payslip._rule_parameter('l10n_us_co_sui_cap') if already_taxed > cap: result = 0 else: result = min(cap - already_taxed, taxable) result_rate = payslip._rule_parameter('l10n_us_co_support_surcharge_rate') Employer Taxes: CO Solvency Surcharge COMPANYCOSOLVENCY 176 python result = employee.address_id.state_id.code == 'CO' code taxable = categories['TAXABLE'] - result_rules['401K']['total'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['TAXABLE', '401K'], compute_sum=True) already_taxed = line_values['TAXABLE']['sum']['total'] - line_values['401K']['sum']['total'] cap = payslip._rule_parameter('l10n_us_co_sui_cap') if already_taxed > cap: result = 0 else: result = min(cap - already_taxed, taxable) result_rate = payslip._rule_parameter('l10n_us_co_solvency_surcharge_rate') Employer Taxes: WA Employment Admin Fund COMPANYWAEAF 176 python result = employee.address_id.state_id.code == 'WA' code taxable = categories['TAXABLE'] - result_rules['401K']['total'] year_payslips = version.env['hr.payslip'].search([ ('employee_id', '=', employee.id), ('state', 'in', ['validated', 'paid']), ('date_from', '>=', payslip.date_from + relativedelta(day=1, month=1)), ('date_to', '<=', payslip.date_from + relativedelta(days=-1)), ('company_id', '=', version.company_id.id), ]) line_values = year_payslips._get_line_values(['TAXABLE', '401K'], compute_sum=True) already_taxed = line_values['TAXABLE']['sum']['total'] - line_values['401K']['sum']['total'] cap = payslip._rule_parameter('l10n_us_wa_sui_cap') if already_taxed > cap: result = 0 else: result = min(cap - already_taxed, taxable) result_rate = payslip._rule_parameter('l10n_us_wa_eaf_rate') Employer Taxes: Worker's Compensation COMPANY_WORKER_COMPENSATION 177 python result = version.address_id.state_id.code == 'WA' and version.l10n_us_worker_compensation_id code composite_rate = version.l10n_us_worker_compensation_id.composite_rate payroll_deduction = version.l10n_us_worker_compensation_id.payroll_deduction xp_factor = payslip._rule_parameter('l10n_us_business_experience_factor') result = (composite_rate - payroll_deduction) * payslip.sum_worked_hours * xp_factor Expenses Reimbursement EXPENSES 177 python result = 'EXPENSES' in inputs code result = inputs['EXPENSES'].amount result_name = inputs['EXPENSES'].name Allocated Tips ALLOCATEDTIPS 180 input input Deduction 198 DEDUCTION python result = 'DEDUCTION' in inputs code result = -inputs['DEDUCTION'].amount result_name = inputs['DEDUCTION'].name Reimbursement 199 REIMBURSEMENT python result = 'REIMBURSEMENT' in inputs code result = inputs['REIMBURSEMENT'].amount result_name = inputs['REIMBURSEMENT'].name Net Salary 200 NET none code result = categories['BASIC'] + categories['ALW'] + categories['DED']