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

[MIG] [11.0] Migrate hr_payroll_cancel to 11.0 #436

Merged
merged 7 commits into from
Jun 22, 2018
Merged
Show file tree
Hide file tree
Changes from all 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
68 changes: 68 additions & 0 deletions hr_payroll_cancel/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

=================
HR Payroll Cancel
=================

This module allows the user to cancel a payslip whatever the previous state is
without doing a refund. When the user cancel the journal entry is deleted
and the payslip state is set to rejected. Then the user is able to set the
state to draft again and later on he/she is able to confirm again the payslip.

If there’s a refund for a payslip the user should not cancel the entry because
the refund would still be confirm. In that case, the user have either to
confirm again the payslip or cancel the refund.

Usage
=====

Go to: Payroll -> Employee Payslip

#. Choose a payslip from the list.
#. Click on the button "Cancel Payslip" to cancel the payslip.
#. Now the payslip is in rejected state.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/116/11.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/hr/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.

Contributors
------------
* Luis Torres (luis_t@vauxoo.com)
* Aaron Henriquez (ahenriquez@eficent.com)
* Lois Rilo (lois.rilo@eficent.com)
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
* Duc, Dao Dong <duc.dd@komit-consulting.com> (https://komit-consulting.com)

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://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 https://odoo-community.org.
7 changes: 7 additions & 0 deletions hr_payroll_cancel/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2014 - Vauxoo http://www.vauxoo.com/
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import models
24 changes: 24 additions & 0 deletions hr_payroll_cancel/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2014 - Vauxoo http://www.vauxoo.com/
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Hr Payroll Cancel",
"version": "11.0.1.0.0",
"author": "Vauxoo, Eficent, "
"Serpent Consulting Services Pvt. Ltd.,"
"Odoo Community Association (OCA)",
"category": "HR",
"website": "http://www.vauxoo.com/",
"license": "AGPL-3",
"depends": [
"account_cancel",
"hr_payroll_account",
],
"data": [
"views/hr_payslip_view.xml",
],
"installable": True,
}
39 changes: 39 additions & 0 deletions hr_payroll_cancel/i18n/cs_CZ.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_payroll_cancel
#
# Translators:
# Lukáš Spurný <lukasspurny8@gmail.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-23 03:46+0000\n"
"PO-Revision-Date: 2018-02-23 03:46+0000\n"
"Last-Translator: Lukáš Spurný <lukasspurny8@gmail.com>, 2018\n"
"Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/teams/23907/cs_CZ/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: cs_CZ\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"

#. module: hr_payroll_cancel
#: model:ir.model,name:hr_payroll_cancel.model_hr_payslip
msgid "Pay Slip"
msgstr "Platební klip"

#. module: hr_payroll_cancel
#: model:ir.model.fields,field_description:hr_payroll_cancel.field_hr_payslip_refunded_id
msgid "Refunded Payslip"
msgstr "Re-financovaný výplatní poplatek"

#. module: hr_payroll_cancel
#: code:addons/hr_payroll_cancel/models/hr_payroll.py:32
#, python-format
msgid ""
"To cancel the Original Payslip the\n"
" Refunded Payslip needs to be canceled first!"
msgstr ""
"Chcete-li zrušit původní výplatní poplatek, musíte vrátit platbu na první "
"platbu!"
40 changes: 40 additions & 0 deletions hr_payroll_cancel/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_payroll_cancel
#
# Translators:
# Alexandre Fayolle <alexandre.fayolle@camptocamp.com>, 2018
# Quentin THEURET <odoo@kerpeo.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-23 03:46+0000\n"
"PO-Revision-Date: 2018-02-23 03:46+0000\n"
"Last-Translator: Quentin THEURET <odoo@kerpeo.com>, 2018\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"

#. module: hr_payroll_cancel
#: model:ir.model,name:hr_payroll_cancel.model_hr_payslip
msgid "Pay Slip"
msgstr "Feuille de paie"

#. module: hr_payroll_cancel
#: model:ir.model.fields,field_description:hr_payroll_cancel.field_hr_payslip_refunded_id
msgid "Refunded Payslip"
msgstr "Feuille de paie remboursée"

#. module: hr_payroll_cancel
#: code:addons/hr_payroll_cancel/models/hr_payroll.py:32
#, python-format
msgid ""
"To cancel the Original Payslip the\n"
" Refunded Payslip needs to be canceled first!"
msgstr ""
"Pour annuler la feuille de paie originale, la\n"
" feuille de paie remboursée doit être annulée en premier !"
24 changes: 24 additions & 0 deletions hr_payroll_cancel/i18n/sl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_payroll_cancel
#
# Translators:
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-09 00:49+0000\n"
"PO-Revision-Date: 2016-08-09 00:49+0000\n"
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>, 2016\n"
"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: sl\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n"

#. module: hr_payroll_cancel
#: view:hr.payslip:hr_payroll_cancel.view_cancel_payslip_form
msgid "draft,hr_check,confirm,verify,done"
msgstr "draft,hr_check,confirm,verify,done"
7 changes: 7 additions & 0 deletions hr_payroll_cancel/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright 2014 - Vauxoo http://www.vauxoo.com/
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import hr_payroll
36 changes: 36 additions & 0 deletions hr_payroll_cancel/models/hr_payroll.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2014 - Vauxoo http://www.vauxoo.com/
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
# (<http://www.serpentcs.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
from odoo.tools.safe_eval import safe_eval as eval


class HrPayslip(models.Model):
_inherit = 'hr.payslip'

refunded_id = fields.Many2one(
'hr.payslip',
string='Refunded Payslip',
readonly=True
)

@api.multi
def refund_sheet(self):
res = super(HrPayslip, self).refund_sheet()
self.write({'refunded_id': eval(res['domain'])[0][2][0] or False})
return res

@api.multi
def action_payslip_cancel(self):
for payslip in self:
if payslip.refunded_id and payslip.refunded_id.state != 'cancel':
raise ValidationError(_("""To cancel the Original Payslip the
Refunded Payslip needs to be canceled first!"""))
payslip.move_id.button_cancel()
payslip.move_id.unlink()

return self.write({'state': 'cancel'})
Binary file added hr_payroll_cancel/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions hr_payroll_cancel/views/hr_payslip_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo>

<record id="view_cancel_payslip_form" model="ir.ui.view">
<field name="name">view.cancel.payslip.form</field>
<field name="model">hr.payslip</field>
<field name="inherit_id" ref="hr_payroll.view_hr_payslip_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_payslip_cancel']"
position="attributes">
<attribute name="states">draft,hr_check,confirm,verify,done</attribute>
</xpath>
<field name="credit_note" position="after">
<field name="refunded_id" attrs="{'invisible': [('refunded_id', '=', False)]}"/>
</field>
</field>
</record>

</odoo>