mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Adding all from 11.0 https://github.com/hibou-io/odoo-hr-payroll
hr_payroll_holidays hr_payroll_input_name_report hr_payroll_input_report hr_payroll_payment hr_payroll_timesheet hr_payslip_line_date l10n_us_fl_hr_payroll l10n_us_hr_payroll l10n_us_mo_hr_payroll l10n_us_oh_hr_payroll l10n_us_va_hr_payroll
This commit is contained in:
3
l10n_us_fl_hr_payroll/__init__.py
Executable file
3
l10n_us_fl_hr_payroll/__init__.py
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import us_fl_hr_payroll
|
||||||
29
l10n_us_fl_hr_payroll/__manifest__.py
Executable file
29
l10n_us_fl_hr_payroll/__manifest__.py
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
{
|
||||||
|
'name': 'USA - Florida - Payroll',
|
||||||
|
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'category': 'Localization',
|
||||||
|
'depends': ['l10n_us_hr_payroll'],
|
||||||
|
'version': '11.0.2017.0.0',
|
||||||
|
'description': """
|
||||||
|
USA::Florida Payroll Rules.
|
||||||
|
===========================
|
||||||
|
|
||||||
|
* Florida Department of Revenue partner
|
||||||
|
* Contribution register for Florida DoR
|
||||||
|
* Company level Florida Unemployment Rate
|
||||||
|
""",
|
||||||
|
|
||||||
|
'auto_install': False,
|
||||||
|
'website': 'https://hibou.io/',
|
||||||
|
'data':[
|
||||||
|
'us_fl_hr_payroll_view.xml',
|
||||||
|
'data/base.xml',
|
||||||
|
'data/rules_2016.xml',
|
||||||
|
'data/rules_2017.xml',
|
||||||
|
'data/rules_2018.xml',
|
||||||
|
'data/final.xml',
|
||||||
|
],
|
||||||
|
'installable': True
|
||||||
|
}
|
||||||
31
l10n_us_fl_hr_payroll/data/base.xml
Executable file
31
l10n_us_fl_hr_payroll/data/base.xml
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<!-- CONTRIBUTION REGISTERS -->
|
||||||
|
<record id="res_partner_fldor" model="res.partner">
|
||||||
|
<field name="name">Florida Department of Revenue</field>
|
||||||
|
<field name="supplier">1</field>
|
||||||
|
<field eval="0" name="customer"/>
|
||||||
|
</record>
|
||||||
|
<record id="contrib_register_fldor" model="hr.contribution.register">
|
||||||
|
<field name="name">Florida Unemployment</field>
|
||||||
|
<field name="note">Florida Department of Revenue - Unemployment</field>
|
||||||
|
<field name="partner_id" ref="res_partner_fldor"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- HR SALARY RULE CATEGORIES-->
|
||||||
|
<record id="hr_payroll_fl_unemp_wages" model="hr.salary.rule.category">
|
||||||
|
<field name="name">Florida Unemployment - Wages</field>
|
||||||
|
<field name="code">FL_UNEMP_WAGES</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="hr_payroll_fl_unemp" model="hr.salary.rule.category">
|
||||||
|
<field name="name">Florida Unemployment</field>
|
||||||
|
<field name="code">FL_UNEMP</field>
|
||||||
|
<field name="parent_id" ref="hr_payroll.COMP"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
24
l10n_us_fl_hr_payroll/data/final.xml
Executable file
24
l10n_us_fl_hr_payroll/data/final.xml
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<!-- HR PAYROLL STRUCTURE -->
|
||||||
|
<record id="hr_payroll_salary_structure_us_fl_employee" model="hr.payroll.structure">
|
||||||
|
<field name="code">US_FL_EMP</field>
|
||||||
|
<field name="name">USA Florida Employee</field>
|
||||||
|
<field eval="[(6, 0, [
|
||||||
|
ref('hr_payroll_rules_fl_unemp_wages_2016'),
|
||||||
|
ref('hr_payroll_rules_fl_unemp_2016'),
|
||||||
|
|
||||||
|
ref('hr_payroll_rules_fl_unemp_wages_2017'),
|
||||||
|
ref('hr_payroll_rules_fl_unemp_2017'),
|
||||||
|
|
||||||
|
ref('hr_payroll_rules_fl_unemp_wages_2018'),
|
||||||
|
ref('hr_payroll_rules_fl_unemp_2018'),
|
||||||
|
])]" name="rule_ids"/>
|
||||||
|
<field name="company_id" ref="base.main_company"/>
|
||||||
|
<field name="parent_id" ref="l10n_us_hr_payroll.hr_payroll_salary_structure_us_employee"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
49
l10n_us_fl_hr_payroll/data/rules_2016.xml
Executable file
49
l10n_us_fl_hr_payroll/data/rules_2016.xml
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<!-- HR SALARY RULES-->
|
||||||
|
<record id="hr_payroll_rules_fl_unemp_wages_2016" model="hr.salary.rule">
|
||||||
|
<field name="sequence" eval="423"/>
|
||||||
|
<field name="category_id" ref="hr_payroll_fl_unemp_wages"/>
|
||||||
|
<field name="name">Florida Unemployment - Wages (2016)</field>
|
||||||
|
<field name="code">FL_UNEMP_WAGES_2016</field>
|
||||||
|
<field name="condition_select">python</field>
|
||||||
|
<field name="condition_python">result = (payslip.date_to[:4] == '2016')</field>
|
||||||
|
<field name="amount_select">code</field>
|
||||||
|
<field name="amount_python_compute">
|
||||||
|
###
|
||||||
|
ytd = payslip.sum('FL_UNEMP_WAGES_2016', '2016-01-01', '2017-01-01')
|
||||||
|
ytd += contract.external_wages
|
||||||
|
remaining = 7000.0 - ytd
|
||||||
|
if remaining <= 0.0:
|
||||||
|
result = 0
|
||||||
|
elif remaining < categories.GROSS:
|
||||||
|
result = remaining
|
||||||
|
else:
|
||||||
|
result = categories.GROSS
|
||||||
|
</field>
|
||||||
|
<field name="appears_on_payslip" eval="False"/>
|
||||||
|
</record>
|
||||||
|
<record id="hr_payroll_rules_fl_unemp_2016" model="hr.salary.rule">
|
||||||
|
<field name="sequence" eval="443"/>
|
||||||
|
<field name="category_id" ref="hr_payroll_fl_unemp"/>
|
||||||
|
<field name="name">Florida Unemployment (2016)</field>
|
||||||
|
<field name="code">FL_UNEMP_2016</field>
|
||||||
|
<field name="condition_select">python</field>
|
||||||
|
<field name="condition_python">result = (payslip.date_to[:4] == '2016')</field>
|
||||||
|
<field name="amount_select">code</field>
|
||||||
|
<field name="amount_python_compute">
|
||||||
|
result_rate = -contract.fl_unemp_rate(2016)
|
||||||
|
result = categories.FL_UNEMP_WAGES
|
||||||
|
|
||||||
|
# result_rate of 0 implies 100% due to bug
|
||||||
|
if result_rate == 0.0:
|
||||||
|
result = 0.0
|
||||||
|
</field>
|
||||||
|
<field name="register_id" ref="contrib_register_fldor"/>
|
||||||
|
<field name="appears_on_payslip" eval="False"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
49
l10n_us_fl_hr_payroll/data/rules_2017.xml
Executable file
49
l10n_us_fl_hr_payroll/data/rules_2017.xml
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<!-- HR SALARY RULES-->
|
||||||
|
<record id="hr_payroll_rules_fl_unemp_wages_2017" model="hr.salary.rule">
|
||||||
|
<field name="sequence" eval="423"/>
|
||||||
|
<field name="category_id" ref="hr_payroll_fl_unemp_wages"/>
|
||||||
|
<field name="name">Florida Unemployment - Wages (2017)</field>
|
||||||
|
<field name="code">FL_UNEMP_WAGES_2017</field>
|
||||||
|
<field name="condition_select">python</field>
|
||||||
|
<field name="condition_python">result = (payslip.date_to[:4] == '2017')</field>
|
||||||
|
<field name="amount_select">code</field>
|
||||||
|
<field name="amount_python_compute">
|
||||||
|
###
|
||||||
|
ytd = payslip.sum('FL_UNEMP_WAGES_2017', '2017-01-01', '2018-01-01')
|
||||||
|
ytd += contract.external_wages
|
||||||
|
remaining = 7000.0 - ytd
|
||||||
|
if remaining <= 0.0:
|
||||||
|
result = 0
|
||||||
|
elif remaining < categories.GROSS:
|
||||||
|
result = remaining
|
||||||
|
else:
|
||||||
|
result = categories.GROSS
|
||||||
|
</field>
|
||||||
|
<field name="appears_on_payslip" eval="False"/>
|
||||||
|
</record>
|
||||||
|
<record id="hr_payroll_rules_fl_unemp_2017" model="hr.salary.rule">
|
||||||
|
<field name="sequence" eval="443"/>
|
||||||
|
<field name="category_id" ref="hr_payroll_fl_unemp"/>
|
||||||
|
<field name="name">Florida Unemployment (2017)</field>
|
||||||
|
<field name="code">FL_UNEMP_2017</field>
|
||||||
|
<field name="condition_select">python</field>
|
||||||
|
<field name="condition_python">result = (payslip.date_to[:4] == '2017')</field>
|
||||||
|
<field name="amount_select">code</field>
|
||||||
|
<field name="amount_python_compute">
|
||||||
|
result_rate = -contract.fl_unemp_rate(2017)
|
||||||
|
result = categories.FL_UNEMP_WAGES
|
||||||
|
|
||||||
|
# result_rate of 0 implies 100% due to bug
|
||||||
|
if result_rate == 0.0:
|
||||||
|
result = 0.0
|
||||||
|
</field>
|
||||||
|
<field name="register_id" ref="contrib_register_fldor"/>
|
||||||
|
<field name="appears_on_payslip" eval="False"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
49
l10n_us_fl_hr_payroll/data/rules_2018.xml
Executable file
49
l10n_us_fl_hr_payroll/data/rules_2018.xml
Executable file
@@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<!-- HR SALARY RULES-->
|
||||||
|
<record id="hr_payroll_rules_fl_unemp_wages_2018" model="hr.salary.rule">
|
||||||
|
<field name="sequence" eval="423"/>
|
||||||
|
<field name="category_id" ref="hr_payroll_fl_unemp_wages"/>
|
||||||
|
<field name="name">Florida Unemployment - Wages (2018)</field>
|
||||||
|
<field name="code">FL_UNEMP_WAGES_2018</field>
|
||||||
|
<field name="condition_select">python</field>
|
||||||
|
<field name="condition_python">result = (payslip.date_to[:4] == '2018')</field>
|
||||||
|
<field name="amount_select">code</field>
|
||||||
|
<field name="amount_python_compute">
|
||||||
|
###
|
||||||
|
ytd = payslip.sum('FL_UNEMP_WAGES_2018', '2018-01-01', '2019-01-01')
|
||||||
|
ytd += contract.external_wages
|
||||||
|
remaining = 7000.0 - ytd
|
||||||
|
if remaining <= 0.0:
|
||||||
|
result = 0
|
||||||
|
elif remaining < categories.GROSS:
|
||||||
|
result = remaining
|
||||||
|
else:
|
||||||
|
result = categories.GROSS
|
||||||
|
</field>
|
||||||
|
<field name="appears_on_payslip" eval="False"/>
|
||||||
|
</record>
|
||||||
|
<record id="hr_payroll_rules_fl_unemp_2018" model="hr.salary.rule">
|
||||||
|
<field name="sequence" eval="443"/>
|
||||||
|
<field name="category_id" ref="hr_payroll_fl_unemp"/>
|
||||||
|
<field name="name">Florida Unemployment (2018)</field>
|
||||||
|
<field name="code">FL_UNEMP_2018</field>
|
||||||
|
<field name="condition_select">python</field>
|
||||||
|
<field name="condition_python">result = (payslip.date_to[:4] == '2018')</field>
|
||||||
|
<field name="amount_select">code</field>
|
||||||
|
<field name="amount_python_compute">
|
||||||
|
result_rate = -contract.fl_unemp_rate(2018)
|
||||||
|
result = categories.FL_UNEMP_WAGES
|
||||||
|
|
||||||
|
# result_rate of 0 implies 100% due to bug
|
||||||
|
if result_rate == 0.0:
|
||||||
|
result = 0.0
|
||||||
|
</field>
|
||||||
|
<field name="register_id" ref="contrib_register_fldor"/>
|
||||||
|
<field name="appears_on_payslip" eval="False"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
5
l10n_us_fl_hr_payroll/tests/__init__.py
Executable file
5
l10n_us_fl_hr_payroll/tests/__init__.py
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import test_us_fl_payslip_2016
|
||||||
|
from . import test_us_fl_payslip_2017
|
||||||
|
from . import test_us_fl_payslip_2018
|
||||||
104
l10n_us_fl_hr_payroll/tests/test_us_fl_payslip_2016.py
Executable file
104
l10n_us_fl_hr_payroll/tests/test_us_fl_payslip_2016.py
Executable file
@@ -0,0 +1,104 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from odoo.addons.l10n_us_hr_payroll.tests.test_us_payslip import TestUsPayslip, process_payslip
|
||||||
|
from odoo.addons.l10n_us_hr_payroll.l10n_us_hr_payroll import USHrContract
|
||||||
|
|
||||||
|
|
||||||
|
class TestUsFlPayslip(TestUsPayslip):
|
||||||
|
###
|
||||||
|
# 2016 Taxes and Rates
|
||||||
|
###
|
||||||
|
|
||||||
|
def test_2016_taxes(self):
|
||||||
|
salary = 5000.0;
|
||||||
|
|
||||||
|
## tax maximums
|
||||||
|
FL_UNEMP_MAX_WAGE = 7000.0
|
||||||
|
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
employee.company_id.fl_unemp_rate_2016 = 2.7
|
||||||
|
|
||||||
|
contract = self._createContract(employee, salary, struct_id=self.ref('l10n_us_fl_hr_payroll.hr_payroll_salary_structure_us_fl_employee'))
|
||||||
|
|
||||||
|
## tax rates
|
||||||
|
FL_UNEMP = contract.fl_unemp_rate(2016) / -100.0
|
||||||
|
|
||||||
|
self._log('2016 Florida tax first payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2016-01-01', '2016-01-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], salary)
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP'], cats['FL_UNEMP_WAGES'] * FL_UNEMP)
|
||||||
|
|
||||||
|
process_payslip(payslip)
|
||||||
|
|
||||||
|
# Make a new payslip, this one will have maximums
|
||||||
|
|
||||||
|
remaining_fl_unemp_wages = FL_UNEMP_MAX_WAGE - salary if (FL_UNEMP_MAX_WAGE - 2*salary < salary) else salary
|
||||||
|
|
||||||
|
self._log('2016 Florida tax second payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2016-02-01', '2016-02-29') # 2016 is a leap year
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], remaining_fl_unemp_wages)
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP'], remaining_fl_unemp_wages * FL_UNEMP)
|
||||||
|
|
||||||
|
|
||||||
|
def test_2016_taxes_with_external(self):
|
||||||
|
salary = 5000.0;
|
||||||
|
external_wages = 6000.0
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
employee.company_id.fl_unemp_rate_2016 = 2.7
|
||||||
|
|
||||||
|
contract = self._createContract(employee, salary, external_wages=external_wages, struct_id=self.ref('l10n_us_fl_hr_payroll.hr_payroll_salary_structure_us_fl_employee'))
|
||||||
|
## tax maximums
|
||||||
|
FL_UNEMP_MAX_WAGE = 7000.0
|
||||||
|
|
||||||
|
## tax rates
|
||||||
|
FL_UNEMP = contract.fl_unemp_rate(2016) / -100.0
|
||||||
|
|
||||||
|
self._log('2016 Forida_external tax first payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2016-01-01', '2016-01-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], FL_UNEMP_MAX_WAGE - external_wages)
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP'], cats['FL_UNEMP_WAGES'] * FL_UNEMP)
|
||||||
|
|
||||||
|
|
||||||
|
def test_2016_taxes_with_state_exempt(self):
|
||||||
|
salary = 5000.0;
|
||||||
|
external_wages = 6000.0
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
employee.company_id.fl_unemp_rate_2016 = 2.7
|
||||||
|
|
||||||
|
contract = self._createContract(employee, salary, external_wages=external_wages, struct_id=self.ref(
|
||||||
|
'l10n_us_fl_hr_payroll.hr_payroll_salary_structure_us_fl_employee'), futa_type=USHrContract.FUTA_TYPE_BASIC)
|
||||||
|
## tax maximums
|
||||||
|
FL_UNEMP_MAX_WAGE = 7000.0
|
||||||
|
|
||||||
|
## tax rates
|
||||||
|
FL_UNEMP = contract.fl_unemp_rate(2016) / -100.0
|
||||||
|
|
||||||
|
self.assertPayrollEqual(FL_UNEMP, 0.0)
|
||||||
|
|
||||||
|
self._log('2016 Forida_external tax first payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2016-01-01', '2016-01-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], FL_UNEMP_MAX_WAGE - external_wages)
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP'], cats['FL_UNEMP_WAGES'] * FL_UNEMP)
|
||||||
97
l10n_us_fl_hr_payroll/tests/test_us_fl_payslip_2017.py
Executable file
97
l10n_us_fl_hr_payroll/tests/test_us_fl_payslip_2017.py
Executable file
@@ -0,0 +1,97 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from odoo.addons.l10n_us_hr_payroll.tests.test_us_payslip import TestUsPayslip, process_payslip
|
||||||
|
from odoo.addons.l10n_us_hr_payroll.l10n_us_hr_payroll import USHrContract
|
||||||
|
|
||||||
|
|
||||||
|
class TestUsFlPayslip(TestUsPayslip):
|
||||||
|
###
|
||||||
|
# 2017 Taxes and Rates
|
||||||
|
###
|
||||||
|
FL_UNEMP_MAX_WAGE = 7000.0
|
||||||
|
|
||||||
|
def test_2017_taxes(self):
|
||||||
|
salary = 5000.0
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
employee.company_id.fl_unemp_rate_2017 = 2.7
|
||||||
|
|
||||||
|
contract = self._createContract(employee, salary, struct_id=self.ref('l10n_us_fl_hr_payroll.hr_payroll_salary_structure_us_fl_employee'))
|
||||||
|
|
||||||
|
# tax rates
|
||||||
|
fl_unemp = contract.fl_unemp_rate(2017) / -100.0
|
||||||
|
|
||||||
|
self._log('2017 Florida tax first payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2017-01-01', '2017-01-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], salary)
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP'], cats['FL_UNEMP_WAGES'] * fl_unemp)
|
||||||
|
|
||||||
|
process_payslip(payslip)
|
||||||
|
|
||||||
|
# Make a new payslip, this one will have maximums
|
||||||
|
|
||||||
|
remaining_fl_unemp_wages = self.FL_UNEMP_MAX_WAGE - salary if (self.FL_UNEMP_MAX_WAGE - 2*salary < salary) \
|
||||||
|
else salary
|
||||||
|
|
||||||
|
self._log('2017 Florida tax second payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2017-02-01', '2017-02-28')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], remaining_fl_unemp_wages)
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP'], remaining_fl_unemp_wages * fl_unemp)
|
||||||
|
|
||||||
|
def test_2017_taxes_with_external(self):
|
||||||
|
salary = 5000.0
|
||||||
|
external_wages = 6000.0
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
employee.company_id.fl_unemp_rate_2017 = 2.7
|
||||||
|
|
||||||
|
contract = self._createContract(employee, salary, external_wages=external_wages,
|
||||||
|
struct_id=self.ref('l10n_us_fl_hr_payroll.hr_payroll_salary_structure_us_fl_employee'))
|
||||||
|
|
||||||
|
# tax rates
|
||||||
|
fl_unemp = contract.fl_unemp_rate(2017) / -100.0
|
||||||
|
|
||||||
|
self._log('2017 Forida_external tax first payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2017-01-01', '2017-01-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], self.FL_UNEMP_MAX_WAGE - external_wages)
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP'], cats['FL_UNEMP_WAGES'] * fl_unemp)
|
||||||
|
|
||||||
|
def test_2017_taxes_with_state_exempt(self):
|
||||||
|
salary = 5000.0
|
||||||
|
external_wages = 6000.0
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
employee.company_id.fl_unemp_rate_2017 = 2.7
|
||||||
|
|
||||||
|
contract = self._createContract(employee, salary, external_wages=external_wages, struct_id=self.ref(
|
||||||
|
'l10n_us_fl_hr_payroll.hr_payroll_salary_structure_us_fl_employee'), futa_type=USHrContract.FUTA_TYPE_BASIC)
|
||||||
|
|
||||||
|
# tax rates
|
||||||
|
fl_unemp = contract.fl_unemp_rate(2017) / -100.0
|
||||||
|
|
||||||
|
self.assertPayrollEqual(fl_unemp, 0.0)
|
||||||
|
|
||||||
|
self._log('2017 Forida_external tax first payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2017-01-01', '2017-01-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], self.FL_UNEMP_MAX_WAGE - external_wages)
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP'], cats['FL_UNEMP_WAGES'] * fl_unemp)
|
||||||
97
l10n_us_fl_hr_payroll/tests/test_us_fl_payslip_2018.py
Executable file
97
l10n_us_fl_hr_payroll/tests/test_us_fl_payslip_2018.py
Executable file
@@ -0,0 +1,97 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from odoo.addons.l10n_us_hr_payroll.tests.test_us_payslip import TestUsPayslip, process_payslip
|
||||||
|
from odoo.addons.l10n_us_hr_payroll.l10n_us_hr_payroll import USHrContract
|
||||||
|
|
||||||
|
|
||||||
|
class TestUsFlPayslip(TestUsPayslip):
|
||||||
|
###
|
||||||
|
# 2018 Taxes and Rates
|
||||||
|
###
|
||||||
|
FL_UNEMP_MAX_WAGE = 7000.0
|
||||||
|
|
||||||
|
def test_2018_taxes(self):
|
||||||
|
salary = 5000.0
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
employee.company_id.fl_unemp_rate_2018 = 2.7
|
||||||
|
|
||||||
|
contract = self._createContract(employee, salary, struct_id=self.ref('l10n_us_fl_hr_payroll.hr_payroll_salary_structure_us_fl_employee'))
|
||||||
|
|
||||||
|
# tax rates
|
||||||
|
fl_unemp = contract.fl_unemp_rate(2018) / -100.0
|
||||||
|
|
||||||
|
self._log('2018 Florida tax first payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], salary)
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP'], cats['FL_UNEMP_WAGES'] * fl_unemp)
|
||||||
|
|
||||||
|
process_payslip(payslip)
|
||||||
|
|
||||||
|
# Make a new payslip, this one will have maximums
|
||||||
|
|
||||||
|
remaining_fl_unemp_wages = self.FL_UNEMP_MAX_WAGE - salary if (self.FL_UNEMP_MAX_WAGE - 2*salary < salary) \
|
||||||
|
else salary
|
||||||
|
|
||||||
|
self._log('2018 Florida tax second payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2018-02-01', '2018-02-28')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], remaining_fl_unemp_wages)
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP'], remaining_fl_unemp_wages * fl_unemp)
|
||||||
|
|
||||||
|
def test_2018_taxes_with_external(self):
|
||||||
|
salary = 5000.0
|
||||||
|
external_wages = 6000.0
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
employee.company_id.fl_unemp_rate_2018 = 2.7
|
||||||
|
|
||||||
|
contract = self._createContract(employee, salary, external_wages=external_wages,
|
||||||
|
struct_id=self.ref('l10n_us_fl_hr_payroll.hr_payroll_salary_structure_us_fl_employee'))
|
||||||
|
|
||||||
|
# tax rates
|
||||||
|
fl_unemp = contract.fl_unemp_rate(2018) / -100.0
|
||||||
|
|
||||||
|
self._log('2018 Forida_external tax first payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], self.FL_UNEMP_MAX_WAGE - external_wages)
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP'], cats['FL_UNEMP_WAGES'] * fl_unemp)
|
||||||
|
|
||||||
|
def test_2018_taxes_with_state_exempt(self):
|
||||||
|
salary = 5000.0
|
||||||
|
external_wages = 6000.0
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
employee.company_id.fl_unemp_rate_2018 = 2.7
|
||||||
|
|
||||||
|
contract = self._createContract(employee, salary, external_wages=external_wages, struct_id=self.ref(
|
||||||
|
'l10n_us_fl_hr_payroll.hr_payroll_salary_structure_us_fl_employee'), futa_type=USHrContract.FUTA_TYPE_BASIC)
|
||||||
|
|
||||||
|
# tax rates
|
||||||
|
fl_unemp = contract.fl_unemp_rate(2018) / -100.0
|
||||||
|
|
||||||
|
self.assertPayrollEqual(fl_unemp, 0.0)
|
||||||
|
|
||||||
|
self._log('2018 Forida_external tax first payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], self.FL_UNEMP_MAX_WAGE - external_wages)
|
||||||
|
self.assertPayrollEqual(cats['FL_UNEMP'], cats['FL_UNEMP_WAGES'] * fl_unemp)
|
||||||
25
l10n_us_fl_hr_payroll/us_fl_hr_payroll.py
Executable file
25
l10n_us_fl_hr_payroll/us_fl_hr_payroll.py
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
from odoo import models, fields, api
|
||||||
|
|
||||||
|
|
||||||
|
class USFLHrContract(models.Model):
|
||||||
|
_inherit = 'hr.contract'
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def fl_unemp_rate(self, year):
|
||||||
|
self.ensure_one()
|
||||||
|
if self.futa_type == self.FUTA_TYPE_BASIC:
|
||||||
|
return 0.0
|
||||||
|
|
||||||
|
if hasattr(self.employee_id.company_id, 'fl_unemp_rate_' + str(year)):
|
||||||
|
return self.employee_id.company_id['fl_unemp_rate_' + str(year)]
|
||||||
|
|
||||||
|
raise NotImplemented('Year (' + str(year) + ') Not implemented for US Florida.')
|
||||||
|
|
||||||
|
|
||||||
|
class FLCompany(models.Model):
|
||||||
|
_inherit = 'res.company'
|
||||||
|
|
||||||
|
# Defaults from :: http://floridarevenue.com/dor/taxes/reemployment.html
|
||||||
|
fl_unemp_rate_2016 = fields.Float(string="Florida Unemployment Rate 2016", default=2.7)
|
||||||
|
fl_unemp_rate_2017 = fields.Float(string="Florida Unemployment Rate 2017", default=2.7)
|
||||||
|
fl_unemp_rate_2018 = fields.Float(string="Florida Unemployment Rate 2018", default=2.7)
|
||||||
20
l10n_us_fl_hr_payroll/us_fl_hr_payroll_view.xml
Executable file
20
l10n_us_fl_hr_payroll/us_fl_hr_payroll_view.xml
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<record id="us_fl_view_company_form" model="ir.ui.view">
|
||||||
|
<field name="name">res.company.form</field>
|
||||||
|
<field name="model">res.company</field>
|
||||||
|
<field name="priority">20</field>
|
||||||
|
<field name="inherit_id" ref="base.view_company_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<data>
|
||||||
|
<xpath expr="//field[@name='currency_id']" position="after">
|
||||||
|
<field name="fl_unemp_rate_2016"/>
|
||||||
|
<field name="fl_unemp_rate_2017"/>
|
||||||
|
<field name="fl_unemp_rate_2018"/>
|
||||||
|
</xpath>
|
||||||
|
</data>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user