Skip to content

Commit

Permalink
[ADD] account_invoice_refund_reinvoice
Browse files Browse the repository at this point in the history
  • Loading branch information
etobella authored and olgamarcocb committed May 9, 2022
1 parent 435bfb6 commit 4340713
Show file tree
Hide file tree
Showing 14 changed files with 653 additions and 0 deletions.
82 changes: 82 additions & 0 deletions account_invoice_refund_reinvoice/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
================================
Account Invoice Reinvoice Refund
================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/13.0/account_invoice_refund_reinvoice
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-13-0/account-invoicing-13-0-account_invoice_refund_reinvoice
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/95/13.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This addon allows to restore a refund keeping all it's data.
It is useful when the invoice is linked to a Sale Order or Purchase Order,
this way no information is lost.

**Table of contents**

.. contents::
:local:

Usage
=====

* Access a refund
* Press on `Restore Credit Note`
* A new invoice is created using the same information

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_invoice_refund_reinvoice%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Creu Blanca

Contributors
~~~~~~~~~~~~

* Enric Tobella

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

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

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.

This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/13.0/account_invoice_refund_reinvoice>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions account_invoice_refund_reinvoice/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions account_invoice_refund_reinvoice/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2021 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Account Invoice Reinvoice Refund",
"summary": """
Allow to Reinvoice a Refund""",
"version": "13.0.1.0.0",
"license": "AGPL-3",
"author": "Creu Blanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-invoicing",
"depends": ["account"],
"data": ["views/account_move.xml"],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_invoice_refund_reinvoice
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \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: account_invoice_refund_reinvoice
#: model:ir.model,name:account_invoice_refund_reinvoice.model_account_move
msgid "Journal Entries"
msgstr ""

#. module: account_invoice_refund_reinvoice
#: model_terms:ir.ui.view,arch_db:account_invoice_refund_reinvoice.account_move_form_view
msgid "Restore Credit Note"
msgstr ""

#. module: account_invoice_refund_reinvoice
#: code:addons/account_invoice_refund_reinvoice/models/account_move.py:0
#, python-format
msgid "Reversal of: %s"
msgstr ""
1 change: 1 addition & 0 deletions account_invoice_refund_reinvoice/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_move
34 changes: 34 additions & 0 deletions account_invoice_refund_reinvoice/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2021 Creu Blanca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import _, models


class AccountMove(models.Model):

_inherit = "account.move"

def _prepare_reinvoice_reversal(self):
return {
"ref": _("Reversal of: %s") % (self.name),
"journal_id": self.journal_id.id,
"invoice_payment_term_id": None,
"invoice_user_id": self.invoice_user_id.id,
}

def _reverse_move_vals(self, default_values, cancel=True):
if self.env.context.get("reinvoice_refund"):
if self.type == "out_refund":
default_values["type"] = "out_invoice"
elif self.type == "in_refund":
default_values["type"] = "in_invoice"
return super(AccountMove, self)._reverse_move_vals(
default_values, cancel=cancel
)

def action_refund_reinvoice(self):
self.ensure_one()
reverse_move = self.with_context(reinvoice_refund=True)._reverse_moves(
[self._prepare_reinvoice_reversal()], False
)
return reverse_move.get_formview_action()
1 change: 1 addition & 0 deletions account_invoice_refund_reinvoice/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Enric Tobella
3 changes: 3 additions & 0 deletions account_invoice_refund_reinvoice/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This addon allows to restore a refund keeping all it's data.
It is useful when the invoice is linked to a Sale Order or Purchase Order,
this way no information is lost.
3 changes: 3 additions & 0 deletions account_invoice_refund_reinvoice/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Access a refund
* Press on `Restore Credit Note`
* A new invoice is created using the same information
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4340713

Please sign in to comment.