Skip to content

Commit

Permalink
[ADD] Module hr_employee_exemption
Browse files Browse the repository at this point in the history
  • Loading branch information
dufresnedavid committed Apr 23, 2015
1 parent 709a079 commit eb8b281
Show file tree
Hide file tree
Showing 14 changed files with 591 additions and 0 deletions.
48 changes: 48 additions & 0 deletions hr_employee_exemption/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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 exemption types
exemple:
- name: 'Exemption from federal tax'
- code: 'FED'

Go to: Human Resources -> Human Resources -> Employees
Select an employee
In the Tax Exemptions tab, add exemptions

In your salary rules, you may access check if an employee is exempted from a source deduction:
if employee.exempted_from('FED', payslip.date_from):
result = ...
else:
result = ...


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.
26 changes: 26 additions & 0 deletions hr_employee_exemption/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- 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,
hr_employee_exemption,
hr_income_tax_exemption,
)
44 changes: 44 additions & 0 deletions hr_employee_exemption/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- 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',
'license': 'AGPL-3',
'category': 'Generic Modules/Human Resources',
'author': "Savoir-faire Linux, Odoo Community Association (OCA)",
'website': 'https://www.savoirfairelinux.com',
'description': """
Employee Exemption
==================
Add employee benefits in order to compute payslips.
""",
'depends': [
'hr_payroll',
],
'data': [
'security/ir.model.access.csv',
'view/hr_employee_view.xml',
'view/hr_income_tax_exemption_view.xml',
],
'test': [],
'demo': [],
'installable': True,
}
47 changes: 47 additions & 0 deletions hr_employee_exemption/hr_employee.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/>.
#
##############################################################################

from openerp.osv import orm, fields


class hr_employee_exemption(orm.Model):
_inherit = 'hr.employee'

_columns = {
'exemption_ids': fields.one2many(
'hr.employee.exemption',
'employee_id',
'Income Tax Exemptions',
),
}

def exempted_from(self, cr, uid, ids, code, date, context=None):
"""
The method to call from a salary rule to check whether an employee
is exempted from a source deduction
"""
employee = self.browse(cr, uid, ids[0], context=context)
for exemption in employee.exemption_ids:
if exemption.exemption_id.code == code and \
exemption.date_from <= date and (
not exemption.date_to or date <= exemption.date_to):
return True
return False
43 changes: 43 additions & 0 deletions hr_employee_exemption/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.osv import orm, fields


class hr_employee_exemption(orm.Model):
_name = 'hr.employee.exemption'
_description = 'Employee Income Tax Exemption'

_columns = {
'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'),
}
35 changes: 35 additions & 0 deletions hr_employee_exemption/hr_income_tax_exemption.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- 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.osv import fields, orm


class hr_income_tax_exemption(orm.Model):
_name = 'hr.income.tax.exemption'
_description = 'Income Tax Exemption'
_columns = {
'name': fields.char('Name', required=True),
'code': fields.char(
'Code', required=True, help=""
"The code that can be used in the salary rules to identify "
"the exemption"
),
}
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-03-14 18:29+0000\n"
"PO-Revision-Date: 2015-03-14 14:34-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_employee_exemption
msgid "hr.employee.exemption"
msgstr "hr.employee.exemption"

#. module: hr_employee_exemption
#: field:hr.income.tax.exemption,code:0
msgid "Code"
msgstr "Code"

#. module: hr_employee_exemption
#: field:hr.employee.exemption,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
#: help:hr.income.tax.exemption,code:0
msgid "The code that can be used in the salary rules to identify the exemption"
msgstr ""
"Le code pouvant être utilisé dans les règles de salaire pour identifier "
"l'exonération."

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

#. 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 fin"

#. 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é"
Loading

0 comments on commit eb8b281

Please sign in to comment.