[IMP] l10n_us_hr_payroll: Port l10n_us_wy_hr_payroll WY Wyoming including migration.

This commit is contained in:
Bhoomi Vaishnani
2020-05-18 11:26:43 -04:00
parent a7fc00b0f3
commit e868c703fc
6 changed files with 139 additions and 0 deletions

View File

@@ -64,6 +64,7 @@ United States of America - Payroll Rules.
'data/state/tx_texas.xml',
'data/state/va_virginia.xml',
'data/state/wa_washington.xml',
'data/state/wy_wyoming.xml',
'views/hr_contract_views.xml',
'views/us_payroll_config_views.xml',
],

View File

@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- Wage Base -->
<record id="rule_parameter_us_wy_suta_wage_base" model="hr.rule.parameter">
<field name="name">US WY Wyoming SUTA Wage Base</field>
<field name="code">us_wy_suta_wage_base</field>
<field name="country_id" ref="base.us"/>
</record>
<data noupdate="1">
<record id="rule_parameter_us_wy_suta_wage_base_2019" model="hr.rule.parameter.value">
<field name="parameter_value">25400.00</field>
<field name="rule_parameter_id" ref="rule_parameter_us_wy_suta_wage_base"/>
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
</record>
<record id="rule_parameter_us_wy_suta_wage_base_2020" model="hr.rule.parameter.value">
<field name="parameter_value">26400.00</field>
<field name="rule_parameter_id" ref="rule_parameter_us_wy_suta_wage_base"/>
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
</record>
</data>
<!-- Rate -->
<record id="rule_parameter_us_wy_suta_rate" model="hr.rule.parameter">
<field name="name">US WY Wyoming SUTA Rate</field>
<field name="code">us_wy_suta_rate</field>
<field name="country_id" ref="base.us"/>
</record>
<data noupdate="1">
<record id="rule_parameter_us_wy_suta_rate_2019" model="hr.rule.parameter.value">
<field name="parameter_value">2.10</field>
<field name="rule_parameter_id" ref="rule_parameter_us_wy_suta_rate"/>
<field name="date_from" eval="datetime(2019, 1, 1).date()"/>
</record>
<record id="rule_parameter_us_wy_suta_rate_2020" model="hr.rule.parameter.value">
<field name="parameter_value">2.10</field>
<field name="rule_parameter_id" ref="rule_parameter_us_wy_suta_rate"/>
<field name="date_from" eval="datetime(2020, 1, 1).date()"/>
</record>
</data>
<!-- Partners and Contribution Registers -->
<record id="res_partner_us_wy_dor" model="res.partner">
<field name="name">US Wyoming - Department of Workforce Services (WDWS) - Unemployment Tax</field>
</record>
<!-- Rules -->
<record id="hr_payroll_rule_er_us_wy_suta" model="hr.salary.rule">
<field name="sequence" eval="450"/>
<field name="struct_id" ref="hr_payroll_structure"/>
<field name="category_id" ref="hr_payroll_category_er_us_suta"/>
<field name="name">ER: US WY Wyoming State Unemployment</field>
<field name="code">ER_US_WY_SUTA</field>
<field name="condition_select">python</field>
<field name="condition_python">result, _ = general_state_unemployment(payslip, categories, worked_days, inputs, wage_base='us_wy_suta_wage_base', rate='us_wy_suta_rate', state_code='WY')</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_wy_suta_wage_base', rate='us_wy_suta_rate', state_code='WY')</field>
<field name="partner_id" ref="res_partner_us_wy_dor"/>
<field name="appears_on_payslip" eval="False"/>
</record>
</odoo>

View File

@@ -108,3 +108,6 @@ from . import test_us_va_virginia_payslip_2020
from . import test_us_wa_washington_payslip_2019
from . import test_us_wa_washington_payslip_2020
from . import test_us_wy_wyoming_payslip_2019
from . import test_us_wy_wyoming_payslip_2020

View File

@@ -0,0 +1,58 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from datetime import date
from .common import TestUsPayslip, process_payslip
class TestUsWYPayslip(TestUsPayslip):
# TAXES AND RATES
WY_UNEMP_MAX_WAGE = 25400
WY_UNEMP = -2.10 / 100.0
def test_2019_taxes(self):
salary = 15000.00
employee = self._createEmployee()
contract = self._createContract(employee,
wage=salary,
state_id=self.get_us_state('WY'))
self._log('2019 Wyoming tax first payslip:')
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.WY_UNEMP)
process_payslip(payslip)
# Make a new payslip, this one will have maximums
remaining_wy_unemp_wages = self.WY_UNEMP_MAX_WAGE - salary if (self.WY_UNEMP_MAX_WAGE - 2*salary < salary) \
else salary
self._log('2019 Wyoming tax second payslip:')
payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
payslip.compute_sheet()
cats = self._getCategories(payslip)
self.assertPayrollEqual(cats['ER_US_SUTA'], remaining_wy_unemp_wages * self.WY_UNEMP)
def test_2019_taxes_with_external(self):
# Wage is the cap itself, 25400
# so salary is equal to self.WY_UNEMP
salary = 25400
employee = self._createEmployee()
contract = self._createContract(employee,
wage=salary,
state_id=self.get_us_state('WY'))
self._log('2019 Wyoming External tax first payslip:')
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.WY_UNEMP)

View File

@@ -0,0 +1,13 @@
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
from datetime import date
from .common import TestUsPayslip
class TestUsWYPayslip(TestUsPayslip):
# TAXES AND RATES
WY_UNEMP_MAX_WAGE = 26400.00
WY_UNEMP = 2.10
def test_2020_taxes(self):
self._test_er_suta('WY', self.WY_UNEMP, date(2020, 1, 1), wage_base=self.WY_UNEMP_MAX_WAGE)

View File

@@ -256,6 +256,9 @@
<p colspan="2"><h3>No additional fields.</h3></p>
<p colspan="2">Ensure that your Employee and Employer workers' comp code fields are filled in for WA LNI withholding.</p>
</group>
<group name="state_wy_wyoming" string="WY Wyoming" attrs="{'invisible':[('state_id', '!=', %(base.state_us_51)s)]}">
<p colspan="2"><h3>No additional fields.</h3></p>
</group>
</group>
</sheet>
</form>