Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8.0 hr employee exemption #165

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions hr_employee_exemption/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3

==================
Employee Exemption
==================

This module implements employee exemption.
This allows in salary rules to know whether the employee is exempted from a source deduction.

Usage
=====

Go to: Human Resources -> Configuration -> Payroll -> Income Tax Exemptions
Create an exemption (EX1)

Go to: Human Resources -> Configuration -> Payroll -> Salary Rules
Select a salary rule (R1) on which to apply the exemption
In the field 'Exemption', select the exemption EX1

Go to: Human Resources -> Human Resources -> Employees
Select an employee (E1)
In the Tax Exemptions tab, add exemption EX1 and the period of time over which it applies.

The amount will be 0 for rule R1 in employee E1's payslips.

Credits
=======

Contributors
------------
* David Dufresne <david.dufresne@savoirfairelinux.com>
* Maxime Chambreuil <maxime.chambreuil@savoirfairelinux.com>
* Pierre Lamarche <pierre.lamarche@savoirfairelinux.com>

Maintainer
----------

.. image:: http://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

To contribute to this module, please visit http://odoo-community.org.
22 changes: 22 additions & 0 deletions hr_employee_exemption/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Savoir-faire Linux. All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from . import models
47 changes: 47 additions & 0 deletions hr_employee_exemption/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Savoir-faire Linux. All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

{
'name': 'Employee Exemption',
'version': '1.0',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use correct versioning convention

'license': 'AGPL-3',
'category': 'Generic Modules/Human Resources',
'author': "Savoir-faire Linux, Odoo Community Association (OCA)",
'website': 'https://www.savoirfairelinux.com',
'description': """
Employee Exemption
==================
This module implements employee exemption.
This allows in salary rules to know whether the employee is exempted
from a source deduction.
""",
'depends': [
'hr_payroll',
],
'data': [
'security/ir.model.access.csv',
'view/hr_employee_view.xml',
'view/hr_income_tax_exemption_view.xml',
'view/hr_salary_rule_view.xml',
],
'test': [],
'demo': [],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid empty keys

'installable': True,
}
77 changes: 77 additions & 0 deletions hr_employee_exemption/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * hr_employee_exemption
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-14 14:14+0000\n"
"PO-Revision-Date: 2015-05-14 10:16-0500\n"
"Last-Translator: David Dufresne <david.dufresne@savoirfairelinux.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"X-Generator: Poedit 1.5.4\n"

#. module: hr_employee_exemption
#: model:ir.model,name:hr_employee_exemption.model_hr_salary_rule
msgid "hr.salary.rule"
msgstr "hr.salary.rule"

#. module: hr_employee_exemption
#: field:hr.employee.exemption,exemption_id:0
#: field:hr.salary.rule,exemption_id:0
msgid "Exemption"
msgstr "Exonération"

#. module: hr_employee_exemption
#: field:hr.income.tax.exemption,name:0
msgid "Name"
msgstr "Nom"

#. module: hr_employee_exemption
#: field:hr.employee,exemption_ids:0 view:hr.income.tax.exemption:0
#: model:ir.actions.act_window,name:hr_employee_exemption.action_hr_income_tax_exemption_list
#: model:ir.ui.menu,name:hr_employee_exemption.menu_action_hr_income_tax_exemption_list
msgid "Income Tax Exemptions"
msgstr "Exonérations d'impôt"

#. module: hr_employee_exemption
#: view:hr.employee:0
msgid "Tax Exemptions"
msgstr "Exonérations d'impôt"

#. module: hr_employee_exemption
#: model:ir.model,name:hr_employee_exemption.model_hr_employee_exemption
msgid "Employee Income Tax Exemption"
msgstr "Exonération d'impôt de l'employé"

#. module: hr_employee_exemption
#: view:hr.income.tax.exemption:0
#: field:hr.income.tax.exemption,salary_rule_ids:0
msgid "Salary Rules"
msgstr "Règles de salaire"

#. module: hr_employee_exemption
#: field:hr.employee.exemption,date_to:0
msgid "Date To"
msgstr "Date de fin"

#. module: hr_employee_exemption
#: model:ir.model,name:hr_employee_exemption.model_hr_income_tax_exemption
msgid "Income Tax Exemption"
msgstr "Exonération d'impôt"

