mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Merge branch 'mig/12.0/l10n_us_hr_payroll__2020' into '12.0-test'
mig/12.0/l10n_us_hr_payroll__2020 into 12.0-test See merge request hibou-io/hibou-odoo/suite!286
This commit is contained in:
@@ -29,6 +29,7 @@ USA Payroll Rules.
|
||||
'data/federal/fed_941_fit_parameters.xml',
|
||||
'data/federal/fed_941_fit_rules.xml',
|
||||
'data/state/ar_arkansas.xml',
|
||||
'data/state/az_arizona.xml',
|
||||
'data/state/fl_florida.xml',
|
||||
'data/state/ga_georgia.xml',
|
||||
'data/state/il_illinois.xml',
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
ref('hr_payroll_rule_er_us_ar_suta'),
|
||||
ref('hr_payroll_rule_ee_us_ar_sit'),
|
||||
|
||||
ref('hr_payroll_rule_er_us_az_suta'),
|
||||
ref('hr_payroll_rule_ee_us_az_sit'),
|
||||
|
||||
ref('hr_payroll_rule_er_us_fl_suta'),
|
||||
|
||||
ref('hr_payroll_rule_er_us_ga_suta'),
|
||||
|
||||
81
l10n_us_hr_payroll/data/state/az_arizona.xml
Normal file
81
l10n_us_hr_payroll/data/state/az_arizona.xml
Normal file
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<!-- Wage Base -->
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_az_suta_wage_base_2019" model="hr.payroll.rate">
|
||||
<field name="name">US AZ Arizona SUTA Wage Base</field>
|
||||
<field name="code">us_az_suta_wage_base</field>
|
||||
<field name="parameter_value">7000.0</field>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_az_suta_wage_base_2020" model="hr.payroll.rate">
|
||||
<field name="name">US AZ Arizona SUTA Wage Base</field>
|
||||
<field name="code">us_az_suta_wage_base</field>
|
||||
<field name="parameter_value">7000.0</field>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Rate -->
|
||||
<data noupdate="1">
|
||||
<record id="rule_parameter_us_az_suta_rate_2019" model="hr.payroll.rate">
|
||||
<field name="name">US AZ Arizona SUTA Rate</field>
|
||||
<field name="code">us_az_suta_rate</field>
|
||||
<field name="parameter_value">2.0</field>
|
||||
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
|
||||
</record>
|
||||
<record id="rule_parameter_us_az_suta_rate_2020" model="hr.payroll.rate">
|
||||
<field name="name">US AZ Arizona SUTA Rate</field>
|
||||
<field name="code">us_az_suta_rate</field>
|
||||
<field name="parameter_value">2.0</field>
|
||||
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
<!-- Partners and Contribution Registers -->
|
||||
<record id="res_partner_us_az_dor" model="res.partner">
|
||||
<field name="name">US Arizona - Department of Economic Security (ADES) - Unemployment Tax</field>
|
||||
</record>
|
||||
<record id="contrib_register_us_az_dor" model="hr.contribution.register">
|
||||
<field name="name">US Arizona - Department of Economic Security (ADES) - Unemployment Tax</field>
|
||||
<field name="partner_id" ref="res_partner_us_az_dor"/>
|
||||
</record>
|
||||
|
||||
<record id="res_partner_us_az_dor_sit" model="res.partner">
|
||||
<field name="name">US Arizona - Department of Revenue (ADOR) - Income Tax</field>
|
||||
</record>
|
||||
<record id="contrib_register_us_az_dor_sit" model="hr.contribution.register">
|
||||
<field name="name">US Arizona - Department of Revenue (ADOR) - Unemployment Tax</field>
|
||||
<field name="partner_id" ref="res_partner_us_az_dor_sit"/>
|
||||
</record>
|
||||
|
||||
<!-- Categories -->
|
||||
|
||||
<!-- Rules -->
|
||||
<record id="hr_payroll_rule_er_us_az_suta" model="hr.salary.rule">
|
||||
<field name="sequence" eval="450"/>
|
||||
<field name="category_id" ref="hr_payroll_category_er_us_suta"/>
|
||||
<field name="name">ER: US AZ Arizona State Unemployment</field>
|
||||
<field name="code">ER_US_AZ_SUTA</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_az_suta_wage_base', rate='us_az_suta_rate', state_code='AZ')</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">result, result_rate = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_az_suta_wage_base', rate='us_az_suta_rate', state_code='AZ')</field>
|
||||
<field name="register_id" ref="contrib_register_us_az_dor"/>
|
||||
<field name="appears_on_payslip" eval="False"/>
|
||||
</record>
|
||||
|
||||
<record id="hr_payroll_rule_ee_us_az_sit" model="hr.salary.rule">
|
||||
<field name="sequence" eval="195"/>
|
||||
<field name="category_id" ref="hr_payroll_category_ee_us_sit"/>
|
||||
<field name="name">EE: US AZ Arizona State Income Tax Withholding</field>
|
||||
<field name="code">EE_US_AZ_SIT</field>
|
||||
<field name="condition_select">python</field>
|
||||
<field name="condition_python">result, _ = az_arizona_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="amount_select">code</field>
|
||||
<field name="amount_python_compute">result, result_rate = az_arizona_state_income_withholding(payslip, categories, worked_days, inputs)</field>
|
||||
<field name="register_id" ref="contrib_register_us_az_dor_sit"/>
|
||||
<field name="appears_on_payslip" eval="True"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -13,6 +13,9 @@ FIELDS_CONTRACT_TO_US_PAYROLL_FORMS_2020 = {
|
||||
'ar_w4_tax_exempt': 'state_income_tax_exempt',
|
||||
'ar_w4_additional_wh': 'state_income_tax_additional_withholding',
|
||||
|
||||
'az_a4_withholding_percentage': 'az_a4_sit_withholding_percentage',
|
||||
'az_a4_additional_withholding': 'state_income_tax_additional_withholding',
|
||||
|
||||
'ga_g4_filing_status': 'ga_g4_sit_filing_status',
|
||||
'ga_g4_dependent_allowances': 'ga_g4_sit_dependent_allowances',
|
||||
'ga_g4_additional_allowances': 'ga_g4_sit_additional_allowances',
|
||||
@@ -81,6 +84,11 @@ XMLIDS_TO_REMOVE_2020 = [
|
||||
'l10n_us_ar_hr_payroll.hr_payroll_ar_income_withhold',
|
||||
'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_unemp_wages',
|
||||
|
||||
'l10n_us_az_hr_payroll.hr_payroll_az_unemp_wages',
|
||||
'l10n_us_az_hr_payroll.hr_payroll_az_unemp',
|
||||
'l10n_us_az_hr_payroll.hr_payroll_az_income_withhold',
|
||||
'l10n_us_az_hr_payroll.hr_payroll_rules_az_unemp_wages',
|
||||
|
||||
'l10n_us_fl_hr_payroll.hr_payroll_fl_unemp_wages',
|
||||
'l10n_us_fl_hr_payroll.hr_payroll_fl_unemp',
|
||||
'l10n_us_fl_hr_payroll.hr_payroll_rules_fl_unemp_wages_2018',
|
||||
@@ -207,6 +215,13 @@ XMLIDS_TO_RENAME_2020 = {
|
||||
'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_ar_suta',
|
||||
'l10n_us_ar_hr_payroll.hr_payroll_rules_ar_inc_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_ar_sit',
|
||||
|
||||
'l10n_us_az_hr_payroll.res_partner_az_des_unemp': 'l10n_us_hr_payroll.res_partner_us_az_dor',
|
||||
'l10n_us_az_hr_payroll.res_partner_az_dor_withhold': 'l10n_us_hr_payroll.res_partner_us_az_dor_sit',
|
||||
'l10n_us_az_hr_payroll.contrib_register_az_des_unemp': 'l10n_us_hr_payroll.contrib_register_us_az_dor',
|
||||
'l10n_us_az_hr_payroll.contrib_register_az_dor_withhold': 'l10n_us_hr_payroll.contrib_register_us_az_dor_sit',
|
||||
'l10n_us_az_hr_payroll.hr_payroll_az_unemp': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_az_suta',
|
||||
'l10n_us_az_hr_payroll.hr_payroll_az_income_withhold': 'l10n_us_hr_payroll.hr_payroll_rule_ee_us_az_sit',
|
||||
|
||||
'l10n_us_fl_hr_payroll.hr_payroll_rules_fl_unemp_2018': 'l10n_us_hr_payroll.hr_payroll_rule_er_us_fl_suta',
|
||||
'l10n_us_fl_hr_payroll.res_partner_fldor': 'l10n_us_hr_payroll.res_partner_us_fl_dor',
|
||||
'l10n_us_fl_hr_payroll.contrib_register_fldor': 'l10n_us_hr_payroll.contrib_register_us_fl_dor',
|
||||
|
||||
@@ -15,6 +15,7 @@ from .state.general import general_state_unemployment, \
|
||||
general_state_income_withholding, \
|
||||
is_us_state
|
||||
from .state.ar_arkansas import ar_arkansas_state_income_withholding
|
||||
from .state.az_arizona import az_arizona_state_income_withholding
|
||||
from .state.ga_georgia import ga_georgia_state_income_withholding
|
||||
from .state.il_illinois import il_illinois_state_income_withholding
|
||||
from .state.mi_michigan import mi_michigan_state_income_withholding
|
||||
@@ -61,6 +62,7 @@ class HRPayslip(models.Model):
|
||||
'general_state_income_withholding': general_state_income_withholding,
|
||||
'is_us_state': is_us_state,
|
||||
'ar_arkansas_state_income_withholding': ar_arkansas_state_income_withholding,
|
||||
'az_arizona_state_income_withholding': az_arizona_state_income_withholding,
|
||||
'ga_georgia_state_income_withholding': ga_georgia_state_income_withholding,
|
||||
'il_illinois_state_income_withholding': il_illinois_state_income_withholding,
|
||||
'mi_michigan_state_income_withholding': mi_michigan_state_income_withholding,
|
||||
|
||||
35
l10n_us_hr_payroll/models/state/az_arizona.py
Normal file
35
l10n_us_hr_payroll/models/state/az_arizona.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from .general import _state_applies, sit_wage
|
||||
|
||||
|
||||
def az_arizona_state_income_withholding(payslip, categories, worked_days, inputs):
|
||||
"""
|
||||
Returns SIT eligible wage and rate.
|
||||
WAGE = GROSS + DED_FIT_EXEMPT
|
||||
|
||||
:return: result, result_rate (wage, percent)
|
||||
"""
|
||||
state_code = 'AZ'
|
||||
if not _state_applies(payslip, state_code):
|
||||
return 0.0, 0.0
|
||||
|
||||
# Determine Wage
|
||||
wage = sit_wage(payslip, categories)
|
||||
if not wage:
|
||||
return 0.0, 0.0
|
||||
|
||||
schedule_pay = payslip.dict.contract_id.schedule_pay
|
||||
additional = payslip.dict.contract_id.us_payroll_config_value('state_income_tax_additional_withholding')
|
||||
withholding_percent = payslip.dict.contract_id.us_payroll_config_value('az_a4_sit_withholding_percentage')
|
||||
|
||||
if withholding_percent <= 0.0:
|
||||
return 0.0, 0.0
|
||||
|
||||
wh_percentage = withholding_percent / 100.0
|
||||
withholding = wage * wh_percentage
|
||||
|
||||
if withholding < 0.0:
|
||||
withholding = 0.0
|
||||
withholding += additional
|
||||
return wage, -((withholding / wage) * 100.0)
|
||||
@@ -53,6 +53,10 @@ class HRContractUSPayrollConfig(models.Model):
|
||||
|
||||
ar_ar4ec_sit_allowances = fields.Integer(string='Arkansas AR4EC allowances', help='AR4EC 3.')
|
||||
|
||||
az_a4_sit_withholding_percentage = fields.Float(
|
||||
string='Arizona A-4 Withholding Percentage',
|
||||
help='A-4 1. (0.8 or 1.3 or 1.8 or 2.7 or 3.6 or 4.2 or 5.1 or 0 for exempt.')
|
||||
|
||||
ga_g4_sit_filing_status = fields.Selection([
|
||||
('exempt', 'Exempt'),
|
||||
('single', 'Single'),
|
||||
|
||||
@@ -7,6 +7,9 @@ from . import test_us_payslip_2020
|
||||
from . import test_us_ar_arkansas_payslip_2019
|
||||
from . import test_us_ar_arkansas_payslip_2020
|
||||
|
||||
from . import test_us_az_arizona_payslip_2019
|
||||
from . import test_us_az_arizona_payslip_2020
|
||||
|
||||
from . import test_us_fl_florida_payslip_2019
|
||||
from . import test_us_fl_florida_payslip_2020
|
||||
|
||||
|
||||
72
l10n_us_hr_payroll/tests/test_us_az_arizona_payslip_2019.py
Normal file
72
l10n_us_hr_payroll/tests/test_us_az_arizona_payslip_2019.py
Normal file
@@ -0,0 +1,72 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from .common import TestUsPayslip, process_payslip
|
||||
|
||||
|
||||
class TestUsAZPayslip(TestUsPayslip):
|
||||
|
||||
# TAXES AND RATES
|
||||
AZ_UNEMP_MAX_WAGE = 7000.00
|
||||
AZ_UNEMP = -(2.00 / 100.0)
|
||||
|
||||
def test_taxes_with_additional_wh(self):
|
||||
salary = 15000.00
|
||||
schedule_pay = 'weekly'
|
||||
withholding_percentage = 5.1
|
||||
percent_wh = (5.10 / 100) # 5.1%
|
||||
additional_wh = 12.50
|
||||
|
||||
wh_to_test = -((percent_wh * salary) + additional_wh)
|
||||
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=salary,
|
||||
state_id=self.get_us_state('AZ'),
|
||||
state_income_tax_additional_withholding=12.50,
|
||||
az_a4_sit_withholding_percentage=withholding_percentage,
|
||||
schedule_pay=schedule_pay)
|
||||
|
||||
self._log('2019 Arizona tax first payslip weekly:')
|
||||
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||
payslip.compute_sheet()
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['ER_US_SUTA'], self.AZ_UNEMP_MAX_WAGE * self.AZ_UNEMP)
|
||||
self.assertPayrollEqual(cats['EE_US_SIT'], wh_to_test)
|
||||
|
||||
process_payslip(payslip)
|
||||
|
||||
remaining_AZ_UNEMP_wages = 0.0 # We already reached max unemployment wages.
|
||||
|
||||
self._log('2019 Arizona tax second payslip weekly:')
|
||||
payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
|
||||
payslip.compute_sheet()
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_AZ_UNEMP_wages * self.AZ_UNEMP)
|
||||
|
||||
def test_taxes_monthly(self):
|
||||
salary = 1000.00
|
||||
schedule_pay = 'monthly'
|
||||
withholding_percentage = 2.7
|
||||
percent_wh = (2.70 / 100) # 2.7%
|
||||
additional_wh = 0.0
|
||||
wh_to_test = -((percent_wh * salary) + additional_wh)
|
||||
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=salary,
|
||||
state_id=self.get_us_state('AZ'),
|
||||
state_income_tax_additional_withholding=0.0,
|
||||
az_a4_sit_withholding_percentage=withholding_percentage,
|
||||
schedule_pay=schedule_pay)
|
||||
|
||||
self._log('2019 Arizona tax first payslip monthly:')
|
||||
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||
payslip.compute_sheet()
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self.assertPayrollEqual(cats['ER_US_SUTA'], salary * self.AZ_UNEMP)
|
||||
self.assertPayrollEqual(cats['EE_US_SIT'], wh_to_test)
|
||||
|
||||
process_payslip(payslip)
|
||||
33
l10n_us_hr_payroll/tests/test_us_az_arizona_payslip_2020.py
Normal file
33
l10n_us_hr_payroll/tests/test_us_az_arizona_payslip_2020.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
||||
|
||||
from datetime import date, timedelta
|
||||
from .common import TestUsPayslip
|
||||
|
||||
|
||||
class TestUsAZPayslip(TestUsPayslip):
|
||||
# Taxes and Rates
|
||||
AZ_UNEMP_MAX_WAGE = 7000.0
|
||||
AZ_UNEMP = 2.0
|
||||
|
||||
def _test_sit(self, wage, additional_withholding, withholding_percent, schedule_pay, date_start, expected_withholding):
|
||||
|
||||
employee = self._createEmployee()
|
||||
contract = self._createContract(employee,
|
||||
wage=wage,
|
||||
state_id=self.get_us_state('AZ'),
|
||||
state_income_tax_additional_withholding=additional_withholding,
|
||||
az_a4_sit_withholding_percentage=withholding_percent,
|
||||
schedule_pay=schedule_pay)
|
||||
payslip = self._createPayslip(employee, date_start, date_start + timedelta(days=7))
|
||||
payslip.compute_sheet()
|
||||
cats = self._getCategories(payslip)
|
||||
|
||||
self._log('Computed period tax: ' + str(expected_withholding))
|
||||
self.assertPayrollEqual(cats.get('EE_US_SIT', 0.0), -expected_withholding)
|
||||
|
||||
def test_2020_taxes_example(self):
|
||||
self._test_er_suta('AZ', self.AZ_UNEMP, date(2020, 1, 1), wage_base=self.AZ_UNEMP_MAX_WAGE)
|
||||
self._test_sit(1000.0, 0.0, 2.70, 'monthly', date(2020, 1, 1), 27.0)
|
||||
self._test_sit(1000.0, 10.0, 2.70, 'monthly', date(2020, 1, 1), 37.0)
|
||||
self._test_sit(15000.0, 0.0, 3.60, 'weekly', date(2020, 1, 1), 540.0)
|
||||
self._test_sit(8000.0, 0.0, 4.20, 'semi-monthly', date(2020, 1, 1), 336.0)
|
||||
@@ -50,6 +50,11 @@
|
||||
<field name="state_income_tax_additional_withholding" string="Additional Withholding 4."/>
|
||||
<field name="state_income_tax_exempt" string="Exempt 1. 2."/>
|
||||
</group>
|
||||
<group name="state_az_arizona" string="AZ Arizona" attrs="{'invisible':[('state_id', '!=', %(base.state_us_3)s)]}">
|
||||
<p colspan="2"><h3>Form A-4 - State Income Tax</h3></p>
|
||||
<field name="az_a4_sit_withholding_percentage" string="Withholding Percentage 1."/>
|
||||
<field name="state_income_tax_additional_withholding" string="Additional Withholding 2."/>
|
||||
</group>
|
||||
<group name="state_fl_florida" string="FL Florida" attrs="{'invisible':[('state_id', '!=', %(base.state_us_10)s)]}">
|
||||
<p colspan="2"><h3>No additional fields.</h3></p>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user