mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Update l10n_us_fl_hr_payroll for 2019 Rates and Limits
No changes from 2018 other than refactor.
This commit is contained in:
@@ -30,6 +30,32 @@ New Payslip Categories for:
|
|||||||
* Florida Unemployment
|
* Florida Unemployment
|
||||||
* Florida Unemployment - Wages
|
* Florida Unemployment - Wages
|
||||||
|
|
||||||
|
Upgrading to 2019
|
||||||
|
==========================
|
||||||
|
|
||||||
|
If you were using this prior to January 2019, then you will need to run the following
|
||||||
|
migration script.
|
||||||
|
|
||||||
|
Odoo Shell code::
|
||||||
|
|
||||||
|
def migrate_rule_name(rule_id):
|
||||||
|
main = env.ref(rule_id)
|
||||||
|
old_2017 = env.ref(rule_id.replace('2018', '2017'))
|
||||||
|
old_2016 = env.ref(rule_id.replace('2018', '2016'))
|
||||||
|
lines = env['hr.payslip.line'].search([('salary_rule_id', 'in', [old_2017.id, old_2016.id,])])
|
||||||
|
lines.write({'salary_rule_id': main.id})
|
||||||
|
|
||||||
|
rules = [
|
||||||
|
'l10n_us_fl_hr_payroll.hr_payroll_rules_fl_unemp_wages_2018',
|
||||||
|
'l10n_us_fl_hr_payroll.hr_payroll_rules_fl_unemp_2018',
|
||||||
|
]
|
||||||
|
for rule_id in rules:
|
||||||
|
migrate_rule_name(rule_id)
|
||||||
|
|
||||||
|
env.cr.commit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=======
|
=======
|
||||||
License
|
License
|
||||||
=======
|
=======
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from . import us_fl_hr_payroll
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'category': 'Localization',
|
'category': 'Localization',
|
||||||
'depends': ['l10n_us_hr_payroll'],
|
'depends': ['l10n_us_hr_payroll'],
|
||||||
'version': '11.0.2017.0.0',
|
'version': '11.0.2019.0.0',
|
||||||
'description': """
|
'description': """
|
||||||
USA::Florida Payroll Rules.
|
USA::Florida Payroll Rules.
|
||||||
===========================
|
===========================
|
||||||
@@ -18,11 +18,10 @@ USA::Florida Payroll Rules.
|
|||||||
'auto_install': False,
|
'auto_install': False,
|
||||||
'website': 'https://hibou.io/',
|
'website': 'https://hibou.io/',
|
||||||
'data':[
|
'data':[
|
||||||
'us_fl_hr_payroll_view.xml',
|
'views/us_fl_hr_payroll_views.xml',
|
||||||
'data/base.xml',
|
'data/base.xml',
|
||||||
'data/rules_2016.xml',
|
'data/rates.xml',
|
||||||
'data/rules_2017.xml',
|
'data/rules.xml',
|
||||||
'data/rules_2018.xml',
|
|
||||||
'data/final.xml',
|
'data/final.xml',
|
||||||
],
|
],
|
||||||
'installable': True
|
'installable': True
|
||||||
|
|||||||
@@ -17,13 +17,13 @@
|
|||||||
|
|
||||||
<!-- HR SALARY RULE CATEGORIES-->
|
<!-- HR SALARY RULE CATEGORIES-->
|
||||||
<record id="hr_payroll_fl_unemp_wages" model="hr.salary.rule.category">
|
<record id="hr_payroll_fl_unemp_wages" model="hr.salary.rule.category">
|
||||||
<field name="name">Florida Unemployment - Wages</field>
|
<field name="name">Wage: US-FL Unemployment</field>
|
||||||
<field name="code">FL_UNEMP_WAGES</field>
|
<field name="code">WAGE_US_FL_UNEMP</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="hr_payroll_fl_unemp" model="hr.salary.rule.category">
|
<record id="hr_payroll_fl_unemp" model="hr.salary.rule.category">
|
||||||
<field name="name">Florida Unemployment</field>
|
<field name="name">ER: US-FL Unemployment</field>
|
||||||
<field name="code">FL_UNEMP</field>
|
<field name="code">ER_US_FL_UNEMP</field>
|
||||||
<field name="parent_id" ref="hr_payroll.COMP"/>
|
<field name="parent_id" ref="hr_payroll.COMP"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,6 @@
|
|||||||
<field name="code">US_FL_EMP</field>
|
<field name="code">US_FL_EMP</field>
|
||||||
<field name="name">USA Florida Employee</field>
|
<field name="name">USA Florida Employee</field>
|
||||||
<field eval="[(6, 0, [
|
<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_wages_2018'),
|
||||||
ref('hr_payroll_rules_fl_unemp_2018'),
|
ref('hr_payroll_rules_fl_unemp_2018'),
|
||||||
])]" name="rule_ids"/>
|
])]" name="rule_ids"/>
|
||||||
|
|||||||
19
l10n_us_fl_hr_payroll/data/rates.xml
Normal file
19
l10n_us_fl_hr_payroll/data/rates.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="hr_payroll_rates_fl_unemp_2018" model="hr.payroll.rate">
|
||||||
|
<field name="name">US Florida Unemployment</field>
|
||||||
|
<field name="code">US_FL_UNEMP</field>
|
||||||
|
<field name="rate">2.7</field>
|
||||||
|
<field name="date_from">2018-01-01</field>
|
||||||
|
<field name="wage_limit_year" eval="7000.0"/>
|
||||||
|
</record>
|
||||||
|
<record id="hr_payroll_rates_fl_unemp_2019" model="hr.payroll.rate">
|
||||||
|
<field name="name">US Florida Unemployment</field>
|
||||||
|
<field name="code">US_FL_UNEMP</field>
|
||||||
|
<field name="rate">2.7</field>
|
||||||
|
<field name="date_from">2019-01-01</field>
|
||||||
|
<field name="wage_limit_year" eval="7000.0"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
@@ -6,16 +6,18 @@
|
|||||||
<record id="hr_payroll_rules_fl_unemp_wages_2018" model="hr.salary.rule">
|
<record id="hr_payroll_rules_fl_unemp_wages_2018" model="hr.salary.rule">
|
||||||
<field name="sequence" eval="423"/>
|
<field name="sequence" eval="423"/>
|
||||||
<field name="category_id" ref="hr_payroll_fl_unemp_wages"/>
|
<field name="category_id" ref="hr_payroll_fl_unemp_wages"/>
|
||||||
<field name="name">Florida Unemployment - Wages (2018)</field>
|
<field name="name">Wage: US-FL Unemployment</field>
|
||||||
<field name="code">FL_UNEMP_WAGES_2018</field>
|
<field name="code">WAGE_US_FL_UNEMP</field>
|
||||||
<field name="condition_select">python</field>
|
<field name="condition_select">python</field>
|
||||||
<field name="condition_python">result = (payslip.date_to[:4] == '2018')</field>
|
<field name="condition_python">result = (contract.futa_type != contract.FUTA_TYPE_BASIC)</field>
|
||||||
<field name="amount_select">code</field>
|
<field name="amount_select">code</field>
|
||||||
<field name="amount_python_compute">
|
<field name="amount_python_compute">
|
||||||
###
|
###
|
||||||
ytd = payslip.sum('FL_UNEMP_WAGES_2018', '2018-01-01', '2019-01-01')
|
year = int(payslip.dict.date_to[:4])
|
||||||
|
rate = payslip.dict.get_rate('US_FL_UNEMP')
|
||||||
|
ytd = payslip.sum('WAGE_US_FL_UNEMP', str(year) + '-01-01', str(year+1) + '-01-01')
|
||||||
ytd += contract.external_wages
|
ytd += contract.external_wages
|
||||||
remaining = 7000.0 - ytd
|
remaining = rate.wage_limit_year - ytd
|
||||||
if remaining <= 0.0:
|
if remaining <= 0.0:
|
||||||
result = 0
|
result = 0
|
||||||
elif remaining < categories.BASIC:
|
elif remaining < categories.BASIC:
|
||||||
@@ -28,14 +30,15 @@ else:
|
|||||||
<record id="hr_payroll_rules_fl_unemp_2018" model="hr.salary.rule">
|
<record id="hr_payroll_rules_fl_unemp_2018" model="hr.salary.rule">
|
||||||
<field name="sequence" eval="443"/>
|
<field name="sequence" eval="443"/>
|
||||||
<field name="category_id" ref="hr_payroll_fl_unemp"/>
|
<field name="category_id" ref="hr_payroll_fl_unemp"/>
|
||||||
<field name="name">Florida Unemployment (2018)</field>
|
<field name="name">ER: US-FL Unemployment</field>
|
||||||
<field name="code">FL_UNEMP_2018</field>
|
<field name="code">ER_US_FL_UNEMP</field>
|
||||||
<field name="condition_select">python</field>
|
<field name="condition_select">python</field>
|
||||||
<field name="condition_python">result = (payslip.date_to[:4] == '2018')</field>
|
<field name="condition_python">result = (contract.futa_type != contract.FUTA_TYPE_BASIC)</field>
|
||||||
<field name="amount_select">code</field>
|
<field name="amount_select">code</field>
|
||||||
<field name="amount_python_compute">
|
<field name="amount_python_compute">
|
||||||
result_rate = -contract.fl_unemp_rate(2018)
|
rate = payslip.dict.get_rate('US_FL_UNEMP')
|
||||||
result = categories.FL_UNEMP_WAGES
|
result_rate = -rate.rate
|
||||||
|
result = categories.WAGE_US_FL_UNEMP
|
||||||
|
|
||||||
# result_rate of 0 implies 100% due to bug
|
# result_rate of 0 implies 100% due to bug
|
||||||
if result_rate == 0.0:
|
if result_rate == 0.0:
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
<?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>
|
|
||||||
@@ -1,5 +1,2 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
from . import test_us_fl_payslip_2016
|
|
||||||
from . import test_us_fl_payslip_2017
|
|
||||||
from . import test_us_fl_payslip_2018
|
from . import test_us_fl_payslip_2018
|
||||||
|
from . import test_us_fl_payslip_2019
|
||||||
|
|||||||
@@ -1,104 +0,0 @@
|
|||||||
# -*- 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.models.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)
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
# -*- 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.models.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)
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
# -*- 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.tests.test_us_payslip import TestUsPayslip, process_payslip
|
||||||
from odoo.addons.l10n_us_hr_payroll.models.l10n_us_hr_payroll import USHrContract
|
from odoo.addons.l10n_us_hr_payroll.models.l10n_us_hr_payroll import USHrContract
|
||||||
|
|
||||||
@@ -9,18 +7,14 @@ class TestUsFlPayslip(TestUsPayslip):
|
|||||||
# 2018 Taxes and Rates
|
# 2018 Taxes and Rates
|
||||||
###
|
###
|
||||||
FL_UNEMP_MAX_WAGE = 7000.0
|
FL_UNEMP_MAX_WAGE = 7000.0
|
||||||
|
FL_UNEMP = -2.7 / 100.0
|
||||||
|
|
||||||
def test_2018_taxes(self):
|
def test_2018_taxes(self):
|
||||||
salary = 5000.0
|
salary = 5000.0
|
||||||
|
|
||||||
employee = self._createEmployee()
|
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'))
|
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:')
|
self._log('2018 Florida tax first payslip:')
|
||||||
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
||||||
|
|
||||||
@@ -28,8 +22,8 @@ class TestUsFlPayslip(TestUsPayslip):
|
|||||||
|
|
||||||
cats = self._getCategories(payslip)
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], salary)
|
self.assertPayrollEqual(cats['WAGE_US_FL_UNEMP'], salary)
|
||||||
self.assertPayrollEqual(cats['FL_UNEMP'], cats['FL_UNEMP_WAGES'] * fl_unemp)
|
self.assertPayrollEqual(cats['ER_US_FL_UNEMP'], cats['WAGE_US_FL_UNEMP'] * self.FL_UNEMP)
|
||||||
|
|
||||||
process_payslip(payslip)
|
process_payslip(payslip)
|
||||||
|
|
||||||
@@ -45,22 +39,17 @@ class TestUsFlPayslip(TestUsPayslip):
|
|||||||
|
|
||||||
cats = self._getCategories(payslip)
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], remaining_fl_unemp_wages)
|
self.assertPayrollEqual(cats['WAGE_US_FL_UNEMP'], remaining_fl_unemp_wages)
|
||||||
self.assertPayrollEqual(cats['FL_UNEMP'], remaining_fl_unemp_wages * fl_unemp)
|
self.assertPayrollEqual(cats['ER_US_FL_UNEMP'], remaining_fl_unemp_wages * self.FL_UNEMP)
|
||||||
|
|
||||||
def test_2018_taxes_with_external(self):
|
def test_2018_taxes_with_external(self):
|
||||||
salary = 5000.0
|
salary = 5000.0
|
||||||
external_wages = 6000.0
|
external_wages = 6000.0
|
||||||
|
|
||||||
employee = self._createEmployee()
|
employee = self._createEmployee()
|
||||||
employee.company_id.fl_unemp_rate_2018 = 2.7
|
|
||||||
|
|
||||||
contract = self._createContract(employee, salary, external_wages=external_wages,
|
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'))
|
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:')
|
self._log('2018 Forida_external tax first payslip:')
|
||||||
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
||||||
|
|
||||||
@@ -68,24 +57,17 @@ class TestUsFlPayslip(TestUsPayslip):
|
|||||||
|
|
||||||
cats = self._getCategories(payslip)
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], self.FL_UNEMP_MAX_WAGE - external_wages)
|
self.assertPayrollEqual(cats['WAGE_US_FL_UNEMP'], self.FL_UNEMP_MAX_WAGE - external_wages)
|
||||||
self.assertPayrollEqual(cats['FL_UNEMP'], cats['FL_UNEMP_WAGES'] * fl_unemp)
|
self.assertPayrollEqual(cats['ER_US_FL_UNEMP'], cats['WAGE_US_FL_UNEMP'] * self.FL_UNEMP)
|
||||||
|
|
||||||
def test_2018_taxes_with_state_exempt(self):
|
def test_2018_taxes_with_state_exempt(self):
|
||||||
salary = 5000.0
|
salary = 5000.0
|
||||||
external_wages = 6000.0
|
external_wages = 6000.0
|
||||||
|
|
||||||
employee = self._createEmployee()
|
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(
|
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)
|
'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:')
|
self._log('2018 Forida_external tax first payslip:')
|
||||||
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31')
|
||||||
|
|
||||||
@@ -93,5 +75,5 @@ class TestUsFlPayslip(TestUsPayslip):
|
|||||||
|
|
||||||
cats = self._getCategories(payslip)
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
self.assertPayrollEqual(cats['FL_UNEMP_WAGES'], self.FL_UNEMP_MAX_WAGE - external_wages)
|
self.assertPayrollEqual(cats.get('WAGE_US_FL_UNEMP', 0.0), 0.0)
|
||||||
self.assertPayrollEqual(cats['FL_UNEMP'], cats['FL_UNEMP_WAGES'] * fl_unemp)
|
self.assertPayrollEqual(cats.get('ER_US_FL_UNEMP', 0.0), 0.0)
|
||||||
|
|||||||
79
l10n_us_fl_hr_payroll/tests/test_us_fl_payslip_2019.py
Executable file
79
l10n_us_fl_hr_payroll/tests/test_us_fl_payslip_2019.py
Executable file
@@ -0,0 +1,79 @@
|
|||||||
|
from odoo.addons.l10n_us_hr_payroll.tests.test_us_payslip import TestUsPayslip, process_payslip
|
||||||
|
from odoo.addons.l10n_us_hr_payroll.models.l10n_us_hr_payroll import USHrContract
|
||||||
|
|
||||||
|
|
||||||
|
class TestUsFlPayslip(TestUsPayslip):
|
||||||
|
###
|
||||||
|
# 2019 Taxes and Rates
|
||||||
|
###
|
||||||
|
FL_UNEMP_MAX_WAGE = 7000.0
|
||||||
|
FL_UNEMP = -2.7 / 100.0
|
||||||
|
|
||||||
|
def test_2019_taxes(self):
|
||||||
|
salary = 5000.0
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
contract = self._createContract(employee, salary, struct_id=self.ref('l10n_us_fl_hr_payroll.hr_payroll_salary_structure_us_fl_employee'))
|
||||||
|
|
||||||
|
self._log('2019 Florida tax first payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['WAGE_US_FL_UNEMP'], salary)
|
||||||
|
self.assertPayrollEqual(cats['ER_US_FL_UNEMP'], cats['WAGE_US_FL_UNEMP'] * self.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('2019 Florida tax second payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2019-02-01', '2019-02-28')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['WAGE_US_FL_UNEMP'], remaining_fl_unemp_wages)
|
||||||
|
self.assertPayrollEqual(cats['ER_US_FL_UNEMP'], remaining_fl_unemp_wages * self.FL_UNEMP)
|
||||||
|
|
||||||
|
def test_2019_taxes_with_external(self):
|
||||||
|
salary = 5000.0
|
||||||
|
external_wages = 6000.0
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
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'))
|
||||||
|
|
||||||
|
self._log('2019 Forida_external tax first payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats['WAGE_US_FL_UNEMP'], self.FL_UNEMP_MAX_WAGE - external_wages)
|
||||||
|
self.assertPayrollEqual(cats['ER_US_FL_UNEMP'], cats['WAGE_US_FL_UNEMP'] * self.FL_UNEMP)
|
||||||
|
|
||||||
|
def test_2019_taxes_with_state_exempt(self):
|
||||||
|
salary = 5000.0
|
||||||
|
external_wages = 6000.0
|
||||||
|
|
||||||
|
employee = self._createEmployee()
|
||||||
|
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)
|
||||||
|
|
||||||
|
self._log('2019 Forida_external tax first payslip:')
|
||||||
|
payslip = self._createPayslip(employee, '2019-01-01', '2019-01-31')
|
||||||
|
|
||||||
|
payslip.compute_sheet()
|
||||||
|
|
||||||
|
cats = self._getCategories(payslip)
|
||||||
|
|
||||||
|
self.assertPayrollEqual(cats.get('WAGE_US_FL_UNEMP', 0.0), 0.0)
|
||||||
|
self.assertPayrollEqual(cats.get('ER_US_FL_UNEMP', 0.0), 0.0)
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
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)
|
|
||||||
@@ -1,21 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
<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>
|
|
||||||
<record id="hr_contract_form_l10n_us_fl_inherit" model="ir.ui.view">
|
<record id="hr_contract_form_l10n_us_fl_inherit" model="ir.ui.view">
|
||||||
<field name="name">hr.contract.form.inherit</field>
|
<field name="name">hr.contract.form.inherit</field>
|
||||||
<field name="model">hr.contract</field>
|
<field name="model">hr.contract</field>
|
||||||
Reference in New Issue
Block a user