#. module: hr_employee_exemption
#: field:hr.employee.exemption,date_from:0
msgid "Date From"
msgstr "Date de début"

#. module: hr_employee_exemption
#: field:hr.employee.exemption,employee_id:0
#: model:ir.model,name:hr_employee_exemption.model_hr_employee
msgid "Employee"
msgstr "Employé"
78 changes: 78 additions & 0 deletions hr_employee_exemption/i18n/hr_employee_exemption.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * hr_employee_exemption
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 7.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-05-14 14:14+0000\n"
"PO-Revision-Date: 2015-05-14 14:14+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: hr_employee_exemption
#: model:ir.model,name:hr_employee_exemption.model_hr_salary_rule
msgid "hr.salary.rule"
msgstr ""

#. module: hr_employee_exemption
#: field:hr.employee.exemption,exemption_id:0
#: field:hr.salary.rule,exemption_id:0
msgid "Exemption"
msgstr ""

#. module: hr_employee_exemption
#: field:hr.income.tax.exemption,name:0
msgid "Name"
msgstr ""

#. module: hr_employee_exemption
#: field:hr.employee,exemption_ids:0
#: view:hr.income.tax.exemption:0
#: model:ir.actions.act_window,name:hr_employee_exemption.action_hr_income_tax_exemption_list
#: model:ir.ui.menu,name:hr_employee_exemption.menu_action_hr_income_tax_exemption_list
msgid "Income Tax Exemptions"
msgstr ""

#. module: hr_employee_exemption
#: view:hr.employee:0
msgid "Tax Exemptions"
msgstr ""

#. module: hr_employee_exemption
#: model:ir.model,name:hr_employee_exemption.model_hr_employee_exemption
msgid "Employee Income Tax Exemption"
msgstr ""

#. module: hr_employee_exemption
#: view:hr.income.tax.exemption:0
#: field:hr.income.tax.exemption,salary_rule_ids:0
msgid "Salary Rules"
msgstr ""

#. module: hr_employee_exemption
#: field:hr.employee.exemption,date_to:0
msgid "Date To"
msgstr ""

#. module: hr_employee_exemption
#: model:ir.model,name:hr_employee_exemption.model_hr_income_tax_exemption
msgid "Income Tax Exemption"
msgstr ""

#. module: hr_employee_exemption
#: field:hr.employee.exemption,date_from:0
msgid "Date From"
msgstr ""

#. module: hr_employee_exemption
#: field:hr.employee.exemption,employee_id:0
#: model:ir.model,name:hr_employee_exemption.model_hr_employee
msgid "Employee"
msgstr ""

25 changes: 25 additions & 0 deletions hr_employee_exemption/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Savoir-faire Linux. All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from . import hr_employee
from . import hr_employee_exemption
from . import hr_income_tax_exemption
from . import hr_salary_rule
53 changes: 53 additions & 0 deletions hr_employee_exemption/models/hr_employee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Savoir-faire Linux. All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from openerp import api, models, fields


class HrEmployee(models.Model):
_inherit = 'hr.employee'

exemption_ids = fields.One2many(
'hr.employee.exemption',
'employee_id',
'Income Tax Exemptions',
groups='base.group_hr_manager',
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this be better on hr.contract? In my opinion payroll related features are better off on hr.contract

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone is exempted from a tax, it has nothing to do with his contract. The person would be exempted whatever job he has.

@api.multi
def exempted_from(self, exemption, date):
"""
The method to call from a salary rule to check whether an employee
is exempted from a source deduction

:type exemption: hr.income.tax.exemption browse record
"""
self.ensure_one()

for e in self.exemption_ids:
if (
e.exemption_id == exemption and
e.date_from <= date and
(not e.date_to or date <= e.date_to)
):
return True

return False
43 changes: 43 additions & 0 deletions hr_employee_exemption/models/hr_employee_exemption.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Savoir-faire Linux. All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from openerp import fields, models, _


class HrEmployeeExemption(models.Model):
"""Employee Income Tax Exemption"""

_name = 'hr.employee.exemption'
_description = _(__doc__)

employee_id = fields.Many2one(
'hr.employee',
'Employee',
required=True,
ondelete='cascade',
)
exemption_id = fields.Many2one(
'hr.income.tax.exemption',
'Exemption',
required=True,
)
date_from = fields.Date('Date From', required=True)
date_to = fields.Date('Date To')
Loading